Changes between Version 2 and Version 5 of Ticket #6999


Ignore:
Timestamp:
10/02/2018 09:12:57 PM (15 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6999 – Description

    v2 v5  
    44After #6957, the background page will get the style sheet from core "for free" (almost), at least on most domains. It could then just pass the style sheet to the content script for injection. The overhead of passing the style sheet will simply ''replace'' the overhead of passing the selectors, as long as DevTools is not open. There is no additional cost of doing this for the most common case. 
    55 
     6=== Dependency update === 
     7 
     8This change involves an adblockpluscore dependency update to `hg:d555190eee2b git:a9327e3`, which includes the following changes: 
     9 
     10 * #6957 - Combine element hiding selector matching with style sheet generation 
     11 * #7001 - Use instance property maxCacheEntries in CombinedMatcher 
     12 * #6504 - Remove element hiding emulation code related to style sheets 
     13 
    614=== What to change === 
    7 [TBD] 
     15Update the adblockpluscore dependency to `hg:d555190eee2b git:a9327e3`. 
     16 
     17In `lib/contentFiltering.js`: 
     18 
     19 * Replace the call to `ElemHide.getSelectorsForDomain` (now removed) with a call to `ElemHide.generateStyleSheetForDomain`. The last argument should be `true` if the function should return selectors, which is required when DevTools logging is on (basically the value of the `trace` variable); otherwise it  should be `false`. 
     20 * Pass the `code` property of the returned object to `updateFrameStyles`, which should now take a style sheet (string) instead of a list of selectors (array) and should then not have to generate the style sheet itself by calling `createStyleSheet`. 
     21 * If user style sheets are not supported (the local `inline` variable is `true`), use the `rulesFromStyleSheet` function from `adblockpluscore/lib/elemHide.js` to extract the rules from the style sheet and return these rules as part of the response. 
     22 * In the `content.injectSelectors` handler, use the `createStyleSheet` function to create a style sheet out of the selectors in the message; pass this style sheet to `updateFrameStyles`. If user style sheets are not supported, return the rules from the style sheet (using `rulesFromStyleSheet`, as in the preceding point) back to the content script. 
     23 
     24In `include.preload.js`: 
     25 
     26 * Remove the first argument to the `ElemHideEmulation` constructor as it is no longer present after the dependency update. 
     27 * Rename `addSelectorsInline` to `addRulesInline` and let it take a list of rules that are directly inserted into the style sheet. 
     28 * In the `addSelectors` method, send the `content.injectSelectors` message unconditionally, and if the response is a list of CSS rules, call `addRulesInline` with these rules. 
     29 * Similarly, call `addRulesInline` if the response to the `content.applyFilters` message includes a list of rules. 
     30 * Remove the `filters` parameter and related code from the `addSelectors` method of `ContentFiltering`. 
     31 * Remove the `filters` parameter to the `addSelectors` method of `ElementHidingTracer`. 
     32 * Remove the `selectorGroupSize` and `inline` properties of `ContentFiltering`.