uBlock/src/lib
Raymond Hill 426395aa03
Improve extraction of tokens from regex-based filters
Regex-based static network filters are those most likely to
cause performance degradation, and as such the best guard
against undue performance degradation caused by regex-based
filters is the ability to extract valid and good tokens
from regex patterns.

This commit introduces a complete regex parser so that the
static network filtering engine can now safely extract
tokens regardless of the complexity of the regex pattern.

The regex parser is a library imported from:
https://github.com/foo123/RegexAnalyzer

The syntax highlighter adds an underline to regex-based
filters as a visual aid to filter authors so as to avoid
mistakenly creating regex-based filters. This commit
further colors the underline as a warning when a regex-based
filter is found to be untokenizable.

Filter list authors are invited to spot these untokenizable
regex-based filters in their lists to verify that no
mistake were made for those filters, causing them to be
untokenizabke. For example, what appears to be a mistake:

    /^https?:\/\/.*\/sw.js?.[a-zA-Z0-9%]{50,}/

Though the mistake is minor, the regex-based filter above
is untokenizable as a result, and become tokenizable when
the `.` is properly escaped:

    /^https?:\/\/.*\/sw\.js?.[a-zA-Z0-9%]{50,}/

Filter list authors can use this search expression in the
asset viewer to find instances of regex-based filters:

    /^(@@)?\/[^\n]+\/(\$|$)/
2020-12-26 08:52:42 -05:00
..
codemirror Upgrade CodeMirror library to 5.59.0 (from 5.46.0) 2020-12-22 09:06:26 -05:00
diff Avoid returning a value when injected as content script 2020-07-20 17:28:33 -04:00
lz4 Fix Promise chain of WASM module load operations 2019-02-01 08:20:43 -05:00
publicsuffixlist Fix page count computation in publicSuffixList.enableWASM() 2019-04-25 19:40:07 -04:00
regexanalyzer Improve extraction of tokens from regex-based filters 2020-12-26 08:52:42 -05:00
punycode.js Update punycode.js 2015-04-16 10:34:03 +02:00