Bug 1553031 - Hide Remote Debugging menu item when new aboutdebugging is disabled r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 21 May 2019 08:52:18 +0000
changeset 474687 3892b0290dbdf5ff2c1d907876fb79d5db8f6cff
parent 474686 38a89c91277887c28240c6a95ca93813d08ebf89
child 474688 b2b3da42e524731c6f03655451445669a2501c5a
push id36044
push userrmaries@mozilla.com
push dateTue, 21 May 2019 15:45:34 +0000
treeherdermozilla-central@78571bb1f20e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1553031
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 1553031 - Hide Remote Debugging menu item when new aboutdebugging is disabled r=daisuke Differential Revision: https://phabricator.services.mozilla.com/D31966
devtools/client/menus.js
--- a/devtools/client/menus.js
+++ b/devtools/client/menus.js
@@ -24,49 +24,55 @@
  *   If true, the menuitem and key shortcut are going to be hidden and disabled
  *   on startup, until some runtime code eventually enable them.
  * - checkbox:
  *   If true, the menuitem is prefixed by a checkbox and runtime code can
  *   toggle it.
  */
 
 const { Cu } = require("chrome");
+const Services = require("Services");
 
 loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
 loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
 loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true);
 loader.lazyRequireGetter(this, "openDocLink", "devtools/client/shared/link", true);
 
 loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm");
 loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
 
+const isAboutDebuggingEnabled =
+  Services.prefs.getBoolPref("devtools.aboutdebugging.new-enabled", false);
+const aboutDebuggingItem = {
+  id: "menu_devtools_remotedebugging",
+  l10nKey: "devtoolsRemoteDebugging",
+  disabled: true,
+  oncommand(event) {
+    const window = event.target.ownerDocument.defaultView;
+    gDevToolsBrowser.openAboutDebugging(window.gBrowser);
+  },
+};
+
 exports.menuitems = [
   { id: "menu_devToolbox",
     l10nKey: "devToolboxMenuItem",
     async oncommand(event) {
       try {
         const window = event.target.ownerDocument.defaultView;
         await gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now());
       } catch (e) {
         console.error(`Exception while opening the toolbox: ${e}\n${e.stack}`);
       }
     },
     keyId: "toggleToolbox",
     checkbox: true,
   },
   { id: "menu_devtools_separator",
     separator: true },
-  { id: "menu_devtools_remotedebugging",
-    l10nKey: "devtoolsRemoteDebugging",
-    disabled: true,
-    oncommand(event) {
-      const window = event.target.ownerDocument.defaultView;
-      gDevToolsBrowser.openAboutDebugging(window.gBrowser);
-    },
-  },
+  ...(isAboutDebuggingEnabled ? [aboutDebuggingItem] : []),
   { id: "menu_webide",
     l10nKey: "webide",
     disabled: true,
     oncommand() {
       gDevToolsBrowser.openWebIDE();
     },
     keyId: "webide",
   },