Fix regression in parsing scriptlet arguments

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2557
This commit is contained in:
Raymond Hill 2023-03-24 15:57:48 -04:00
parent 21ccaaf804
commit a42374199e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 2 deletions

View File

@ -2189,7 +2189,7 @@ export class AstFilterParser {
const parentEnd = this.nodes[parent+NODE_END_INDEX];
if ( parentEnd === parentBeg ) { return 0; }
const s = this.getNodeString(parent);
let next = 0, prev = 0;
let next = 0;
// json-based arg?
const match = this.rePatternScriptletJsonArgs.exec(s);
if ( match !== null ) {
@ -2207,7 +2207,9 @@ export class AstFilterParser {
return next;
}
// positional args
const head = this.allocHeadNode();
const argsEnd = s.length;
let prev = head;
let argBodyBeg = 0, argBodyEnd = 0, argEnd = 0;
let t = '';
while ( argBodyBeg < argsEnd ) {
@ -2232,7 +2234,7 @@ export class AstFilterParser {
prev = this.linkRight(prev, next);
}
}
return next;
return this.throwHeadNode(head);
}
indexOfNextScriptletArgSeparator(pattern, beg = 0) {