Bug 1568916 - Only allow disabling of ESR policy in test. r=bytesized
authorMichael Kaply <mozilla@kaply.com>
Thu, 07 May 2020 19:44:55 +0000
changeset 528683 98097ed0a9a5e699228d42f6c7611d80d27d8bf6
parent 528682 012f25fede5cc41dc810b21e27c3393b382bf9eb
child 528684 b76e3e988fdd20bb726468ab1684127b53ddf833
push id37393
push userrmaries@mozilla.com
push dateFri, 08 May 2020 03:38:07 +0000
treeherdermozilla-central@ead8f0367372 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1568916
milestone78.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 1568916 - Only allow disabling of ESR policy in test. r=bytesized Differential Revision: https://phabricator.services.mozilla.com/D74288
toolkit/components/enterprisepolicies/EnterprisePolicies.js
--- a/toolkit/components/enterprisepolicies/EnterprisePolicies.js
+++ b/toolkit/components/enterprisepolicies/EnterprisePolicies.js
@@ -419,28 +419,26 @@ let InstallSources = null;
  *
  * This is meant to only allow policies to run on ESR, but in practice
  * we allow it to run on channels different than release, to allow
  * these policies to be tested on pre-release channels.
  *
  * @returns {Bool} Whether the policy can run.
  */
 function areEnterpriseOnlyPoliciesAllowed() {
-  if (Services.prefs.getBoolPref(PREF_DISALLOW_ENTERPRISE, false)) {
-    // This is used as an override to test the "enterprise_only"
-    // functionality itself on tests, which would always return
-    // true due to the Cu.isInAutomation check below.
-    return false;
+  if (Cu.isInAutomation || isXpcshell) {
+    if (Services.prefs.getBoolPref(PREF_DISALLOW_ENTERPRISE, false)) {
+      // This is used as an override to test the "enterprise_only"
+      // functionality itself on tests.
+      return false;
+    }
+    return true;
   }
 
-  if (
-    AppConstants.MOZ_UPDATE_CHANNEL != "release" ||
-    Cu.isInAutomation ||
-    isXpcshell
-  ) {
+  if (AppConstants.MOZ_UPDATE_CHANNEL != "release") {
     return true;
   }
 
   return false;
 }
 
 /*
  * JSON PROVIDER OF POLICIES