Don't show 'Connecting' and 'Loading' labels in tab while loading pages (bug 1359352). r?dao draft
authorPanos Astithas <past@mozilla.com>
Fri, 05 May 2017 16:52:03 +0300
changeset 575205 001991adeb8b3d68fcf7b8dca7282a3850e9f453
parent 575133 120d8562d4a53e4f78bd86c6f5076f6db265e5a3
child 627862 16add5ee63fd558e7930d78ec1ef7a0b1dd3398b
push id57997
push userbmo:past@mozilla.com
push dateWed, 10 May 2017 04:39:37 +0000
reviewersdao
bugs1359352
milestone55.0a1
Don't show 'Connecting' and 'Loading' labels in tab while loading pages (bug 1359352). r?dao MozReview-Commit-ID: HMs0ri5kLw3
browser/base/content/tabbrowser.xml
browser/components/sessionstore/SessionStore.jsm
browser/locales/en-US/chrome/browser/tabbrowser.properties
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -686,20 +686,17 @@
                   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 (aWebProgress.isTopLevel &&
-                        !(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
-                      this.mTabBrowser.setTabTitleLoading(this.mTab);
+                    this.mTabBrowser.setTabTitle(this.mTab);
                   }
 
                   if (this.mTab.selected)
                     this.mTabBrowser.mIsBusy = true;
                 }
               } else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
                          aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
 
@@ -731,19 +728,16 @@
                   if (!this.mBrowser.mIconURL)
                     this.mTabBrowser.useDefaultIcon(this.mTab);
                 }
 
                 // For keyword URIs clear the user typed value since they will be changed into real URIs
                 if (location.scheme == "keyword")
                   this.mBrowser.userTypedValue = null;
 
-                if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.connecting"))
-                  this.mTabBrowser.setTabTitle(this.mTab);
-
                 if (this.mTab.selected)
                   this.mTabBrowser.mIsBusy = false;
               }
 
               if (ignoreBlank) {
                 this._callProgressListeners("onUpdateCurrentBrowser",
                                             [aStateFlags, aStatus, "", 0],
                                             true, false);
@@ -1404,24 +1398,20 @@
           this._tabAttrModified(tab, ["sharing"]);
 
           if (aBrowser == this.mCurrentBrowser)
             gIdentityHandler.updateSharingIndicator();
         ]]></body>
       </method>
 
 
+      <!-- TODO: remove after 57, once we know add-ons can no longer use it. -->
       <method name="setTabTitleLoading">
         <parameter name="aTab"/>
