Bug 1659318 - Fix help menu in the message compose window and addressbook. r=mkmelin
authorKhushil Mistry <khushil324@gmail.com>
Wed, 19 Aug 2020 10:45:10 +1200
changeset 30400 e5cda005037b5f592b6b8830488597c81be6d6c9
parent 30399 d170d02c657a8b885df9d935b4e3d2b3a027a612
child 30401 e3cbcdd52b483f5af4a0badbb796ecb735cf0f70
push id17858
push usergeoff@darktrojan.net
push dateTue, 18 Aug 2020 22:45:52 +0000
treeherdercomm-central@e5cda005037b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1659318
Bug 1659318 - Fix help menu in the message compose window and addressbook. r=mkmelin
mail/base/content/mailCore.js
mail/base/content/utilityOverlay.js
--- a/mail/base/content/mailCore.js
+++ b/mail/base/content/mailCore.js
@@ -726,21 +726,39 @@ function openFormattedURL(aPrefName) {
   ].getService(Ci.nsIExternalProtocolService);
   protocolSvc.loadURI(uri);
 }
 
 /**
  * Opens the Troubleshooting page in a new tab.
  */
 function openAboutSupport() {
-  let tabmail = document.getElementById("tabmail");
-  tabmail.openTab("contentTab", {
-    contentPage: "about:support",
-    clickHandler: "specialTabs.aboutClickHandler(event);",
-  });
+  let mailWindow = Services.wm.getMostRecentWindow("mail:3pane");
+  if (mailWindow) {
+    mailWindow.focus();
+    mailWindow.document.getElementById("tabmail").openTab("contentTab", {
+      contentPage: "about:support",
+      clickHandler: "specialTabs.aboutClickHandler(event);",
+    });
+    return;
+  }
+
+  window.openDialog(
+    "chrome://messenger/content/messenger.xhtml",
+    "_blank",
+    "chrome,dialog=no,all",
+    null,
+    {
+      tabType: "contentTab",
+      tabParams: {
+        contentPage: "about:support",
+        clickHandler: "specialTabs.aboutClickHandler(event);",
+      },
+    }
+  );
 }
 
 /**
  * Prompt the user to restart the browser in safe mode.
  */
 function safeModeRestart() {
   // Is TB in safe mode?
   if (Services.appinfo.inSafeMode) {
--- a/mail/base/content/utilityOverlay.js
+++ b/mail/base/content/utilityOverlay.js
@@ -191,16 +191,18 @@ function openUILink(url, event) {
         url,
         visits: [
           {
             date: new Date(),
           },
         ],
       })
       .catch(Cu.reportError);
+    let messenger = Cc["@mozilla.org/messenger;1"].createInstance();
+    messenger = messenger.QueryInterface(Ci.nsIMessenger);
     messenger.launchExternalURL(url);
   }
 }
 
 function openLinkText(event, what) {
   switch (what) {
     case "getInvolvedURL":
       openUILink("https://www.thunderbird.net/get-involved/", event);
@@ -408,15 +410,17 @@ function goOnEvent(aNode, aEvent) {
     controller = aNode.controllers.getControllerAt(controllerIndex);
     if (controller) {
       controller.onEvent(aEvent);
     }
   }
 }
 
 function buildHelpMenu() {
-  document.getElementById(
-    "helpSafeMode"
-  ).disabled = !Services.policies.isAllowed("safeMode");
-  document.getElementById(
-    "appmenu_safeMode"
-  ).disabled = !Services.policies.isAllowed("safeMode");
+  let helpSafeModeItem = document.getElementById("helpSafeMode");
+  if (helpSafeModeItem) {
+    helpSafeModeItem.disabled = !Services.policies.isAllowed("safeMode");
+  }
+  let appmenu_safeModeItem = document.getElementById("appmenu_safeMode");
+  if (appmenu_safeModeItem) {
+    appmenu_safeModeItem.disabled = !Services.policies.isAllowed("safeMode");
+  }
 }