Changes between Initial Version and Version 1 of Ticket #6957


Ignore:
Timestamp:
09/20/2018 12:43:09 PM (15 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6957

    • Property Cc jsonesen hfiguiere added
    • Property Blocked By changed from to 6956
    • Property Summary changed from Return cached string object for unconditional style sheet to Combine element hiding selector matching with style sheet generation
    • Property Ready set
  • Ticket #6957 – Description

    initial v1  
    11=== Background === 
    2 After #6956, the extension should ask core to generate a style sheet using the new `createStyleSheet` function. This is an opportunity to make sure that there is only one string object for the style sheet that is injected into most frames with no domain-specific filters or exceptions. 
     2After #6956, it will be possible for core to generate the style sheet on its own. In order to optimize style sheet generation in practice, it could be combined with the code for looking up selectors for a domain. The "default" style sheet, based on the list of "unconditional" selectors, would have to be generated only once and cached. Then each call to the style sheet generation code would only have to generate a second style sheet, based on some ~1,000 selectors that don't apply to all domains, and concatenate it with the default style sheet. 
     3 
     4This would make the combination of selector lookup and style sheet generation much faster. It might also have benefits for memory usage, though this may no longer be a concern after #6967. 
    35 
    46=== What to change === 
    5 In `createStyleSheet`, check the argument passed in, and if it is the same as `unconditionalSelectors` then return a cached style sheet instead of generating a new one. 
     7In `lib/elemHide.js`, add a new `generateStyleSheetForDomain` function that performs the same task as `getSelectorsForDomain` but also returns a generated style sheet (CSS code to be injected directly into the document). This function should generate the default style sheet, based on the list of "unconditional" selectors, only once and then always use the cached value for subsequent calls. 
     8 
     9The cached default style sheet should be invalidated when the set of filters is updated. 
  • Ticket #6957 – Review URL(s)

    initial v1  
     1https://codereview.adblockplus.org/29886555/