3 draft
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 05 Dec 2019 12:01:23 +1300
changeset 82249 e0dc6d3127be0db071411af1acb409f8313fe83c
parent 82247 2cfb1d544ba0442fce04865f94804fd79ddeb30e
push id9941
push usergeoff@darktrojan.net
push dateWed, 04 Dec 2019 23:09:33 +0000
treeherdertry-comm-central@e0dc6d3127be [default view] [failures only]
bugs3
3
mail/base/content/aboutAddonsExtra.js
mail/base/content/mailCore.js
mail/components/enterprisepolicies/tests/browser/browser_policy_extensions.js
try_task_config.json
--- a/mail/base/content/aboutAddonsExtra.js
+++ b/mail/base/content/aboutAddonsExtra.js
@@ -34,23 +34,25 @@ const THUNDERBIRD_THEME_PREVIEWS = new M
     let contentStylesheet = document.createProcessingInstruction(
       "xml-stylesheet",
       'href="chrome://messenger/content/aboutAddonsExtra.css" type="text/css"'
     );
     document.insertBefore(contentStylesheet, document.documentElement);
 
     // Fix the "Search on addons.mozilla.org" placeholder text in the searchbox.
     let browser = document.getElementById("html-view-browser");
-    let textbox = browser.contentDocument.getElementById("search-addons");
-    let placeholder = textbox.getAttribute("placeholder");
-    placeholder = placeholder.replace(
-      "addons.mozilla.org",
-      "addons.thunderbird.net"
-    );
-    textbox.setAttribute("placeholder", placeholder);
+    browser.contentWindow.setTimeout(() => {
+      let textbox = browser.contentDocument.getElementById("search-addons");
+      let placeholder = textbox.getAttribute("placeholder");
+      placeholder = placeholder.replace(
+        "addons.mozilla.org",
+        "addons.thunderbird.net"
+      );
+      textbox.setAttribute("placeholder", placeholder);
+    });
     return;
   }
 
   window.isCorrectlySigned = function() {
     return true;
   };
 
   delete window.browserBundle;
--- a/mail/base/content/mailCore.js
+++ b/mail/base/content/mailCore.js
@@ -548,55 +548,60 @@ function toSanitize() {
  * @param aScrollPaneTo ID of the element to scroll into view.
  * @param aOtherArgs    other prefpane specific arguments
  */
 function openOptionsDialog(aPaneID, aScrollPaneTo, aOtherArgs) {
   openPreferencesTab(aPaneID, aScrollPaneTo, aOtherArgs);
 }
 
 function openAddonsMgr(aView) {
-  if (aView) {
+  return new Promise(resolve => {
     let emWindow;
     let browserWindow;
 
     let receivePong = function(aSubject, aTopic, aData) {
       let browserWin = aSubject.docShell.rootTreeItem.domWindow;
       if (!emWindow || browserWin == window /* favor the current window */) {
         emWindow = aSubject;
         browserWindow = browserWin;
       }
     };
     Services.obs.addObserver(receivePong, "EM-pong");
     Services.obs.notifyObservers(null, "EM-ping");
     Services.obs.removeObserver(receivePong, "EM-pong");
 
     if (emWindow) {
-      emWindow.loadView(aView);
+      if (aView) {
+        emWindow.loadView(aView);
+      }
       let tabmail = browserWindow.document.getElementById("tabmail");
       tabmail.switchToTab(tabmail.getBrowserForDocument(emWindow));
       emWindow.focus();
+      resolve(emWindow);
       return;
     }
-  }
 
-  let addonSiteRegExp = Services.prefs.getCharPref(
-    "extensions.getAddons.siteRegExp"
-  );
-  let tab = openContentTab("about:addons", "tab", addonSiteRegExp);
-  tab.browser.droppedLinkHandler = event =>
-    tab.browser.contentWindow.gDragDrop.onDrop(event);
-
-  if (aView) {
     // This must be a new load, else the ping/pong would have
     // found the window above.
-    Services.obs.addObserver(function loadViewOnLoad(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(loadViewOnLoad, aTopic);
-      aSubject.loadView(aView);
+    let addonSiteRegExp = Services.prefs.getCharPref(
+      "extensions.getAddons.siteRegExp"
+    );
+    let tab = openContentTab("about:addons", "tab", addonSiteRegExp);
+    tab.browser.droppedLinkHandler = event =>
+      tab.browser.contentWindow.gDragDrop.onDrop(event);
+
+    Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
+      Services.obs.removeObserver(observer, aTopic);
+      if (aView) {
+        aSubject.loadView(aView);
+      }
+      aSubject.focus();
+      resolve(aSubject);
     }, "EM-loaded");
-  }
+  });
 }
 
 /**
  * Open a dialog with addon preferences.
  *
  * @option aURL  Chrome URL for the preferences XUL file of the addon.
  */
 function openAddonPrefs(aURL, aOptionsType) {
--- a/mail/components/enterprisepolicies/tests/browser/browser_policy_extensions.js
+++ b/mail/components/enterprisepolicies/tests/browser/browser_policy_extensions.js
@@ -3,26 +3,23 @@
 "use strict";
 
 const ADDON_ID = "policytest@mozilla.com";
 const BASE_URL =
   "http://mochi.test:8888/browser/comm/mail/components/enterprisepolicies/tests/browser";
 
 async function isExtensionLocked(win, addonID) {
   let addonCard = await BrowserTestUtils.waitForCondition(async () => {
-    if (!("getHtmlBrowser" in win)) {
-      return false;
-    }
     let doc = win.getHtmlBrowser().contentDocument;
     await win.htmlBrowserLoaded;
     return doc.querySelector(`addon-card[addon-id="${addonID}"]`);
   }, `Get addon-card for "${addonID}"`);
   let disableBtn = addonCard.querySelector('[action="toggle-disabled"]');
   let removeBtn = addonCard.querySelector('panel-item[action="remove"]');
-  ok(removeBtn.disabled, "Remove button should be hidden");
+  ok(removeBtn.disabled, "Remove button should be disabled");
   ok(disableBtn.hidden, "Disable button should be hidden");
 }
 
 add_task(async function test_addon_install() {
   let installPromise = wait_for_addon_install();
   await setupPolicyEngineWithJson({
     policies: {
       Extensions: {
@@ -41,17 +38,17 @@ add_task(async function test_addon_insta
     { source: "enterprise-policy" },
     "Got the expected addon.installTelemetryInfo"
   );
 });
 
 add_task(async function test_addon_locked() {
   let tabmail = document.getElementById("tabmail");
   let index = tabmail.tabInfo.length;
-  window.openAddonsMgr("addons://list/extension");
+  await window.openAddonsMgr("addons://list/extension");
   let tab = tabmail.tabInfo[index];
   let browser = tab.browser;
 
   await isExtensionLocked(browser.contentWindow, ADDON_ID);
 
   tabmail.closeTab(tab);
 });
 
new file mode 100644
--- /dev/null
+++ b/try_task_config.json
@@ -0,0 +1,8 @@
+{
+  "version": 1,
+  "use-artifact-builds": true,
+  "tasks": [
+    "test-linux64/opt-mochitest-thunderbird-3",
+    "test-macosx1014-64/opt-mochitest-thunderbird-3"
+  ]
+}