Opened 2 years ago

Closed 13 months ago

Last modified 12 months ago

#6667 closed change (rejected)

Reuse code from ElemHide module for faster lookup of Snippets scripts

Reported by: mjethani Assignee: mjethani
Priority: Unknown Milestone:
Module: Core Keywords: circumvention, closed-in-favor-of-gitlab
Cc: kzar, sergz, arthur Blocked By: #6652
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by mjethani)


In the initial implementation of Snippets (see #6538), we use the same logic as ElemHideEmulation for looking up scripts for a given domain. We go through all the snippet filters and check if the filter applies on the domain. This should be OK when the list of filters is small, but it will likely not be good enough once we start using Snippets aggressively.

We inject the JavaScript into the document using tabs.executeScript in the webNavigation.onCommitted handler (see #6539). Often by the time our code has a chance to run, it may be too late, as the HTML document may have already executed its own code to circumvent the snippet. This is particularly true for API wrappers.

What to change

(Find a nice way to reuse the logic in the ElemHide module for looking up scripts for a domain efficiently. At the very least, index filters by domain and reuse the selector matching code in ElemHide. We may also want to do some more optimizations. For example, if we know that there are no exceptions for a domain, we could "whitelist" it and return all the filters for the domain without any checks. We might also want to cache the results specifically for snippet scripts. Also see #6652 and #6665. Update this section.)

Change History (5)

comment:1 Changed 2 years ago by mjethani

  • Description modified (diff)

comment:2 follow-ups: Changed 2 years ago by arthur

  • Cc arthur added

comment:3 in reply to: ↑ 2 Changed 2 years ago by deblx


Last edited 12 months ago by kzar (previous) (diff)

comment:4 in reply to: ↑ 2 Changed 2 years ago by deblx

Version 2, edited 2 years ago by philll (previous) (next) (diff)

comment:5 Changed 13 months ago by sebastian

  • Keywords closed-in-favor-of-gitlab added
  • Resolution set to rejected
  • Status changed from new to closed

Sorry, but we switched to GitLab. If this issue is still relevant, please file it again in the new issue tracker.

Note: See TracTickets for help on using tickets.