mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
code review for c5d8588118
: mind whitelist status; mind an inaccessible document
This commit is contained in:
parent
b6b1edb288
commit
f887eeb3f5
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -494,7 +494,10 @@ vAPI.tabs.onNavigation = function(details) {
|
||||
}
|
||||
}
|
||||
if ( µb.canInjectScriptletsNow ) {
|
||||
µb.scriptletFilteringEngine.injectNow(details);
|
||||
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');
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user