mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 09:39:38 +02:00
scriptlet arguments: allow any character, escape properly
This commit is contained in:
parent
874289b9a2
commit
02f757e995
@ -1433,8 +1433,7 @@ FilterContainer.prototype._fillupUserScript = function(content, args) {
|
|||||||
while ( args !== '' ) {
|
while ( args !== '' ) {
|
||||||
pos = args.indexOf(',');
|
pos = args.indexOf(',');
|
||||||
if ( pos === -1 ) { pos = args.length; }
|
if ( pos === -1 ) { pos = args.length; }
|
||||||
arg = args.slice(0, pos).trim();
|
arg = args.slice(0, pos).trim().replace(this._reEscapeScriptArg, '\\$&');
|
||||||
if ( this._reUserScriptBadArg.test(arg) ) { return; }
|
|
||||||
content = content.replace('{{' + i + '}}', arg);
|
content = content.replace('{{' + i + '}}', arg);
|
||||||
args = args.slice(pos + 1).trim();
|
args = args.slice(pos + 1).trim();
|
||||||
i++;
|
i++;
|
||||||
@ -1442,7 +1441,7 @@ FilterContainer.prototype._fillupUserScript = function(content, args) {
|
|||||||
return content;
|
return content;
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterContainer.prototype._reUserScriptBadArg = /[^\w\.]/;
|
FilterContainer.prototype._reEscapeScriptArg = /[\\'"]/g;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user