From d9bb34102fd3103fc4da55260e96017010687e0e Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 17 May 2015 18:27:53 -0400 Subject: [PATCH] style --- platform/firefox/frameModule.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 6d2fe88ed..753ee010a 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -31,7 +31,7 @@ const {XPCOMUtils} = Cu.import('resource://gre/modules/XPCOMUtils.jsm', null); const hostName = Services.io.newURI(Components.stack.filename, null, null).host; -// Cu.import('resource://gre/modules/devtools/Console.jsm'); +//Cu.import('resource://gre/modules/devtools/Console.jsm'); /******************************************************************************/ @@ -316,19 +316,25 @@ const contentObserver = { const locationChangedMessageName = hostName + ':locationChanged'; const LocationChangeListener = function(docShell) { - if (docShell) { - docShell.QueryInterface(Ci.nsIInterfaceRequestor); + if ( !docShell ) { + return; + } - this.docShell = docShell.getInterface(Ci.nsIWebProgress); - this.messageManager = docShell.getInterface(Ci.nsIContentFrameMessageManager); + var requestor = docShell.QueryInterface(Ci.nsIInterfaceRequestor); + var ds = requestor.getInterface(Ci.nsIWebProgress); + var mm = requestor.getInterface(Ci.nsIContentFrameMessageManager); - if (this.messageManager && typeof this.messageManager.sendAsyncMessage === 'function') { - this.docShell.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_LOCATION); - } + if ( ds && mm && typeof mm.sendAsyncMessage === 'function' ) { + this.docShell = ds; + this.messageManager = mm; + ds.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_LOCATION); } }; -LocationChangeListener.prototype.QueryInterface = XPCOMUtils.generateQI(["nsIWebProgressListener", "nsISupportsWeakReference"]); +LocationChangeListener.prototype.QueryInterface = XPCOMUtils.generateQI([ + 'nsIWebProgressListener', + 'nsISupportsWeakReference' +]); LocationChangeListener.prototype.onLocationChange = function(webProgress, request, location, flags) { if ( !webProgress.isTopLevel ) {