Bug 1469629 - Read system level policies on Linux if available. r=stransky a=pascalc
authorMichael Kaply <mozilla@kaply.com>
Mon, 11 May 2020 07:10:02 +0000
changeset 524827 203a8c227a997c4ae7e970d0ec497d7292078d5c
parent 524826 d68cf3ff99f841299cd2703ca58bc198815ed318
child 524828 1b0a29b456b432d1c8bef09c233b84205ec9e13c
push id1037
push userryanvm@gmail.com
push dateFri, 22 May 2020 01:14:45 +0000
treeherdermozilla-esr68@555ae5322bbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky, pascalc
bugs1469629
milestone68.9.0
Bug 1469629 - Read system level policies on Linux if available. r=stransky a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D74323
toolkit/components/enterprisepolicies/EnterprisePolicies.js
--- a/toolkit/components/enterprisepolicies/EnterprisePolicies.js
+++ b/toolkit/components/enterprisepolicies/EnterprisePolicies.js
@@ -467,16 +467,30 @@ class JSONPoliciesProvider {
   }
 
   get failed() {
     return this._failed;
   }
 
   _getConfigurationFile() {
     let configFile = null;
+
+    if (AppConstants.platform == "linux") {
+      let systemConfigFile = Cc["@mozilla.org/file/local;1"].createInstance(
+        Ci.nsIFile
+      );
+      systemConfigFile.initWithPath(
+        "/etc/" + Services.appinfo.name.toLowerCase() + "/policies"
+      );
+      systemConfigFile.append(POLICIES_FILENAME);
+      if (systemConfigFile.exists()) {
+        return systemConfigFile;
+      }
+    }
+
     try {
       configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile);
       configFile.append(POLICIES_FILENAME);
     } catch (ex) {
       // Getting the correct directory will fail in xpcshell tests. This should
       // be handled the same way as if the configFile simply does not exist.
     }