From 02f757e99514efcf0f22abdd80492f9393bf1dcf Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 17 Nov 2016 09:25:37 -0500 Subject: [PATCH] scriptlet arguments: allow any character, escape properly --- src/js/cosmetic-filtering.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index d6a238f08..8252d98bb 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -1433,8 +1433,7 @@ FilterContainer.prototype._fillupUserScript = function(content, args) { while ( args !== '' ) { pos = args.indexOf(','); if ( pos === -1 ) { pos = args.length; } - arg = args.slice(0, pos).trim(); - if ( this._reUserScriptBadArg.test(arg) ) { return; } + arg = args.slice(0, pos).trim().replace(this._reEscapeScriptArg, '\\$&'); content = content.replace('{{' + i + '}}', arg); args = args.slice(pos + 1).trim(); i++; @@ -1442,7 +1441,7 @@ FilterContainer.prototype._fillupUserScript = function(content, args) { return content; }; -FilterContainer.prototype._reUserScriptBadArg = /[^\w\.]/; +FilterContainer.prototype._reEscapeScriptArg = /[\\'"]/g; /******************************************************************************/