mirror of https://github.com/gorhill/uBlock.git
code review for c5d85881181a: mind whitelist status; mind an inaccessible document
This commit is contained in:
parent
b6b1edb288
commit
f887eeb3f5
|
@ -69,15 +69,16 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let injectScriptlets = function(d) {
|
let injectScriptlets = function(d) {
|
||||||
let script = d.createElement('script');
|
let script;
|
||||||
try {
|
try {
|
||||||
|
script = d.createElement('script');
|
||||||
script.appendChild(d.createTextNode(
|
script.appendChild(d.createTextNode(
|
||||||
decodeURIComponent(scriptlets))
|
decodeURIComponent(scriptlets))
|
||||||
);
|
);
|
||||||
(d.head || d.documentElement).appendChild(script);
|
(d.head || d.documentElement).appendChild(script);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
if ( script.parentNode ) {
|
if ( script && script.parentNode ) {
|
||||||
script.parentNode.removeChild(script);
|
script.parentNode.removeChild(script);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -494,7 +494,10 @@ vAPI.tabs.onNavigation = function(details) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( µb.canInjectScriptletsNow ) {
|
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.
|
// the extension icon won't be properly refreshed.
|
||||||
|
|
||||||
vAPI.tabs.onUpdated = function(tabId, changeInfo, tab) {
|
vAPI.tabs.onUpdated = function(tabId, changeInfo, tab) {
|
||||||
if ( !tab.url || tab.url === '' ) {
|
if ( !tab.url || tab.url === '' ) { return; }
|
||||||
return;
|
if ( !changeInfo.url ) { return; }
|
||||||
}
|
|
||||||
if ( !changeInfo.url ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
µb.tabContextManager.commit(tabId, changeInfo.url);
|
µb.tabContextManager.commit(tabId, changeInfo.url);
|
||||||
µb.bindTabToPageStats(tabId, 'tabUpdated');
|
µb.bindTabToPageStats(tabId, 'tabUpdated');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue