mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 1719463 - Part 10: Remove the devtools button from the pre-proton appMenu view. r=jdescottes,Gijs,mkaply
Differential Revision: https://phabricator.services.mozilla.com/D121810
This commit is contained in:
parent
d59eb94ce3
commit
ba9f1e0d39
@ -6,11 +6,6 @@
|
||||
<panelview id="appMenu-mainView" class="PanelUI-subView"
|
||||
descriptionheightworkaround="true">
|
||||
<vbox class="panel-subview-body">
|
||||
<toolbarbutton id="appMenu-developer-button"
|
||||
class="subviewbutton subviewbutton-nav"
|
||||
label="&webDeveloperMenu.label;"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('PanelUI-developer', this)"/>
|
||||
<toolbarbutton id="appMenu-whatsnew-button"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
hidden="true"
|
||||
@ -233,10 +228,6 @@
|
||||
<vbox id="PanelUI-helpItems" class="panel-subview-body"/>
|
||||
</panelview>
|
||||
|
||||
<panelview id="PanelUI-developer" flex="1">
|
||||
<vbox id="PanelUI-developerItems" class="panel-subview-body"/>
|
||||
</panelview>
|
||||
|
||||
<panelview id="PanelUI-bookmarks" flex="1" class="PanelUI-subView">
|
||||
<vbox class="panel-subview-body">
|
||||
<toolbarbutton id="panelMenuBookmarkThisPage"
|
||||
|
@ -38,18 +38,6 @@ add_task(async function test_updates_post_policy() {
|
||||
false
|
||||
);
|
||||
|
||||
info("Check that devtools menu items are hidden");
|
||||
let toolsMenu = window.document.getElementById("webDeveloperMenu");
|
||||
ok(toolsMenu.hidden, "The Web Developer item of the tools menu is hidden");
|
||||
let hamburgerMenu = window.document.getElementById(
|
||||
"appMenu-developer-button"
|
||||
);
|
||||
is(
|
||||
hamburgerMenu,
|
||||
null,
|
||||
"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");
|
||||
|
@ -105,20 +105,15 @@ if (typeof Mozilla == "undefined") {
|
||||
* - appMenu
|
||||
* - backForward
|
||||
* - bookmarks
|
||||
* - devtools
|
||||
* - forget
|
||||
* - help
|
||||
* - home
|
||||
* - library
|
||||
* - logins
|
||||
* - pageAction-bookmark
|
||||
* - pageAction-copyURL
|
||||
* - pageAction-emailLink
|
||||
* - pageAction-sendToDevice
|
||||
* - pocket
|
||||
* - privateWindow
|
||||
* - quit
|
||||
* - readerMode-urlBar
|
||||
* - screenshots
|
||||
* - search
|
||||
* - searchIcon
|
||||
* - selectedTabIcon
|
||||
|
@ -142,13 +142,6 @@ var UITour = {
|
||||
],
|
||||
["backForward", { query: "#back-button" }],
|
||||
["bookmarks", { query: "#bookmarks-menu-button" }],
|
||||
[
|
||||
"devtools",
|
||||
{
|
||||
query: "#appMenu-developer-button",
|
||||
widgetName: "appMenu-developer-button",
|
||||
},
|
||||
],
|
||||
[
|
||||
"forget",
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ function getExpectedTargets() {
|
||||
"addons",
|
||||
"appMenu",
|
||||
"backForward",
|
||||
"devtools",
|
||||
"help",
|
||||
"logins",
|
||||
"pageAction-bookmark",
|
||||
|
@ -50,8 +50,6 @@ this container is a toolbar. This avoids double-speaking. -->
|
||||
- downloads.label, but used in the Library panel. -->
|
||||
<!ENTITY libraryDownloads.label "Downloads">
|
||||
|
||||
<!ENTITY webDeveloperMenu.label "Web Developer">
|
||||
|
||||
<!ENTITY newNavigatorCmd.label "New Window">
|
||||
<!ENTITY newPrivateWindow.label "New Private Window">
|
||||
|
||||
|
@ -469,7 +469,6 @@ DevToolsStartup.prototype = {
|
||||
*/
|
||||
onWindowReady(window) {
|
||||
if (this.isDisabledByPolicy()) {
|
||||
this.removeDevToolsMenus(window);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -485,16 +484,6 @@ DevToolsStartup.prototype = {
|
||||
JsonView.initialize();
|
||||
},
|
||||
|
||||
removeDevToolsMenus(window) {
|
||||
// This will hide the "Tools > Web Developer" menu.
|
||||
window.document.getElementById("webDeveloperMenu").hidden = true;
|
||||
// This will hide the "Web Developer" item in the hamburger menu.
|
||||
PanelMultiView.getViewNode(
|
||||
window.document,
|
||||
"appMenu-developer-button"
|
||||
).hidden = true;
|
||||
},
|
||||
|
||||
onFirstWindowReady(window) {
|
||||
if (this.devtoolsFlag) {
|
||||
this.handleDevToolsFlag(window);
|
||||
|
@ -12,6 +12,22 @@ const { CustomizableUI } = ChromeUtils.import(
|
||||
const { AppConstants } = require("resource://gre/modules/AppConstants.jsm");
|
||||
const { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
||||
async function simulateMenuOpen(menu) {
|
||||
return new Promise(resolve => {
|
||||
menu.addEventListener("popupshown", resolve, { once: true });
|
||||
menu.dispatchEvent(new MouseEvent("popupshowing"));
|
||||
menu.dispatchEvent(new MouseEvent("popupshown"));
|
||||
});
|
||||
}
|
||||
|
||||
async function simulateMenuClosed(menu) {
|
||||
return new Promise(resolve => {
|
||||
menu.addEventListener("popuphidden", resolve, { once: true });
|
||||
menu.dispatchEvent(new MouseEvent("popuphiding"));
|
||||
menu.dispatchEvent(new MouseEvent("popuphidden"));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the preference devtools.policy.disabled disables entry points for devtools.
|
||||
*/
|
||||
@ -92,15 +108,38 @@ add_task(async function() {
|
||||
contextMenu.hidePopup();
|
||||
await onContextMenuHidden;
|
||||
|
||||
const toolsMenu = win.document.getElementById("webDeveloperMenu");
|
||||
ok(toolsMenu.hidden, "The Web Developer item of the tools menu is hidden");
|
||||
const hamburgerMenu = win.document.getElementById("appMenu-developer-button");
|
||||
is(
|
||||
hamburgerMenu,
|
||||
null,
|
||||
"The Web Developer item of the hamburger menu should not be available"
|
||||
info("Open the menubar Tools menu");
|
||||
const toolsMenuPopup = win.document.getElementById("menu_ToolsPopup");
|
||||
// The "Browser Tools" menu still uses the id `webDeveloperMenu` even though it
|
||||
// is no longer DevTools-specific.
|
||||
const browserToolsMenu = win.document.getElementById("webDeveloperMenu");
|
||||
ok(
|
||||
!browserToolsMenu.hidden,
|
||||
"The Web Developer item of the tools menu is visible"
|
||||
);
|
||||
|
||||
await simulateMenuOpen(toolsMenuPopup);
|
||||
const subMenu = win.document.getElementById("menuWebDeveloperPopup");
|
||||
|
||||
info("Open the Browser Tools sub-menu");
|
||||
await simulateMenuOpen(subMenu);
|
||||
|
||||
const visibleMenuItems = Array.from(
|
||||
subMenu.querySelectorAll("menuitem")
|
||||
).filter(item => !item.hidden);
|
||||
|
||||
const { menuitems } = require("devtools/client/menus");
|
||||
for (const devtoolsItem of menuitems) {
|
||||
ok(
|
||||
!visibleMenuItems.some(item => item.id === devtoolsItem.id),
|
||||
"DevTools menu item is not visible in the Browser Tools menu"
|
||||
);
|
||||
}
|
||||
|
||||
info("Close out the menu popups");
|
||||
await simulateMenuClosed(subMenu);
|
||||
await simulateMenuClosed(toolsMenuPopup);
|
||||
|
||||
win.gBrowser.removeTab(tab);
|
||||
|
||||
info("Close the test window");
|
||||
|
Loading…
x
Reference in New Issue
Block a user