httpswitchboard icon indicating copy to clipboard operation
httpswitchboard copied to clipboard

Contemplate using chrome.tabs.injectScript for content scripting

Open gorhill opened this issue 11 years ago • 0 comments

With cosmetic filtering, there are now really 4 possible flavor for content scripting:

  • no UA spoofing, no cosmetic filtering
  • UA spoofing, no cosmetic filtering
  • no UA spoofing, cosmetic filtering
  • UA spoofing, cosmetic filtering

In the spirit of efficiency, not executing code for UA spoofing and cosmetic filtering is desirable when those features are not enabled.

The solution is to inject only the necessary content scripts, and this can be done only through the use of chrome.tabs.injectScript.

HTTPSB used to use this instead of simpler declarative content scripting, I will have to experiment again to find out the best point of injection (used to be based on webNavigation).

gorhill avatar May 19 '14 23:05 gorhill