-        <body>
-          <![CDATA[
-            aTab.label = this.mStringBundle.getString("tabs.connecting");
-            this._tabAttrModified(aTab, ["label"]);
-          ]]>
-        </body>
+        <body/>
       </method>
 
       <method name="setTabTitle">
         <parameter name="aTab"/>
         <body>
           <![CDATA[
             var browser = this.getBrowserForTab(aTab);
             var title = browser.contentTitle;
@@ -3088,20 +3078,17 @@
               ourFindBar._findField.value = otherFindBar._findField.value;
               if (!otherFindBar.hidden)
                 ourFindBar.onFindCommand();
             }
 
             // Finish tearing down the tab that's going away.
             remoteBrowser._endRemoveTab(aOtherTab);
 
-            if (isBusy)
-              this.setTabTitleLoading(aOurTab);
-            else
-              this.setTabTitle(aOurTab);
+            this.setTabTitle(aOurTab);
 
             // If the tab was already selected (this happpens in the scenario
             // of replaceTabWithWindow), notify onLocationChange, etc.
             if (aOurTab.selected)
               this.updateCurrentBrowser(true);
 
             if (modifiedAttrs.length) {
               this._tabAttrModified(aOurTab, modifiedAttrs);
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -1375,18 +1375,16 @@ var SessionStoreInternal = {
 
       for (let [tab, tabData] of tabMap) {
         let permanentKey = tab.linkedBrowser.permanentKey;
         this._closedWindowTabs.set(permanentKey, tabData);
       }
 
       if (isFullyLoaded) {
         winData.title = tabbrowser.selectedBrowser.contentTitle || tabbrowser.selectedTab.label;
-        winData.title = this._replaceLoadingTitle(winData.title, tabbrowser,
-                                                  tabbrowser.selectedTab);
       }
 
       if (AppConstants.platform != "macosx") {
         // Until we decide otherwise elsewhere, this window is part of a series
         // of closing windows to quit.
         winData._shouldRestore = true;
       }
 
@@ -1929,17 +1927,17 @@ var SessionStoreInternal = {
     // Don't save private tabs
     let isPrivateWindow = PrivateBrowsingUtils.isWindowPrivate(aWindow);
     if (!isPrivateWindow && tabState.isPrivate) {
       return;
     }
 
     // Store closed-tab data for undo.
     let tabbrowser = aWindow.gBrowser;
-    let tabTitle = this._replaceLoadingTitle(aTab.label, tabbrowser, aTab);
+    let tabTitle = aTab.label;
     let {permanentKey} = aTab.linkedBrowser;
 
     let tabData = {
       permanentKey,
       state: tabState,
       title: tabTitle,
       image: tabbrowser.getIcon(aTab),
       iconLoadingPrincipal: Utils.serializePrincipal(aTab.linkedBrowser.contentPrincipal),
@@ -2314,19 +2312,18 @@ var SessionStoreInternal = {
     }
 
     // Create a new tab.
     let userContextId = aTab.getAttribute("usercontextid");
     let newTab = aTab == aWindow.gBrowser.selectedTab ?
       aWindow.gBrowser.addTab(null, {relatedToCurrent: true, ownerTab: aTab, userContextId}) :
       aWindow.gBrowser.addTab(null, {userContextId});
 
-    // Set tab title to "Connecting..." and start the throbber to pretend we're
-    // doing something while actually waiting for data from the frame script.
-    aWindow.gBrowser.setTabTitleLoading(newTab);
+    // Start the throbber to pretend we're doing something while actually
+    // waiting for data from the frame script.
     newTab.setAttribute("busy", "true");
 
     // Collect state before flushing.
     let tabState = TabState.clone(aTab);
 
     // Flush to get the latest tab state to duplicate.
     let browser = aTab.linkedBrowser;
     TabStateFlusher.flush(browser).then(() => {
@@ -2855,19 +2852,18 @@ var SessionStoreInternal = {
     this._remotenessChangingBrowsers.set(browser.permanentKey, loadArguments);
 
     if (alreadyRestoring) {
       // This tab was already being restored to run in the
       // correct process. We're done here.
       return;
     }
 
-    // Set tab title to "Connecting..." and start the throbber to pretend we're
-    // doing something while actually waiting for data from the frame script.
-    window.gBrowser.setTabTitleLoading(tab);
+    // Start the throbber to pretend we're doing something while actually
+    // waiting for data from the frame script.
     tab.setAttribute("busy", "true");
 
     // Flush to get the latest tab state.
     TabStateFlusher.flush(browser).then(() => {
       // loadArguments might have been overwritten by multiple calls
       // to navigateAndRestore while we waited for the tab to flush,
       // so we use the most recently stored one.
       let recentLoadArguments =
@@ -4478,32 +4474,16 @@ var SessionStoreInternal = {
    * @returns whether this window's data is still cached in _statesToRestore
    *          because it's not fully loaded yet
    */
   _isWindowLoaded: function ssi_isWindowLoaded(aWindow) {
     return !aWindow.__SS_restoreID;
   },
 
   /**
-   * Replace "Loading..." with the tab label (with minimal side-effects)
-   * @param aString is the string the title is stored in
-   * @param aTabbrowser is a tabbrowser object, containing aTab
-   * @param aTab is the tab whose title we're updating & using
-   *
-   * @returns aString that has been updated with the new title
-   */
-  _replaceLoadingTitle: function ssi_replaceLoadingTitle(aString, aTabbrowser, aTab) {
-    if (aString == aTabbrowser.mStringBundle.getString("tabs.connecting")) {
-      aTabbrowser.setTabTitle(aTab);
-      [aString, aTab.label] = [aTab.label, aString];
-    }
-    return aString;
-  },
-
-  /**
    * Resize this._closedWindows to the value of the pref, except in the case
    * where we don't have any non-popup windows on Windows and Linux. Then we must
    * resize such that we have at least one non-popup window.
    */
   _capClosedWindows: function ssi_capClosedWindows() {
     if (this._closedWindows.length <= this._max_windows_undo)
       return;
     let spliceTo = this._max_windows_undo;
--- a/browser/locales/en-US/chrome/browser/tabbrowser.properties
+++ b/browser/locales/en-US/chrome/browser/tabbrowser.properties
@@ -1,27 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# LOCALIZATION NOTE: the following strings can be used in the tab title or
-# location bar to represent various states as a web page loads:
-# tabs.connecting = Firefox is sending a HTTP connection request
-# tabs.encryptingConnection = Firefox is sending a HTTPS connection request
-# tabs.searching = Firefox is searching for something (Awesomebar or Web search)
-# tabs.loading = Firefox is loading the web page
-# tabs.waiting = Firefox is waiting for a web resource to load
-# tabs.downloading = Firefox is downloading a file for a helper application (PDF)
-tabs.connecting=Connecting…
-tabs.encryptingConnection=Securing connection…
-tabs.searching=Searching…
-tabs.loading=Loading…
-tabs.waiting=Waiting…
-tabs.downloading=Downloading…
-
 tabs.restoreLastTabs=Restore Tabs From Last Time
 tabs.emptyTabTitle=New Tab
 tabs.closeTab=Close Tab
 tabs.close=Close
 tabs.closeWarningTitle=Confirm close
 # LOCALIZATION NOTE (tabs.closeWarningMultiple):
 # Semicolon-separated list of plural forms. See:
 # http://developer.mozilla.org/en/docs/Localization_and_Plurals