From 48df0c5d2ae5e6ddc3477725495b912a28f2946f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Wed, 23 Mar 2011 12:31:35 +0100 Subject: [PATCH] Bug 463384 - "Tabbed mode" is an unnecessary complication. r=mano --- browser/base/content/browser.js | 16 ++-- browser/base/content/tabbrowser.xml | 112 ++++++++-------------------- 2 files changed, 38 insertions(+), 90 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 4940c10d908..e58f10e7109 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1396,6 +1396,7 @@ function prepareForStartup() { // initialize observers and listeners // and give C++ access to gBrowser + gBrowser.init(); XULBrowserWindow.init(); window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(nsIWebNavigation) @@ -4256,14 +4257,10 @@ var XULBrowserWindow = { } } else if (aStateFlags & nsIWebProgressListener.STATE_STOP) { - if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { - if (aWebProgress.DOMWindow == content) { - if (aRequest) - this.endDocumentLoad(aRequest, aStatus); - if (!gBrowser.mTabbedMode && !gBrowser.getIcon()) - gBrowser.useDefaultIcon(gBrowser.selectedTab); - } - } + if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK && + aWebProgress.DOMWindow == content && + aRequest) + this.endDocumentLoad(aRequest, aStatus); // This (thanks to the filter) is a network stop or the last // request stop outside of loading the document, stop throbbers @@ -4399,9 +4396,6 @@ var XULBrowserWindow = { this.reloadCommand.removeAttribute("disabled"); } - if (!gBrowser.mTabbedMode && aWebProgress.isLoadingDocument) - gBrowser.setIcon(gBrowser.selectedTab, null); - if (gURLBar) { // Strip off "wyciwyg://" and passwords for the location bar let uri = aLocationURI; diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 6b804760aa1..db0a05f5e40 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -134,13 +134,10 @@ [] - new Array() + [] - new Array() - - - false + [] false @@ -1064,47 +1061,6 @@ - - - 0) { - // Use the filter hooked up in our addProgressListener - filter = this.mTabFilters[0]; - } else { - // create a filter and hook it up to our first browser - filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"] - .createInstance(Components.interfaces.nsIWebProgress); - this.mTabFilters[0] = filter; - this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL); - } - - // Remove all our progress listeners from the active browser's filter. - this.mProgressListeners.forEach(filter.removeProgressListener, filter); - - // Wire up a progress listener to our filter. - const listener = this.mTabProgressListener(this.mCurrentTab, - this.mCurrentBrowser, - false); - filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); - this.mTabListeners[0] = listener; - ]]> - - - @@ -1228,8 +1184,6 @@ this._browsers = null; // invalidate cache - this.enterTabbedMode(); - // if we're adding tabs, we're past interrupt mode, ditch the owner if (this.mCurrentTab.owner) this.mCurrentTab.owner = null; @@ -1874,30 +1828,7 @@ this.tabContainer.updateVisibility(); } - if (this.mProgressListeners.length == 1) { - // If we are adding a 2nd progress listener, we need to enter tabbed mode - // because the browser status filter can only handle one progress listener. - // In tabbed mode, mTabProgressListener is used which will iterate over all listeners. - this.enterTabbedMode(); - } - this.mProgressListeners.push(aListener); - - if (!this.mTabbedMode) { - // If someone does this: - // addProgressListener, removeProgressListener, addProgressListener - // don't create a new filter; reuse the existing filter. - if (this.mTabFilters.length == 0) { - // hook a filter up to our first browser - const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"] - .createInstance(Components.interfaces.nsIWebProgress); - this.mTabFilters[0] = filter; - this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL); - } - - // Directly hook the listener up to the filter for better performance - this.mTabFilters[0].addProgressListener(aListener, aMask); - } ]]> @@ -1908,10 +1839,6 @@ @@ -1919,7 +1846,6 @@ - this.enterTabbedMode(); this.mTabsProgressListeners.push(aListener); @@ -2489,9 +2415,33 @@ this.mCurrentBrowser.setAttribute("autoscrollpopup", this._autoScrollPopup.id); this.mCurrentBrowser.droppedLinkHandler = handleDroppedLink; this.updateWindowResizers(); + + // Hook up the event listeners to the first browser + var tabListener = this.mTabProgressListener(this.mCurrentTab, this.mCurrentBrowser, true); + const nsIWebProgress = Components.interfaces.nsIWebProgress; + const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"] + .createInstance(nsIWebProgress); + filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL); + this.mTabListeners[0] = tabListener; + this.mTabFilters[0] = filter; + this.init(); ]]> + + + + + + + Application.console.log("enterTabbedMode is an obsolete method and " + + "will be removed in a future release."); + + + true @@ -2767,9 +2724,6 @@ this._container.collapsed = !val; - if (val) - this.tabbrowser.enterTabbedMode(); - document.getElementById("menu_closeWindow").hidden = !val; document.getElementById("menu_close").setAttribute("label", this.tabbrowser.mStringBundle.getString(val ? "tabs.closeTab" : "tabs.close"));