1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 17:49:39 +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) { sandbox.injectScript = function(script) {
if ( Services !== undefined ) {
Services.scriptloader.loadSubScript(script, sandbox); Services.scriptloader.loadSubScript(script, sandbox);
} else {
// Sandbox appears void.
// I've seen this happens, need to investigate why.
}
}; };
} }
else { else {
@ -358,7 +364,6 @@ LocationChangeListener.prototype.onLocationChange = function(webProgress, reques
if ( !webProgress.isTopLevel ) { if ( !webProgress.isTopLevel ) {
return; return;
} }
this.messageManager.sendAsyncMessage(locationChangedMessageName, { this.messageManager.sendAsyncMessage(locationChangedMessageName, {
url: location.asciiSpec, url: location.asciiSpec,
flags: flags, flags: flags,

View File

@ -56,7 +56,16 @@ let onLoadCompleted = function() {
addMessageListener('ublock-load-completed', onLoadCompleted); addMessageListener('ublock-load-completed', onLoadCompleted);
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); locationChangeListener = new LocationChangeListener(docShell);
}
}
/******************************************************************************/ /******************************************************************************/