Changes between Version 4 and Version 6 of Ticket #6861


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

My bad! It's obviously not a problem for filters because the escaping and unescaping is symmetrical (I got confused by my local changes). Nevertheless we don't have to escape every opening bracket, only the ones that occur at the beginning of a line. This would likely speed up the loading of the initial subscriptions in INIParser.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6861

    • Property Priority changed from P2 to P4
    • Property Keywords circumvention removed
    • Property Blocking changed from 6538 to
  • Ticket #6861 – Description

    v4 v6  
    11=== Background === 
    22Currently the `serializeFilters` function in `lib/subscriptionClasses.js` escapes any occurrence of an opening bracket in a filter (e.g. `##a[href^="http://ads."]`) with a backslash (`\`). At the time of parsing `patterns.ini`, the `INIParser` class unescapes the opening bracket before parsing the filter. 
    3  
    4 This escaping is not well thought out and would not work for snippet filters (#6538), nor for many other types of filters. There is no way to specify a literal `\[`sequence in a filter without messing it up, because when it is reloaded from disk it is read as `[` instead of `\[`. 
    53 
    64Escaping of an opening bracket is relevant only when it occurs at the beginning of a line optionally preceded only by whitespace; therefore, this escaping is mostly unnecessary.