Changes between Version 11 and Version 13 of Ticket #7179


Ignore:
Timestamp:
01/29/2019 03:34:41 AM (19 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7179

    • Property Status changed from new to closed
    • Property Resolution changed from to fixed
    • Property Priority changed from Unknown to P2
    • Property Ready set
  • Ticket #7179 – Description

    v11 v13  
    33 
    44=== What to change === 
    5 In `lib/matcher.js`, add a new `matches` method to `CombinedMatcher` that returns an array of filters. 
     5In `lib/matcher.js`, add a new `search` method to `CombinedMatcher` that returns two arrays of blocking and whitelist filters. The signature should be exactly same as the `matchesAny` method, but additionally it should take a `filterType` parameter, which can be `"blocking"` (only blocking filters), `"whitelist"` (only whitelist filters), or `"all"` (all filters, default). 
    66 
    7 The algorithm should be as follows: 
     7The result cache could be reused by adding a `*` to the key. 
    88 
    9  1.  Look for a blocking filter 
    10  2.  When the first blocking filter is found, start looking for whitelist filters 
    11  3.  If a whitelist filter is found, return the whitelist filter; if no whitelist filter is found, continue looking for blocking filters and return the entire list 
     9=== Integration notes === 
     10The new `search` method can be used to find all CSP filters. The optimal way to do this would be in the following manner (pseudocode): 
    1211 
    13 There will have to be a separate implementation of `_matchesAnyInternal` called `_matchesInternal`. The result cache could be reused by appending a `*` to the key. 
     12{{{ 
     13let match = defaultMatcher.matchesAny(...); 
     14if (!match) 
     15  return; 
     16 
     17if (match instanceof WhitelistFilter) 
     18{ 
     19  logRequest(...); 
     20  return; 
     21} 
     22 
     23let {blocking} = defaultMatcher.search(..., "blocking"); 
     24for (let filter of blocking) 
     25{ 
     26  responseHeaders.push(...); 
     27  logRequest(...); 
     28} 
     29 
     30return responseHeaders; 
     31}}} 
     32 
     33i.e. if the first hit is a blocking filter, only then do a full search to find all matching blocking filters. 
     34 
     35=== Hints for testers === 
     36This is not yet integrated into adblockpluschrome. Please see the dependency update issue for testing hints.