mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-14 23:12:28 +02:00
parent
027c7a4fb5
commit
05ae51beb2
@ -605,7 +605,8 @@ class argListParser {
|
|||||||
this.argBeg = 0;
|
this.argBeg = 0;
|
||||||
this.argEnd = 0;
|
this.argEnd = 0;
|
||||||
this.quoteEnd = 0;
|
this.quoteEnd = 0;
|
||||||
this.actualSeparatorCode = 0;
|
this.actualSeparatorCode = 0x2C /* , */;
|
||||||
|
this.actualSeparatorChar = ',';
|
||||||
this.separatorBeg = 0;
|
this.separatorBeg = 0;
|
||||||
this.separatorEnd = 0;
|
this.separatorEnd = 0;
|
||||||
this.transform = false;
|
this.transform = false;
|
||||||
@ -624,10 +625,7 @@ class argListParser {
|
|||||||
this.failed = false;
|
this.failed = false;
|
||||||
const qc = pattern.charCodeAt(this.quoteBeg);
|
const qc = pattern.charCodeAt(this.quoteBeg);
|
||||||
if ( qc === 0x22 /* " */ || qc === 0x27 /* ' */ || qc === 0x60 /* ` */ ) {
|
if ( qc === 0x22 /* " */ || qc === 0x27 /* ' */ || qc === 0x60 /* ` */ ) {
|
||||||
this.actualSeparatorCode = qc;
|
this.indexOfNextArgSeparator(pattern, qc);
|
||||||
this.argBeg = this.argEnd = this.quoteBeg + 1;
|
|
||||||
this.transform = false;
|
|
||||||
this.indexOfNextScriptletArgSeparator(pattern);
|
|
||||||
if ( this.argEnd !== len ) {
|
if ( this.argEnd !== len ) {
|
||||||
this.quoteEnd = this.argEnd + 1;
|
this.quoteEnd = this.argEnd + 1;
|
||||||
this.separatorBeg = this.separatorEnd = this.quoteEnd;
|
this.separatorBeg = this.separatorEnd = this.quoteEnd;
|
||||||
@ -639,10 +637,7 @@ class argListParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.actualSeparatorCode = this.separatorCode;
|
this.indexOfNextArgSeparator(pattern, this.separatorCode);
|
||||||
this.argBeg = this.argEnd = this.quoteBeg;
|
|
||||||
this.transform = false;
|
|
||||||
this.indexOfNextScriptletArgSeparator(pattern);
|
|
||||||
this.separatorBeg = this.separatorEnd = this.argEnd;
|
this.separatorBeg = this.separatorEnd = this.argEnd;
|
||||||
if ( this.separatorBeg < len ) {
|
if ( this.separatorBeg < len ) {
|
||||||
this.separatorEnd += 1;
|
this.separatorEnd += 1;
|
||||||
@ -664,7 +659,7 @@ class argListParser {
|
|||||||
return s.replace(this.reUnescapeSingleQuotes, "$1'");
|
return s.replace(this.reUnescapeSingleQuotes, "$1'");
|
||||||
case 0x60 /* ` */:
|
case 0x60 /* ` */:
|
||||||
if ( s.includes('`') === false ) { return; }
|
if ( s.includes('`') === false ) { return; }
|
||||||
return s.replace(this.reUnescapeBackticks, "$1`");
|
return s.replace(this.reUnescapeBackticks, '$1`');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -679,10 +674,17 @@ class argListParser {
|
|||||||
const match = this.reWhitespaceEnd.exec(s);
|
const match = this.reWhitespaceEnd.exec(s);
|
||||||
return match === null ? 0 : match[0].length;
|
return match === null ? 0 : match[0].length;
|
||||||
}
|
}
|
||||||
indexOfNextScriptletArgSeparator(pattern) {
|
indexOfNextArgSeparator(pattern, separatorCode) {
|
||||||
const separatorChar = String.fromCharCode(this.actualSeparatorCode);
|
this.argBeg = this.argEnd = separatorCode !== this.separatorCode
|
||||||
|
? this.quoteBeg + 1
|
||||||
|
: this.quoteBeg;
|
||||||
|
this.transform = false;
|
||||||
|
if ( separatorCode !== this.actualSeparatorCode ) {
|
||||||
|
this.actualSeparatorCode = separatorCode;
|
||||||
|
this.actualSeparatorChar = String.fromCharCode(separatorCode);
|
||||||
|
}
|
||||||
while ( this.argEnd < pattern.length ) {
|
while ( this.argEnd < pattern.length ) {
|
||||||
const pos = pattern.indexOf(separatorChar, this.argEnd);
|
const pos = pattern.indexOf(this.actualSeparatorChar, this.argEnd);
|
||||||
if ( pos === -1 ) {
|
if ( pos === -1 ) {
|
||||||
return (this.argEnd = pattern.length);
|
return (this.argEnd = pattern.length);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user