Bug 1716630 - Test for developer tools on app menu when developer tools are disabled is set. r=emalysz

Differential Revision: https://phabricator.services.mozilla.com/D117933
This commit is contained in:
Mike Kaply 2021-06-15 21:41:41 +00:00
parent 5249683cb0
commit 04dd2f4733
2 changed files with 19 additions and 1 deletions

View File

@ -50,6 +50,22 @@ add_task(async function test_updates_post_policy() {
"The Web Developer item of the hamburger menu should not be available."
);
let menuButton = document.getElementById("PanelUI-menu-button");
menuButton.click();
await BrowserTestUtils.waitForEvent(window.PanelUI.mainView, "ViewShown");
let moreToolsButtonId = "appMenu-more-button2";
document.getElementById(moreToolsButtonId).click();
await BrowserTestUtils.waitForEvent(
document.getElementById("appmenu-moreTools"),
"ViewShown"
);
is(
document.getElementById("appmenu-developer-tools-view").children.length,
2,
"The developer tools are properly populated"
);
window.PanelUI.hide();
BrowserTestUtils.removeTab(tab);
});

View File

@ -620,7 +620,9 @@ var gDevToolsBrowser = (exports.gDevToolsBrowser = {
const menu = win.document.getElementById("menu_devToolbox");
// Hide the "Toggle Tools" menu item if we are on about:devtools-toolbox.
menu.hidden = gDevToolsBrowser._isAboutDevtoolsToolbox(win);
menu.hidden =
gDevToolsBrowser._isAboutDevtoolsToolbox(win) ||
Services.prefs.getBoolPref("devtools.policy.disabled", false);
// Add a checkmark for the "Toggle Tools" menu item if a toolbox is already opened.
const hasToolbox = gDevToolsBrowser.hasToolboxOpened(win);