Skip to content

Commit 347f9f7

Browse files
committed
Improve parsing/interpretation of consecutive $$ in network filters
1 parent 3eb0ab9 commit 347f9f7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/js/static-filtering-parser.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,18 +1520,20 @@ export class AstFilterParser {
15201520

15211521
indexOfNetAnchor(s) {
15221522
const end = s.length;
1523-
if ( end === 0 ) { return end; }
1523+
if ( end === 0 ) { return 0; }
15241524
let j = s.lastIndexOf('$');
15251525
if ( j === -1 ) { return end; }
1526-
if ( (j+1) === end ) { return end; }
1526+
let htmlFilteringRule = false;
15271527
for (;;) {
1528-
const before = s.charAt(j-1);
1529-
if ( before === '$' ) { return -1; }
1528+
if ( s.charCodeAt(j-1) === 0x24 /* $ */ ) {
1529+
htmlFilteringRule = true;
1530+
}
15301531
if ( this.reNetOptionTokens.test(s.slice(j+1)) ) { return j; }
15311532
if ( j === 0 ) { break; }
15321533
j = s.lastIndexOf('$', j-1);
15331534
if ( j === -1 ) { break; }
15341535
}
1536+
if ( htmlFilteringRule ) { return -1; }
15351537
return end;
15361538
}
15371539

0 commit comments

Comments
 (0)