Bug 1429131 - Add policy to lock xpinstall.enabled. r=felipe
MozReview-Commit-ID: Frt4rMFL42K
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -479,17 +479,22 @@ var Policies = {
Services.prefs.clearUserPref("browser.startup.page");
});
}
}
},
"InstallAddons": {
onBeforeUIStartup(manager, param) {
- addAllowDenyPermissions("install", param.Allow, null);
+ if ("Allow" in param) {
+ addAllowDenyPermissions("install", param.Allow, null);
+ }
+ if ("Default" in param) {
+ setAndLockPref("xpinstall.enabled", param.Default);
+ }
}
},
"NoDefaultBookmarks": {
onProfileAfterChange(manager, param) {
if (param) {
manager.disallowFeature("defaultBookmarks");
}
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -374,16 +374,19 @@
"type": "object",
"properties": {
"Allow": {
"type": "array",
"items": {
"type": "origin"
}
+ },
+ "Default": {
+ "type": "boolean"
}
}
},
"NoDefaultBookmarks": {
"description": "Don't create the default bookmarks bundled with Firefox, nor the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.",
"first_available": "60.0",
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
@@ -96,16 +96,26 @@ const POLICIES_TESTS = [
"Certificates": {
"ImportEnterpriseRoots": true,
}
},
lockedPrefs: {
"security.enterprise_roots.enabled": true,
}
},
+ {
+ policies: {
+ "InstallAddons": {
+ "Default": false,
+ }
+ },
+ lockedPrefs: {
+ "xpinstall.enabled": false,
+ }
+ },
];
add_task(async function test_policy_remember_passwords() {
for (let test of POLICIES_TESTS) {
await setupPolicyEngineWithJson({
"policies": test.policies
});