Changes between Initial Version and Version 1 of Ticket #6688


Ignore:
Timestamp:
05/22/2018 10:56:28 AM (19 months ago)
Author:
kzar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6688 – Description

    initial v1  
    22So far `Matcher` in lib/matcher.js provides `matchesAny` which given a URL and some other details for a request returns the first filter (if any) that matches. 
    33 
    4 It would be nice to add a `matchesAll` function as well, which returns all filters that match. For example that would allow us to find all `$csp` filters which apply to a document, injecting all the Content Security Policy headers, instead of just the header specified in the first filter that we find. 
     4It would be nice to add a `matchesAll` function as well, which returns all filters that match. For example that would allow us to find all `$csp` filters which apply to a document and inject all the given Content Security Policy headers. So far we just find the first `$csp` filter that matches and discard the others. 
    55 
    6 Unfortunately at the moment finding all filters that match would we use a be quite slow, and since this is a hotspot we have to be careful not to slow things down. Sebastian has suggested that using a binary search tree (BST) might help the performance and has provided some example code (attached). 
     6Unfortunately at the moment finding all filters that match would we use a be quite slow, and since this is a hotspot we have to be careful not to slow things down. Sebastian has suggested that using a binary search tree (BST) might help the performance and has [https://issues.adblockplus.org/attachment/ticket/6465/parser.js provided some example code]. 
    77 
    88=== What to change === 
     
    1010- Implement `matchesAll` as described above. 
    1111- Add unit tests. 
     12 
     13=== Notes === 
     14- See the discussion in #6465.