зеркало из https://github.com/mozilla/pjs.git
Bug 463384 - "Tabbed mode" is an unnecessary complication. r=mano
This commit is contained in:
Родитель
fa72d3b1b1
Коммит
48df0c5d2a
|
@ -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;
|
||||
|
|
|
@ -134,13 +134,10 @@
|
|||
[]
|
||||
</field>
|
||||
<field name="mTabListeners">
|
||||
new Array()
|
||||
[]
|
||||
</field>
|
||||
<field name="mTabFilters">
|
||||
new Array()
|
||||
</field>
|
||||
<field name="mTabbedMode">
|
||||
false
|
||||
[]
|
||||
</field>
|
||||
<field name="mIsBusy">
|
||||
false
|
||||
|
@ -1064,47 +1061,6 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="enterTabbedMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mTabbedMode)
|
||||
return;
|
||||
|
||||
this.mTabbedMode = true; // Welcome to multi-tabbed mode.
|
||||
|
||||
if (XULBrowserWindow.isBusy) {
|
||||
this.mCurrentTab.setAttribute("busy", "true");
|
||||
this.mIsBusy = true;
|
||||
this.setTabTitleLoading(this.mCurrentTab);
|
||||
} else {
|
||||
this.setIcon(this.mCurrentTab, this.mCurrentBrowser.mIconURL);
|
||||
}
|
||||
|
||||
var filter;
|
||||
if (this.mTabFilters.length > 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;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="loadOneTab">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
|
@ -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);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -1908,10 +1839,6 @@
|
|||
<![CDATA[
|
||||
this.mProgressListeners =
|
||||
this.mProgressListeners.filter(function (l) l != aListener);
|
||||
|
||||
if (!this.mTabbedMode)
|
||||
// Don't forget to remove it from the filter we hooked it up to
|
||||
this.mTabFilters[0].removeProgressListener(aListener);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -1919,7 +1846,6 @@
|
|||
<method name="addTabsProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
this.enterTabbedMode();
|
||||
this.mTabsProgressListeners.push(aListener);
|
||||
</body>
|
||||
</method>
|
||||
|
@ -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();
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="init">
|
||||
<body><![CDATA[
|
||||
if (!this._initialProgressListenerAdded) {
|
||||
this._initialProgressListenerAdded = true;
|
||||
try {
|
||||
this.webProgress.addProgressListener(this.mTabFilters[0], Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
} catch (e) {
|
||||
// The binding was constructed too early, need to try this again later. See bug 463384.
|
||||
this._initialProgressListenerAdded = false;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
for (var i = 0; i < this.mTabListeners.length; ++i) {
|
||||
|
@ -2511,6 +2461,13 @@
|
|||
</destructor>
|
||||
|
||||
<!-- Deprecated stuff, implemented for backwards compatibility. -->
|
||||
<method name="enterTabbedMode">
|
||||
<body>
|
||||
Application.console.log("enterTabbedMode is an obsolete method and " +
|
||||
"will be removed in a future release.");
|
||||
</body>
|
||||
</method>
|
||||
<field name="mTabbedMode" readonly="true">true</field>
|
||||
<method name="setStripVisibilityTo">
|
||||
<parameter name="aShow"/>
|
||||
<body>
|
||||
|
@ -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"));
|
||||
|
|
Загрузка…
Ссылка в новой задаче