1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * This module defines the sorted list of menuitems inserted into the
9 * "Web Developer" menu.
10 * It also defines the key shortcuts that relates to them.
12 * Various fields are necessary for historical compatiblity with XUL/addons:
14 * used as <xul:menuitem> id attribute
16 * prefix used to locale localization strings from menus.properties
18 * function called when the menu item or key shortcut are fired
20 * Identifier used in devtools/client/devtools-startup.js
21 * Helps figuring out the DOM id for the related <xul:key>
22 * in order to have the key text displayed in menus.
24 * If true, the menuitem is prefixed by a checkbox and runtime code can
28 const { Cu } = require("chrome");
30 loader.lazyRequireGetter(
33 "devtools/client/framework/devtools-browser",
36 loader.lazyRequireGetter(
39 "devtools/client/framework/target",
42 loader.lazyRequireGetter(
44 "ResponsiveUIManager",
45 "devtools/client/responsive/manager"
47 loader.lazyRequireGetter(
50 "devtools/client/shared/link",
56 "BrowserToolboxProcess",
57 "resource://devtools/client/framework/ToolboxProcess.jsm"
62 "resource://devtools/client/scratchpad/scratchpad-manager.jsm"
67 "resource://devtools/client/performance-new/popup/menu-button.jsm"
72 id: "menu_devToolbox",
73 l10nKey: "devToolboxMenuItem",
74 async oncommand(event) {
76 const window = event.target.ownerDocument.defaultView;
77 await gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now());
79 console.error(`Exception while opening the toolbox: ${e}\n${e.stack}`);
82 keyId: "toggleToolbox",
85 { id: "menu_devtools_separator", separator: true },
87 id: "menu_devtools_remotedebugging",
88 l10nKey: "devtoolsRemoteDebugging",
90 const window = event.target.ownerDocument.defaultView;
91 gDevToolsBrowser.openAboutDebugging(window.gBrowser);
98 gDevToolsBrowser.openWebIDE();
103 id: "menu_browserToolbox",
104 l10nKey: "browserToolboxMenu",
106 BrowserToolboxProcess.init();
108 keyId: "browserToolbox",
111 id: "menu_browserContentToolbox",
112 l10nKey: "browserContentToolboxMenu",
114 const window = event.target.ownerDocument.defaultView;
115 gDevToolsBrowser.openContentProcessToolbox(window.gBrowser);
119 id: "menu_browserConsole",
120 l10nKey: "browserConsoleCmd",
123 BrowserConsoleManager,
124 } = require("devtools/client/webconsole/browser-console-manager");
125 BrowserConsoleManager.openBrowserConsoleOrFocus();
127 keyId: "browserConsole",
130 id: "menu_toggleProfilerButtonMenu",
131 l10nKey: "toggleProfilerButtonMenu",
134 ProfilerMenuButton.toggle(event.target.ownerDocument);
138 id: "menu_responsiveUI",
139 l10nKey: "responsiveDesignMode",
141 const window = event.target.ownerDocument.defaultView;
142 ResponsiveUIManager.toggle(window, window.gBrowser.selectedTab, {
146 keyId: "responsiveDesignMode",
150 id: "menu_eyedropper",
151 l10nKey: "eyedropper",
152 async oncommand(event) {
153 const window = event.target.ownerDocument.defaultView;
154 const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
155 await target.attach();
156 const inspectorFront = await target.getFront("inspector");
157 inspectorFront.pickColorFromPage({ copyOnSelect: true, fromMenu: true });
162 id: "menu_scratchpad",
163 l10nKey: "scratchpad",
165 ScratchpadManager.openScratchpad();
170 id: "menu_devtools_connect",
171 l10nKey: "devtoolsConnect",
173 const window = event.target.ownerDocument.defaultView;
174 gDevToolsBrowser.openConnectScreen(window.gBrowser);
177 { separator: true, id: "devToolsEndSeparator" },
179 id: "getMoreDevtools",
180 l10nKey: "getMoreDevtoolsCmd",
183 "https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/"