Bug 1352085 - Only update the title and busy/progress attribute of the tab when it has changed. r?dao
No change was necessary for the non-connecting 'title' since we return-early if the label already equals the computed title.
MozReview-Commit-ID: 8XRUwqHsBzq
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -586,17 +586,18 @@
onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
if (!this._shouldShowProgress(aRequest))
return;
- if (this.mTotalProgress)
+ if (this.mTotalProgress &&
+ this.mTab.getAttribute("progress") != "true")
this.mTab.setAttribute("progress", "true");
this._callProgressListeners("onProgressChange",
[aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress]);
},
@@ -672,17 +673,18 @@
}
delete this.mBrowser.initialPageLoadedFromURLBar;
// If the browser is loading it must not be crashed anymore
this.mTab.removeAttribute("crashed");
}
if (this._shouldShowProgress(aRequest)) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
- this.mTab.setAttribute("busy", "true");
+ if (this.mTab.getAttribute("busy") != "true")
+ this.mTab.setAttribute("busy", "true");
if (aWebProgress.isTopLevel &&
!(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
this.mTabBrowser.setTabTitleLoading(this.mTab);
}
if (this.mTab.selected)
this.mTabBrowser.mIsBusy = true;
@@ -1427,22 +1429,26 @@
}
this._tabAttrModified(tab, ["sharing"]);
if (aBrowser == this.mCurrentBrowser)
gIdentityHandler.updateSharingIndicator();
]]></body>
</method>
-
<method name="setTabTitleLoading">
<parameter name="aTab"/>
<body>
<![CDATA[
- aTab.label = this.mStringBundle.getString("tabs.connecting");
+ let connectingString = this.mStringBundle.getString("tabs.connecting");
+ // Setting the label to its identity will invalidate the text
+ // since the actual textNode still gets replaced (bug 725221).
+ if (aTab.label != connectingString) {
+ aTab.label = connectingString;
+ }
this._tabAttrModified(aTab, ["label"]);
]]>
</body>
</method>
<method name="setTabTitle">
<parameter name="aTab"/>
<body>