Bug 1429185 - Disable about: pages for DevTools when disabled by policy;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 23 Feb 2018 17:50:19 +0100
changeset 759057 8c082d0163c5e829b3318f410a801a5cd5cf528f
parent 759056 49f1c3859029683c8da0b3465734394e15ba013a
push id100264
push userjdescottes@mozilla.com
push dateFri, 23 Feb 2018 17:01:36 +0000
reviewersochameau
bugs1429185
milestone60.0a1
Bug 1429185 - Disable about: pages for DevTools when disabled by policy;r=ochameau MozReview-Commit-ID: IIFYPDb4LRS
devtools/shim/aboutdebugging-registration.js
devtools/shim/aboutdevtools/aboutdevtools-registration.js
devtools/shim/aboutdevtoolstoolbox-registration.js
--- a/devtools/shim/aboutdebugging-registration.js
+++ b/devtools/shim/aboutdebugging-registration.js
@@ -32,11 +32,14 @@ AboutDebugging.prototype = {
     return chan;
   },
 
   getURIFlags: function (uri) {
     return nsIAboutModule.ALLOW_SCRIPT;
   }
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
-  AboutDebugging
-]);
+let isDisabled = Services.prefs.getBoolPref("devtools.policy.disabled", false);
+if (!isDisabled) {
+  this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
+    AboutDebugging
+  ]);
+}
--- a/devtools/shim/aboutdevtools/aboutdevtools-registration.js
+++ b/devtools/shim/aboutdevtools/aboutdevtools-registration.js
@@ -30,11 +30,14 @@ AboutDevtools.prototype = {
     return chan;
   },
 
   getURIFlags: function (uri) {
     return nsIAboutModule.ALLOW_SCRIPT;
   }
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
-  AboutDevtools
-]);
+let isDisabled = Services.prefs.getBoolPref("devtools.policy.disabled", false);
+if (!isDisabled) {
+  this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
+    AboutDevtools
+  ]);
+}
--- a/devtools/shim/aboutdevtoolstoolbox-registration.js
+++ b/devtools/shim/aboutdevtoolstoolbox-registration.js
@@ -30,11 +30,14 @@ AboutDevtoolsToolbox.prototype = {
 
   getURIFlags: function (uri) {
     return nsIAboutModule.ALLOW_SCRIPT |
            nsIAboutModule.ENABLE_INDEXED_DB |
            nsIAboutModule.HIDE_FROM_ABOUTABOUT;
   }
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
-  AboutDevtoolsToolbox
-]);
+let isDisabled = Services.prefs.getBoolPref("devtools.policy.disabled", false);
+if (!isDisabled) {
+  this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
+    AboutDevtoolsToolbox
+  ]);
+}