# HG changeset patch # User Frank-Rainer Grahl # Date 1640454176 -3600 # Parent 0986ac19ee643835c434f491197773f5fe3a448e Bug 1716221 - Remove unneded Ci definitions in tabbrowser. r=IanN a=IanN Also do some minor variable definition cleanups diff --git a/suite/browser/tabbrowser.xml b/suite/browser/tabbrowser.xml --- a/suite/browser/tabbrowser.xml +++ b/suite/browser/tabbrowser.xml @@ -524,42 +524,41 @@ }, onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) { if (!aRequest) return; var oldBlank = this.mBlank; - const nsIWebProgressListener = Ci.nsIWebProgressListener; - const nsIChannel = Ci.nsIChannel; - let location, originalLocation; + let location; + let originalLocation; try { - aRequest.QueryInterface(nsIChannel) + aRequest.QueryInterface(Ci.nsIChannel) location = aRequest.URI; originalLocation = aRequest.originalURI; } catch (ex) {} - if (aStateFlags & nsIWebProgressListener.STATE_START) { + if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) { this.mRequestCount++; } - else if (aStateFlags & nsIWebProgressListener.STATE_STOP) { + else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) { const NS_ERROR_UNKNOWN_HOST = 2152398878; if (--this.mRequestCount > 0 && aStatus == NS_ERROR_UNKNOWN_HOST) { // to prevent bug 235825: wait for the request handled // by the automatic keyword resolver return; } // since we (try to) only handle STATE_STOP of the last request, // the count of open requests should now be 0 this.mRequestCount = 0; } - if (aStateFlags & nsIWebProgressListener.STATE_START && - aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { + if (aStateFlags & Ci.nsIWebProgressListener.STATE_START && + aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) { if (aWebProgress.isTopLevel) { // Need to use originalLocation rather than location because things // like about:privatebrowsing arrive with nsIRequest pointing to // their resolved jar: or file: URIs. if (!(originalLocation && gInitialPages.has(originalLocation.spec) && originalLocation != "about:blank" && this.mBrowser.currentURI && this.mBrowser.currentURI.spec == "about:blank")) { // This will trigger clearing the location bar. Don't do it if @@ -570,34 +569,34 @@ // loads are "special". this.mBrowser.urlbarChangeTracker.startedLoad(); } // If the browser is loading it must not be crashed anymore. this.mTab.removeAttribute("crashed"); } if (this._shouldShowProgress(aRequest)) { - if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING) && + if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) && aWebProgress && aWebProgress.isTopLevel) { this.mTab.setAttribute("busy", "true"); // Do the following only for the top frame not any subframes. // Remove favicon. This shows busy and progress indicators even during a reload. this.mTab.removeAttribute("image"); if (!(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD)) this.mTabBrowser.setTabTitleLoading(this.mTab); } if (this.mTab.selected) this.mTabBrowser.mIsBusy = true; } } - else if (aStateFlags & nsIWebProgressListener.STATE_STOP && - aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { + else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && + aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) { if (this.mTab.hasAttribute("busy")) { this.mTab.removeAttribute("busy"); this.mTabBrowser._tabAttrModified(this.mTab, ["busy"]); if (!this.mTab.selected) this.mTab.setAttribute("unread", "true"); } this.mTab.removeAttribute("progress"); @@ -620,17 +619,17 @@ if (!this.mBrowser.mIconURL) this.mTabBrowser.useDefaultIcon(this.mTab); } if (this.mBlank) this.mBlank = false; // For keyword URIs clear the user typed value since they will be changed into real URIs. - if (location.scheme == "keyword") + if (location && location.scheme == "keyword") this.mBrowser.userTypedValue = null; if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading")) this.mTabBrowser.setTabTitle(this.mTab); if (this.mTab.selected) this.mTabBrowser.mIsBusy = false; } @@ -644,18 +643,18 @@ [aWebProgress, aRequest, aStateFlags, aStatus], true, false); } this._callProgressListeners("onStateChange", [aWebProgress, aRequest, aStateFlags, aStatus], false); - if (aStateFlags & (nsIWebProgressListener.STATE_START | - nsIWebProgressListener.STATE_STOP)) { + if (aStateFlags & (Ci.nsIWebProgressListener.STATE_START | + Ci.nsIWebProgressListener.STATE_STOP)) { // reset cached temporary values at beginning and end this.mMessage = ""; this.mTotalProgress = 0; } this.mStateFlags = aStateFlags; this.mStatus = aStatus; }, @@ -776,19 +775,18 @@ onProgressChange : function (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) { }, onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) { - const nsIWebProgressListener = Ci.nsIWebProgressListener; - if ((aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) && - (aStateFlags & nsIWebProgressListener.STATE_STOP)) { + if ((aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) && + (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)) { function refresh(closure) { closure.mBrowser.webNavigation.sessionHistory = closure.mSH; closure.mBrowser.webProgress.removeProgressListener(closure); delete closure.mBrowser._SHListener; closure.mSH.QueryInterface(Ci.nsIWebNavigation) .gotoIndex(closure.mSH.index); } setTimeout(refresh, 0, this); @@ -1166,29 +1164,28 @@ var tabListener = this.mTabListeners[this.tabContainer.selectedIndex]; if (!oldBrowser || (!oldBrowser.blockedPopups != !newBrowser.blockedPopups)) this.mCurrentBrowser.updateBlockedPopups(); // Update the URL bar. - const nsIWebProgressListener = Ci.nsIWebProgressListener; this.updateUrlBar(newBrowser.webProgress, null, newBrowser.currentURI, 0, newBrowser.securityUI, newBrowser, tabListener.mFeeds); // Send the state, status and progress to all progress listeners. var flags = tabListener.mStateFlags & - (nsIWebProgressListener.STATE_START | - nsIWebProgressListener.STATE_STOP); + (Ci.nsIWebProgressListener.STATE_START | + Ci.nsIWebProgressListener.STATE_STOP); this._callProgressListeners(null, "onStateChange", [this.mCurrentBrowser.webProgress, tabListener.mRequest, flags, tabListener.mStatus], true, false); this._callProgressListeners(null, "onStatusChange", @@ -1334,29 +1331,28 @@ urlSecurityCheck(uri,targetDoc.nodePrincipal, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); } catch(e) { return null; } } // Security says okay, now ask content policy - const nsIContentPolicy = Ci.nsIContentPolicy; try { var contentPolicy = Cc['@mozilla.org/layout/content-policy;1'] - .getService(nsIContentPolicy); + .getService(Ci.nsIContentPolicy); } catch (e) { return null; // Refuse to load if we can't do a security check. } - if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_INTERNAL_IMAGE, + if (contentPolicy.shouldLoad(Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE, uri, targetDoc.documentURIObject, aLink, aLink.type, - null) != nsIContentPolicy.ACCEPT) { + null) != Ci.nsIContentPolicy.ACCEPT) { return null; } return uri; ]]> @@ -1925,26 +1921,27 @@ // navigate back to the proper page from the light page b.stop(); b.webNavigation.gotoIndex(0); // reattach the old history b.webNavigation.sessionHistory = hist; // add back the filters, security first (bug 313335) - const nsIWebProgress = Ci.nsIWebProgress; - var secFlags = nsIWebProgress.NOTIFY_STATE_ALL | nsIWebProgress.NOTIFY_LOCATION | nsIWebProgress.NOTIFY_SECURITY; + var secFlags = Ci.nsIWebProgress.NOTIFY_STATE_ALL | + Ci.nsIWebProgress.NOTIFY_LOCATION | + Ci.nsIWebProgress.NOTIFY_SECURITY; b.webProgress.addProgressListener(b.securityUI, secFlags); var position = this.tabs.length - 1; var tabListener = this.mTabProgressListener(t, b, false); const filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"] - .createInstance(nsIWebProgress); - filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL); - b.webProgress.addProgressListener(filter, nsIWebProgress.NOTIFY_ALL); + .createInstance(Ci.nsIWebProgress); + filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL); + b.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL); this.mTabListeners[position] = tabListener; this.mTabFilters[position] = filter; t.dispatchEvent(new Event("TabOpen", { bubbles: true, cancelable: false })); if (savedData.pos < position) this.moveTabTo(t, savedData.pos); @@ -3109,25 +3106,24 @@ // Ensure the browser's session history and security UI are wired up // note that toolkit browser automatically inits its security UI // when you get it but for xpfe you need to init it explicitly if (!this.mCurrentBrowser.securityUI) this.mCurrentBrowser.init(); // Wire up the tab's progress listener and filter. - const nsIWebProgress = Ci.nsIWebProgress; var tabListener = this.mTabProgressListener(this.mCurrentTab, this.mCurrentBrowser, false); var filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"] - .createInstance(nsIWebProgress); - filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL); + .createInstance(Ci.nsIWebProgress); + filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL); this.webProgress.addProgressListener(filter, - nsIWebProgress.NOTIFY_ALL); + Ci.nsIWebProgress.NOTIFY_ALL); this.mTabListeners[0] = tabListener; this.mTabFilters[0] = filter; if (!Services.prefs.getBoolPref("browser.tabs.autoHide") && !Services.prefs.getBoolPref("browser.tabs.forceHide") && window.toolbar.visible) this.mStrip.collapsed = false;