1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-05 18:32:30 +01:00

minor code review: pass a string, not an array

This commit is contained in:
gorhill 2016-01-21 09:04:04 -05:00
parent 24436b5d40
commit cdfdb570bb
2 changed files with 5 additions and 8 deletions

View File

@ -133,12 +133,9 @@ var injectScripts = function(scripts) {
if ( !parent ) {
return;
}
var i = scripts.length, scriptTag;
while ( i-- ) {
scriptTag = document.createElement('script');
scriptTag.appendChild(document.createTextNode(scripts[i]));
parent.appendChild(scriptTag);
}
var scriptTag = document.createElement('script');
scriptTag.appendChild(document.createTextNode(scripts));
parent.appendChild(scriptTag);
};
/******************************************************************************/
@ -156,7 +153,7 @@ var filteringHandler = function(details) {
if ( details.netHide.length !== 0 ) {
netFilters(details);
}
if ( Array.isArray(details.scripts) ) {
if ( details.scripts ) {
injectScripts(details.scripts);
}
// The port will never be used again at this point, disconnecting allows

View File

@ -1131,7 +1131,7 @@ FilterContainer.prototype.retrieveScriptTags = function(domain, hostname) {
}
}
}
return out;
return out.join('\n');
};
/******************************************************************************/