mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Fix regression in parameters-passing in scriptlets
This commit is contained in:
parent
8e010f9c87
commit
c350e23b2d
@ -41,6 +41,7 @@ const VERSION = 1;
|
||||
|
||||
const duplicates = new Set();
|
||||
const scriptletCache = new µb.MRUCache(32);
|
||||
const reEscapeScriptArg = /[\\'"]/g;
|
||||
|
||||
const scriptletDB = new StaticExtFilteringHostnameDB(1, VERSION);
|
||||
|
||||
@ -217,7 +218,9 @@ const patchScriptlet = function(content, arglist) {
|
||||
content = content.replace(`{{${i+1}}}`, arglist[i]);
|
||||
}
|
||||
return content.replace('{{args}}',
|
||||
arglist.map(a => `'${a}'`).join(', ').replace(/\$/g, '$$$')
|
||||
arglist.map(a => `'${a.replace(reEscapeScriptArg, '\\$&')}'`)
|
||||
.join(', ')
|
||||
.replace(/\$/g, '$$$')
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user