1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

code review

This commit is contained in:
gorhill 2015-05-28 14:49:36 -04:00
parent c285ace7d8
commit c73704ba48
2 changed files with 17 additions and 3 deletions

View File

@ -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,

View File

@ -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);
}
}
/******************************************************************************/