Bug 1352085 - Only update the title and busy/progress attribute of the tab when it has changed. r?dao draft
authorJared Wein <jwein@mozilla.com>
Fri, 31 Mar 2017 18:07:06 -0400
changeset 554555 d20b55eff991827428f04176c294de97a2dd006f
parent 554549 024588da8ee7c6fe33b1893b40f1cbea3b20babd
child 554569 72e685874c402aa168f500683f66d5d548f1e8c1
child 555041 84cf630e1c94bb43592a02bf698caaeaa8618538
child 555603 2c7183dbe614f5a313df464b904c49484d241924
push id51982
push userbmo:jaws@mozilla.com
push dateFri, 31 Mar 2017 22:07:21 +0000
reviewersdao
bugs1352085
milestone55.0a1
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
browser/base/content/tabbrowser.xml
--- 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>