Opened 9 months ago

Last modified 9 months ago

#6667 new change

Reuse code from ElemHide module for faster lookup of Snippets scripts

Reported by: mjethani Assignee: mjethani
Priority: Unknown Milestone:
Module: Core Keywords: circumvention
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)

Background

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 (4)

comment:1 Changed 9 months ago by mjethani

  • Description modified (diff)

comment:2 follow-ups: Changed 9 months ago by arthur

  • Cc arthur added

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

Last edited 9 months ago by philll (previous) (diff)

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

Last edited 9 months ago by philll (previous) (diff)
Note: See TracTickets for help on using tickets.