mirror of https://github.com/gorhill/uBlock.git
this fixes #876
This commit is contained in:
parent
7483e7b306
commit
99c4dfffc2
|
@ -258,12 +258,12 @@ var contentObserver = {
|
|||
|
||||
sandbox.injectScript = function(script) {
|
||||
var svc = Services;
|
||||
if ( svc !== undefined ) {
|
||||
svc.scriptloader.loadSubScript(script, sandbox);
|
||||
} else {
|
||||
// Sandbox appears void.
|
||||
// I've seen this happens, need to investigate why.
|
||||
// Sandbox appears void.
|
||||
// I've seen this happens, need to investigate why.
|
||||
if ( svc === undefined ) {
|
||||
return;
|
||||
}
|
||||
svc.scriptloader.loadSubScript(script, sandbox);
|
||||
};
|
||||
|
||||
// The goal is to have content scripts removed from web pages. This
|
||||
|
|
|
@ -116,10 +116,20 @@ vAPI.messaging = {
|
|||
return;
|
||||
}
|
||||
var details = msg.details;
|
||||
if ( !details.allFrames && window !== window.top ) {
|
||||
if ( details.allFrames !== true && window !== window.top ) {
|
||||
return;
|
||||
}
|
||||
self.injectScript(details.file);
|
||||
// https://github.com/gorhill/uBlock/issues/876
|
||||
// Enforce `details.runAt`. Default to `document_end`.
|
||||
if ( details.runAt === 'document_start' || document.readyState !== 'loading' ) {
|
||||
self.injectScript(details.file);
|
||||
return;
|
||||
}
|
||||
var injectScriptDelayed = function() {
|
||||
document.removeEventListener('DOMContentLoaded', injectScriptDelayed);
|
||||
self.injectScript(details.file);
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', injectScriptDelayed);
|
||||
return;
|
||||
}
|
||||
if ( msg.cmd === 'shutdownSandbox' ) {
|
||||
|
|
Loading…
Reference in New Issue