mirror of https://github.com/gorhill/uBlock.git
Fix broken token extraction
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1367
Regression from:
- 6ac09a2856
Need to mind wildcards adjacent to extracted token.
This commit is contained in:
parent
da01ea4671
commit
dac8d6becb
|
@ -3152,14 +3152,23 @@ const FilterParser = class {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const match = this.reToken.exec(pattern);
|
const match = this.reToken.exec(pattern);
|
||||||
if ( match === null ) { break; }
|
if ( match === null ) { break; }
|
||||||
const badness = match[0].length > 1
|
const token = match[0];
|
||||||
? this.badTokens.get(match[0]) || 0
|
const badness = token.length > 1 ? this.badTokens.get(token) || 0 : 1;
|
||||||
: 1;
|
if ( badness >= bestBadness ) { continue; }
|
||||||
if ( badness < bestBadness ) {
|
if ( match.index > 0 ) {
|
||||||
bestMatch = match;
|
const c = pattern.charCodeAt(match.index - 1);
|
||||||
if ( badness === 0 ) { break; }
|
if ( c === 0x2A /* '*' */ ) { continue; }
|
||||||
bestBadness = badness;
|
|
||||||
}
|
}
|
||||||
|
if ( token.length < this.maxTokenLen ) {
|
||||||
|
const lastIndex = this.reToken.lastIndex;
|
||||||
|
if ( lastIndex < pattern.length ) {
|
||||||
|
const c = pattern.charCodeAt(lastIndex);
|
||||||
|
if ( c === 0x2A /* '*' */ ) { continue; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bestMatch = match;
|
||||||
|
if ( badness === 0 ) { break; }
|
||||||
|
bestBadness = badness;
|
||||||
}
|
}
|
||||||
if ( bestMatch !== null ) {
|
if ( bestMatch !== null ) {
|
||||||
this.token = bestMatch[0];
|
this.token = bestMatch[0];
|
||||||
|
|
Loading…
Reference in New Issue