Bug 1544533 - Add a policy for local file links. r=Felipe,flod
authorMichael Kaply <mozilla@kaply.com>
Wed, 24 Apr 2019 07:30:22 +0000
changeset 470677 fe6933e8f8a51df00f0c65207c05ad1856625bfa
parent 470676 f83f1665555b208d1923ccca954b65c483e2a162
child 470678 3000254ea670ca499bca1bc397807ab808734167
push id83902
push usermozilla@kaply.com
push dateWed, 24 Apr 2019 14:35:58 +0000
treeherderautoland@fe6933e8f8a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, flod
bugs1544533
milestone68.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 1544533 - Add a policy for local file links. r=Felipe,flod Differential Revision: https://phabricator.services.mozilla.com/D27566
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/locales/en-US/browser/policies/policies-descriptions.ftl
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -674,16 +674,27 @@ var Policies = {
           setAndLockPref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons", false);
           setAndLockPref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features", false);
           manager.disallowFeature("xpinstall");
         }
       }
     },
   },
 
+  "LocalFileLinks": {
+    onBeforeAddons(manager, param) {
+      // If there are existing capabilities, lock them with the policy pref.
+      let policyNames = Services.prefs.getCharPref("capability.policy.policynames", "").split(" ");
+      policyNames.push("localfilelinks_policy");
+      setAndLockPref("capability.policy.policynames", policyNames.join(" "));
+      setAndLockPref("capability.policy.localfilelinks_policy.checkloaduri.enabled", "allAccess");
+      setAndLockPref("capability.policy.localfilelinks_policy.sites", param.join(" "));
+    },
+  },
+
   "NetworkPrediction": {
     onBeforeAddons(manager, param) {
       setAndLockPref("network.dns.disablePrefetch", !param);
       setAndLockPref("network.dns.disablePrefetchFromHTTPS", !param);
     },
   },
 
   "NewTabPage": {
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -398,16 +398,23 @@
           }
         },
         "Default": {
           "type": "boolean"
         }
       }
     },
 
+    "LocalFileLinks": {
+      "type": "array",
+      "items": {
+        "type": "string"
+      }
+    },
+
     "NetworkPrediction": {
       "type": "boolean"
     },
 
     "NewTabPage": {
       "type": "boolean"
     },
 
--- a/browser/locales/en-US/browser/policies/policies-descriptions.ftl
+++ b/browser/locales/en-US/browser/policies/policies-descriptions.ftl
@@ -92,16 +92,18 @@ policy-FlashPlugin = Allow or deny usage
 
 policy-HardwareAcceleration = If false, turn off hardware acceleration.
 
 # “lock” means that the user won’t be able to change this setting
 policy-Homepage = Set and optionally lock the homepage.
 
 policy-InstallAddonsPermission = Allow certain websites to install add-ons.
 
+policy-LocalFileLinks = Allow specific websites to link to local files.
+
 policy-NetworkPrediction = Enable or disable network prediction (DNS prefetching).
 
 policy-NewTabPage = Enable or disable the New Tab page.
 
 policy-NoDefaultBookmarks = Disable creation of the default bookmarks bundled with { -brand-short-name }, and the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.
 
 policy-OfferToSaveLogins = Enforce the setting to allow { -brand-short-name } to offer to remember saved logins and passwords. Both true and false values are accepted.