Bug 1715777 - Hide individual developer menuitems if devtools disabled by policy. r=emalysz, a=pascalc
authorMike Kaply <mozilla@kaply.com>
Mon, 14 Jun 2021 14:04:44 +0000
changeset 649712 e4d318c8ad29a2a141be91c7bdbc1e7d54fe733e
parent 649711 e3a416eccd089cb34abae09e373ee2ae1b555a84
child 649713 9877ef0254663d8a5a19c303dbf16ed4c73e399e
push id15544
push userjcristau@mozilla.com
push dateTue, 15 Jun 2021 17:37:01 +0000
treeherdermozilla-beta@79349f71d9e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemalysz, pascalc
bugs1715777
milestone90.0
Bug 1715777 - Hide individual developer menuitems if devtools disabled by policy. r=emalysz, a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D117548
devtools/client/framework/devtools-browser.js
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -135,16 +135,27 @@ var gDevToolsBrowser = (exports.gDevTool
       "devtools.debugger.remote-enabled"
     );
     const remoteEnabled = chromeEnabled && devtoolsRemoteEnabled;
     toggleMenuItem("menu_browserToolbox", remoteEnabled);
     toggleMenuItem(
       "menu_browserContentToolbox",
       remoteEnabled && win.gMultiProcessBrowser
     );
+
+    if (Services.prefs.getBoolPref("devtools.policy.disabled", false)) {
+      toggleMenuItem("menu_devToolbox", false);
+      toggleMenuItem("menu_devtools_remotedebugging", false);
+      toggleMenuItem("menu_browserToolbox", false);
+      toggleMenuItem("menu_browserContentToolbox", false);
+      toggleMenuItem("menu_browserConsole", false);
+      toggleMenuItem("menu_responsiveUI", false);
+      toggleMenuItem("menu_eyedropper", false);
+      toggleMenuItem("extensionsForDevelopers", false);
+    }
   },
 
   /**
    * This function makes sure that the "devtoolstheme" attribute is set on the browser
    * window to make it possible to change colors on elements in the browser (like the
    * splitter between the toolbox and web content).
    */
   updateDevtoolsThemeAttribute(win) {