mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 17:41:03 +01:00
code review re #2132
This commit is contained in:
parent
368e00ef7a
commit
6f512f39fb
1 changed files with 8 additions and 2 deletions
|
@ -1419,11 +1419,14 @@ FilterContainer.prototype._lookupUserScript = function(dict, raw, reng, out) {
|
||||||
var content = reng.resourceContentFromName(token, 'application/javascript');
|
var content = reng.resourceContentFromName(token, 'application/javascript');
|
||||||
if ( !content ) { return; }
|
if ( !content ) { return; }
|
||||||
if ( args ) {
|
if ( args ) {
|
||||||
var i = 1;
|
var i = 1, arg;
|
||||||
while ( args !== '' ) {
|
while ( args !== '' ) {
|
||||||
pos = args.indexOf(',');
|
pos = args.indexOf(',');
|
||||||
if ( pos === -1 ) { pos = args.length; }
|
if ( pos === -1 ) { pos = args.length; }
|
||||||
content = content.replace('{{' + i + '}}', args.slice(0, pos).trim());
|
arg = args.slice(0, pos).trim();
|
||||||
|
if ( reArgValidator.test(arg) ) {
|
||||||
|
content = content.replace('{{' + i + '}}', arg);
|
||||||
|
}
|
||||||
args = args.slice(pos + 1).trim();
|
args = args.slice(pos + 1).trim();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -1432,6 +1435,9 @@ FilterContainer.prototype._lookupUserScript = function(dict, raw, reng, out) {
|
||||||
out.push(content);
|
out.push(content);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only accept plain word characters for now.
|
||||||
|
var reArgValidator = /^\w*$/;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
FilterContainer.prototype.toSelfie = function() {
|
FilterContainer.prototype.toSelfie = function() {
|
||||||
|
|
Loading…
Reference in a new issue