Bug 1551490 - Fix browser_ext_browserAction_contextMenu.js when HTML about:addons is enabled r=rpl
authorRob Wu <rob@robwu.nl>
Sat, 08 Jun 2019 12:37:40 +0000
changeset 478013 0ed314d2412307695a3835968c35c41450c3da49
parent 478012 beeeab2762c6e2e9f587462bedeb82dd5807f34a
child 478014 21074fd8dfe8f857998b1c8dca0ced0d5f1c5d8d
push id36133
push userrmaries@mozilla.com
push dateMon, 10 Jun 2019 09:38:15 +0000
treeherdermozilla-central@7a44faddc33d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1551490
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1551490 - Fix browser_ext_browserAction_contextMenu.js when HTML about:addons is enabled r=rpl When HTML `about:addons` is enabled, the "Manage extension" button still opens the add-on's details page, but without automatically loading the inline options. The test assumed that it did and failed. This patch switches to a different way of detecting that the menu item works as expected. Differential Revision: https://phabricator.services.mozilla.com/D34209
browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_contextMenu.js
@@ -195,20 +195,33 @@ add_task(async function browseraction_co
   }
 
   async function testContextMenu(menuId, customizing) {
     info(`Open browserAction context menu in ${menuId}`);
     let menu = await openContextMenu(menuId, buttonId, win);
     await checkVisibility(menu, true);
 
     info(`Choosing 'Manage Extension' in ${menuId} should load options`);
-    let optionsLoaded = extension.awaitMessage("options-loaded");
+    let addonManagerPromise = BrowserTestUtils.waitForNewTab(win.gBrowser, "about:addons", true);
     let manageExtension = menu.querySelector(".customize-context-manageExtension");
     await closeChromeContextMenu(menuId, manageExtension, win);
-    await optionsLoaded;
+    let managerWindow = (await addonManagerPromise).linkedBrowser.contentWindow;
+    if (managerWindow.useHtmlViews) {
+      // Check the UI to make sure that the correct view is loaded.
+      is(managerWindow.gViewController.currentViewId,
+         `addons://detail/${encodeURIComponent(id)}`,
+         "Expected extension details view in about:addons");
+      // In HTML about:addons, the default view does not show the inline
+      // options browser, so we should not receive an "options-loaded" event.
+      // (if we do, the test will fail due to the unexpected message).
+    } else {
+      info("Waiting for inline options page in XUL about:addons");
+      // In XUL about:addons, the inline options page is shown by default.
+      await extension.awaitMessage("options-loaded");
+    }
 
     info(`Remove the opened tab, and await customize mode to be restored if necessary`);
     let tab = win.gBrowser.selectedTab;
     is(tab.linkedBrowser.currentURI.spec, "about:addons");
     if (customizing) {
       let customizationReady = BrowserTestUtils.waitForEvent(win.gNavToolbox, "customizationready");
       win.gBrowser.removeTab(tab);
       await customizationReady;