Bug 1544793 - Fix setting window title preface by windows API; r=mkmelin DONTBUILD
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 02 Sep 2019 17:16:00 +1200
changeset 35720 71cd49851c2d2b1997f872b48da74453ec6fe7bc
parent 35719 cba2237adb947bccf64582022fcc46445528fefe
child 35721 7243406b271b23f5fd42b6396de232584be22fe9
push id2486
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:24:43 +0000
treeherdercomm-beta@1b30a9a6e7f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1544793
Bug 1544793 - Fix setting window title preface by windows API; r=mkmelin DONTBUILD
mail/base/content/tabmail.js
mail/components/extensions/parent/ext-windows.js
--- a/mail/base/content/tabmail.js
+++ b/mail/base/content/tabmail.js
@@ -1878,24 +1878,28 @@
         );
 
       return true;
     }
 
     /**
      * Set the document title based on the tab title
      */
-    setDocumentTitle(aTab) {
+    setDocumentTitle(aTab = this.selectedTab) {
       let docTitle = aTab.title ? aTab.title.trim() : "";
       let docElement = document.documentElement;
       // If the document title is blank, add the default title.
       if (!docTitle) {
         docTitle = docElement.getAttribute("defaultTabTitle");
       }
 
+      if (docElement.hasAttribute("titlepreface")) {
+        docTitle = docElement.getAttribute("titlepreface") + docTitle;
+      }
+
       // If we're on Mac, don't display the separator and the modifier.
       if (AppConstants.platform != "macosx") {
         docTitle +=
           docElement.getAttribute("titlemenuseparator") +
           docElement.getAttribute("titlemodifier");
       }
 
       document.title = docTitle;
--- a/mail/components/extensions/parent/ext-windows.js
+++ b/mail/components/extensions/parent/ext-windows.js
@@ -297,18 +297,20 @@ this.windows = class extends ExtensionAP
           if (updateInfo.drawAttention) {
             // Bug 1257497 - Firefox can't cancel attention actions.
             win.window.getAttention();
           }
 
           win.updateGeometry(updateInfo);
 
           if (updateInfo.titlePreface) {
-            win.setTitlePreface(updateInfo.titlePreface);
-            win.window.gBrowser.updateTitlebar();
+            if (win instanceof TabmailWindow) {
+              win.setTitlePreface(updateInfo.titlePreface);
+              win.window.document.getElementById("tabmail").setDocumentTitle();
+            }
           }
 
           // TODO: All the other properties, focused=false...
 
           return Promise.resolve(win.convert());
         },
 
         remove(windowId) {