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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Wu 2019-06-08 12:37:40 +00:00
Родитель 17aef30266
Коммит e46b58d180
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -200,10 +200,23 @@ add_task(async function browseraction_contextmenu_manage_extension() {
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;