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