code review for c5d85881181a: mind whitelist status; mind an inaccessible document

This commit is contained in:
Raymond Hill 2018-05-22 09:26:49 -04:00
parent b6b1edb288
commit f887eeb3f5
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 9 deletions

View File

@ -69,15 +69,16 @@
return;
}
let injectScriptlets = function(d) {
let script = d.createElement('script');
let script;
try {
script = d.createElement('script');
script.appendChild(d.createTextNode(
decodeURIComponent(scriptlets))
);
(d.head || d.documentElement).appendChild(script);
} catch (ex) {
}
if ( script.parentNode ) {
if ( script && script.parentNode ) {
script.parentNode.removeChild(script);
}
};

View File

@ -494,8 +494,11 @@ vAPI.tabs.onNavigation = function(details) {
}
}
if ( µb.canInjectScriptletsNow ) {
let pageStore = µb.pageStoreFromTabId(details.tabId);
if ( pageStore !== null && pageStore.getNetFilteringSwitch() ) {
µb.scriptletFilteringEngine.injectNow(details);
}
}
};
/******************************************************************************/
@ -505,12 +508,8 @@ vAPI.tabs.onNavigation = function(details) {
// the extension icon won't be properly refreshed.
vAPI.tabs.onUpdated = function(tabId, changeInfo, tab) {
if ( !tab.url || tab.url === '' ) {
return;
}
if ( !changeInfo.url ) {
return;
}
if ( !tab.url || tab.url === '' ) { return; }
if ( !changeInfo.url ) { return; }
µb.tabContextManager.commit(tabId, changeInfo.url);
µb.bindTabToPageStats(tabId, 'tabUpdated');
};