Bug 1427186 - update titlebar even if labels match, iff the tab is selected and this title came from content, r?dao draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 09 Mar 2018 16:02:22 +0000
changeset 765330 8cd74364ef5e2554c265a83bfe781a82ff9d68e6
parent 765329 fafe16ccd3f834dbfb21828ee0dd074518ea0826
push id102032
push usergijskruitbosch@gmail.com
push dateFri, 09 Mar 2018 16:03:21 +0000
reviewersdao
bugs1427186
milestone60.0a1
Bug 1427186 - update titlebar even if labels match, iff the tab is selected and this title came from content, r?dao MozReview-Commit-ID: 53ViIDPPHmh
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -1353,19 +1353,23 @@ window._gBrowser = {
     if (!aOptions.isContentTitle) {
       // Remove protocol and "www."
       if (!("_regex_shortenURLForTabLabel" in this)) {
         this._regex_shortenURLForTabLabel = /^[^:]+:\/\/(?:www\.)?/;
       }
       aLabel = aLabel.replace(this._regex_shortenURLForTabLabel, "");
     }
 
+    let differentContentTitleState = !!aOptions.isContentTitle != !!aTab._labelIsContentTitle;
     aTab._labelIsContentTitle = aOptions.isContentTitle;
 
     if (aTab.getAttribute("label") == aLabel) {
+      if (differentContentTitleState && aTab.selected) {
+        this.updateTitlebar();
+      }
       return false;
     }
 
     let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
                     .getInterface(Ci.nsIDOMWindowUtils);
     let isRTL = dwu.getDirectionFromText(aLabel) == Ci.nsIDOMWindowUtils.DIRECTION_RTL;
 
     aTab.setAttribute("label", aLabel);