Bug 152127 - Prevent tabs from getting renamed to "(Untitled)" at seemingly random times.

r=bzbarsky sr=jag a=asa

Also fixes bugs 101827, 101831, 102924, 108189, 108350, 108421, 111118, 124028, 134815, 141839, 144431, 144984, 150669, 158171
This commit is contained in:
caillon%returnzero.com 2002-07-23 10:24:14 +00:00
parent e395893de6
commit 7a87792fb6

View File

@ -213,10 +213,10 @@
}
else if (this.mTabBrowser.shouldLoadFavIcon(location))
this.mTabBrowser.loadFavIcon(location, "image", this.mTab);
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.untitled")
this.mTabBrowser.setTabTitle(this.mTab);
if (this.mTabBrowser.mCurrentTab == this.mTab)
this.mTabBrowser.mIsBusy = false;
}
@ -529,15 +529,38 @@
var tabBrowser = this.parentNode.parentNode.parentNode;
var tab = tabBrowser.mTabContainer.childNodes[i];
if (this.contentDocument.title)
tab.setAttribute("label", this.contentDocument.title);
tabBrowser.setTabTitle(tab);
if (tab == tabBrowser.mCurrentTab)
this.parentNode.parentNode.parentNode.updateTitlebar();
tabBrowser.updateTitlebar();
]]>
</body>
</method>
<method name="setTabTitle">
<parameter name="aTab"/>
<body>
<![CDATA[
var browser = this.getBrowserForTab(aTab);
var crop = "end";
var titleViaGetter = browser.contentDocument.__proto__.__lookupGetter__('title').call(browser.contentDocument);
var title;
if (titleViaGetter)
title = titleViaGetter
else if (browser.currentURI.spec && browser.currentURI.spec != "about:blank") {
title = browser.currentURI.spec;
crop = "center";
}
else
title = this.mStringBundle.getString("tabs.untitled");
aTab.label = title;
aTab.setAttribute("crop", crop);
]]>
</body>
</method>
<method name="setStripVisibilityTo">
<parameter name="aShow"/>
<body>
@ -573,8 +596,7 @@
// Get the first tab all hooked up with a title listener.
this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
if (this.mCurrentBrowser.contentDocument.title != "")
this.mCurrentTab.label = this.mCurrentBrowser.contentDocument.title;
this.setTabTitle(this.mCurrentTab);
// Hook up our favicon.
var uri = this.mCurrentBrowser.currentURI;