mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
code review
This commit is contained in:
parent
c285ace7d8
commit
c73704ba48
2 changed files with 17 additions and 3 deletions
|
@ -218,7 +218,13 @@ const contentObserver = {
|
|||
});
|
||||
|
||||
sandbox.injectScript = function(script) {
|
||||
Services.scriptloader.loadSubScript(script, sandbox);
|
||||
if ( Services !== undefined ) {
|
||||
Services.scriptloader.loadSubScript(script, sandbox);
|
||||
} else {
|
||||
// Sandbox appears void.
|
||||
// I've seen this happens, need to investigate why.
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
|
@ -358,7 +364,6 @@ LocationChangeListener.prototype.onLocationChange = function(webProgress, reques
|
|||
if ( !webProgress.isTopLevel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.messageManager.sendAsyncMessage(locationChangedMessageName, {
|
||||
url: location.asciiSpec,
|
||||
flags: flags,
|
||||
|
|
|
@ -56,7 +56,16 @@ let onLoadCompleted = function() {
|
|||
|
||||
addMessageListener('ublock-load-completed', onLoadCompleted);
|
||||
|
||||
locationChangeListener = new LocationChangeListener(docShell);
|
||||
if ( docShell ) {
|
||||
let Ci = Components.interfaces;
|
||||
let wp = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
let dw = wp.DOMWindow;
|
||||
|
||||
if ( dw === dw.top ) {
|
||||
locationChangeListener = new LocationChangeListener(docShell);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue