Bug 1452104 - Final tweaks to policy names and params. r=felipe draft
authorMichael Kaply <mozilla@kaply.com>
Fri, 06 Apr 2018 13:35:14 -0500
changeset 778704 1734abcbcb548feac6ccad32246e8ac99cd9cb03
parent 778675 0d661c592a164ca918ed12f87cbcf7f52c293359
push id105577
push usermozilla@kaply.com
push dateFri, 06 Apr 2018 20:34:06 +0000
reviewersfelipe
bugs1452104
milestone61.0a1
Bug 1452104 - Final tweaks to policy names and params. r=felipe MozReview-Commit-ID: CxxCqnyavfL
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js
browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js
browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -103,24 +103,16 @@ var Policies = {
   "BlockAboutSupport": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         manager.disallowFeature("about:support", true);
       }
     }
   },
 
-  "BlockSetDesktopBackground": {
-    onBeforeUIStartup(manager, param) {
-      if (param) {
-        manager.disallowFeature("setDesktopBackground", true);
-      }
-    }
-  },
-
   "Bookmarks": {
     onAllWindowsRestored(manager, param) {
       BookmarksPolicies.processBookmarks(param);
     }
   },
 
   "Certificates": {
     onBeforeAddons(manager, param) {
@@ -150,17 +142,17 @@ var Policies = {
         const REJECT_THIRD_PARTY_COOKIES = 1;
         const REJECT_ALL_COOKIES = 2;
         const REJECT_UNVISITED_THIRD_PARTY = 3;
 
         let newCookieBehavior = ACCEPT_COOKIES;
         if (param.Default !== undefined && !param.Default) {
           newCookieBehavior = REJECT_ALL_COOKIES;
         } else if (param.AcceptThirdParty) {
-          if (param.AcceptThirdParty == "none") {
+          if (param.AcceptThirdParty == "never") {
             newCookieBehavior = REJECT_THIRD_PARTY_COOKIES;
           } else if (param.AcceptThirdParty == "from-visited") {
             newCookieBehavior = REJECT_UNVISITED_THIRD_PARTY;
           }
         }
 
         if (param.Locked) {
           setAndLockPref("network.cookie.cookieBehavior", newCookieBehavior);
@@ -182,24 +174,16 @@ var Policies = {
           setAndLockPref("network.cookie.lifetimePolicy", newLifetimePolicy);
         } else {
           setDefaultPref("network.cookie.lifetimePolicy", newLifetimePolicy);
         }
       }
     }
   },
 
-  "CreateMasterPassword": {
-    onBeforeUIStartup(manager, param) {
-      if (!param) {
-        manager.disallowFeature("createMasterPassword");
-      }
-    }
-  },
-
   "DisableAppUpdate": {
     onBeforeAddons(manager, param) {
       if (param) {
         manager.disallowFeature("appUpdate");
       }
     }
   },
 
@@ -268,16 +252,24 @@ var Policies = {
   "DisableFormHistory": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         setAndLockPref("browser.formfill.enable", false);
       }
     }
   },
 
+  "DisableMasterPasswordCreation": {
+    onBeforeUIStartup(manager, param) {
+      if (param) {
+        manager.disallowFeature("createMasterPassword");
+      }
+    }
+  },
+
   "DisablePocket": {
     onBeforeAddons(manager, param) {
       if (param) {
         setAndLockPref("extensions.pocket.enabled", false);
       }
     }
   },
 
@@ -324,29 +316,38 @@ var Policies = {
       }
 
       if ("SafeBrowsing" in param) {
         setAndLockPref("browser.safebrowsing.allowOverride", !param.SafeBrowsing);
       }
     }
   },
 
-  "DisableSysAddonUpdate": {
+  "DisableSetDesktopBackground": {
+    onBeforeUIStartup(manager, param) {
+      if (param) {
+        manager.disallowFeature("setDesktopBackground", true);
+      }
+    }
+  },
+
+  "DisableSystemAddonUpdate": {
     onBeforeAddons(manager, param) {
       if (param) {
         manager.disallowFeature("SysAddonUpdate");
       }
     }
   },
 
   "DisableTelemetry": {
     onBeforeAddons(manager, param) {
       if (param) {
         setAndLockPref("datareporting.healthreport.uploadEnabled", false);
         setAndLockPref("datareporting.policy.dataSubmissionEnabled", false);
+        manager.disallowFeature("about:telemetry");
       }
     }
   },
 
   "DisplayBookmarksToolbar": {
     onBeforeUIStartup(manager, param) {
       let value = (!param).toString();
       // This policy is meant to change the default behavior, not to force it.
@@ -520,17 +521,17 @@ var Policies = {
         runOncePerModification("setHomepage", homepages, () => {
           Services.prefs.clearUserPref("browser.startup.homepage");
           Services.prefs.clearUserPref("browser.startup.page");
         });
       }
     }
   },
 
-  "InstallAddons": {
+  "InstallAddonsPermission": {
     onBeforeUIStartup(manager, param) {
       if ("Allow" in param) {
         addAllowDenyPermissions("install", param.Allow, null);
       }
       if ("Default" in param) {
         setAndLockPref("xpinstall.enabled", param.Default);
         if (!param.Default) {
           manager.disallowFeature("about:debugging");
@@ -542,16 +543,22 @@ var Policies = {
   "NoDefaultBookmarks": {
     onProfileAfterChange(manager, param) {
       if (param) {
         manager.disallowFeature("defaultBookmarks");
       }
     }
   },
 
+  "OfferToSaveLogins": {
+    onBeforeUIStartup(manager, param) {
+      setAndLockPref("signon.rememberSignons", param);
+    }
+  },
+
   "OverrideFirstRunPage": {
     onProfileAfterChange(manager, param) {
       let url = param ? param.spec : "";
       setAndLockPref("startup.homepage_welcome_url", url);
     }
   },
 
   "OverridePostUpdatePage": {
@@ -587,22 +594,16 @@ var Policies = {
         manager.disallowFeature("changeProxySettings");
         ProxyPolicies.configureProxySettings(param, setAndLockPref);
       } else {
         ProxyPolicies.configureProxySettings(param, setDefaultPref);
       }
     }
   },
 
-  "RememberPasswords": {
-    onBeforeUIStartup(manager, param) {
-      setAndLockPref("signon.rememberSignons", param);
-    }
-  },
-
   "SanitizeOnShutdown": {
     onBeforeUIStartup(manager, param) {
       setAndLockPref("privacy.sanitize.sanitizeOnShutdown", param);
       if (param) {
         setAndLockPref("privacy.clearOnShutdown.cache", true);
         setAndLockPref("privacy.clearOnShutdown.cookies", true);
         setAndLockPref("privacy.clearOnShutdown.downloads", true);
         setAndLockPref("privacy.clearOnShutdown.formdata", true);
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -53,23 +53,16 @@
 
     "BlockAboutSupport": {
       "description": "Blocks access to the about:support page.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
-    "BlockSetDesktopBackground": {
-      "description": "Prevents usage of the \"Set Image as Desktop Background\" feature.",
-      "first_available": "60.0",
-
-      "type": "boolean"
-    },
-
     "Bookmarks": {
       "description": "Allows the creation of bookmarks in the Bookmarks bar, Bookmarks menu, or a specified folder inside them.",
       "first_available": "60.0",
 
       "type": "array",
       "items": {
         "type": "object",
         "properties": {
@@ -94,17 +87,17 @@
             "type": "string"
           }
         },
         "required": ["Title", "URL"]
       }
     },
 
     "Certificates": {
-      "description": "Whether or not to use built in certs.",
+      "description": "Whether or not to use built in certs. This policy is Windows only at this time.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
         "ImportEnterpriseRoots": {
           "type": "boolean"
         }
       }
@@ -131,36 +124,29 @@
         },
 
         "Default": {
           "type": "boolean"
         },
 
         "AcceptThirdParty": {
           "type": "string",
-          "enum": ["all", "none", "from-visited"]
+          "enum": ["always", "never", "from-visited"]
         },
 
         "ExpireAtSessionEnd": {
           "type": "boolean"
         },
 
         "Locked": {
           "type": "boolean"
         }
       }
     },
 
-    "CreateMasterPassword": {
-      "description": "If false, removes access to create a master password.",
-      "first_available": "60.0",
-
-      "type": "boolean"
-    },
-
     "DisableAppUpdate": {
       "description": "Prevent the browser from updating.",
       "first_available": "60.0",
       "enterprise_only": true,
 
       "type": "boolean"
     },
 
@@ -215,16 +201,23 @@
 
     "DisableFormHistory": {
       "description": "Don't remember search and form history.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
+    "DisableMasterPasswordCreation": {
+      "description": "If true, removes access to create a master password.",
+      "first_available": "60.0",
+
+      "type": "boolean"
+    },
+
     "DisablePocket": {
       "description": "Prevents ability to save webpages to Pocket.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
     "DisablePrivateBrowsing": {
@@ -244,17 +237,17 @@
     "DisableProfileRefresh": {
       "description": "Disables the \"Refresh Firefox\" button in about:support",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
     "DisableSafeMode": {
-      "description": "Prevents ability to restart in safe mode.",
+      "description": "Prevents ability to restart in safe mode. You can only prevent the Shift key by using GPO on Windows.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
     "DisableSecurityBypass": {
       "description": "Prevents the user from bypassing certain security warnings.",
       "first_available": "60.0",
@@ -266,17 +259,24 @@
         },
 
         "SafeBrowsing": {
           "type": "boolean"
         }
       }
     },
 
-    "DisableSysAddonUpdate": {
+    "DisableSetDesktopBackground": {
+      "description": "Prevents usage of the \"Set Image as Desktop Background\" feature.",
+      "first_available": "60.0",
+
+      "type": "boolean"
+    },
+
+    "DisableSystemAddonUpdate": {
       "description": "Prevent the browser from installing and updating system addons.",
       "first_available": "60.0",
       "enterprise_only": true,
 
       "type": "boolean"
     },
 
     "DisableTelemetry": {
@@ -400,18 +400,18 @@
           "items": {
             "type": "URL"
           }
         }
       },
       "required": ["URL"]
     },
 
-    "InstallAddons": {
-      "description": "Allow or deny popup websites to install webextensions.",
+    "InstallAddonsPermission": {
+      "description": "Allow webites to install add-ons.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
         "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
@@ -425,16 +425,23 @@
 
     "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",
 
       "type": "boolean"
     },
 
+    "OfferToSaveLogins": {
+      "description": "Enforces the setting to allow Firefox to offer to remember saved logins and passwords. Both true and false values are accepted.",
+      "first_available": "60.0",
+
+      "type": "boolean"
+    },
+
     "OverrideFirstRunPage": {
       "description": "Override the first run page. Set this policy to blank if you want to disable the first run page.",
       "first_available": "60.0",
       "enterprise_only": true,
 
       "type": "URLorEmpty"
     },
 
@@ -522,23 +529,16 @@
         },
 
         "AutoLogin": {
           "type": "boolean"
         }
       }
     },
 
-    "RememberPasswords": {
-      "description": "Enforces the setting to allow Firefox to remember saved logins and passwords. Both true and false values are accepted.",
-      "first_available": "60.0",
-
-      "type": "boolean"
-    },
-
     "SanitizeOnShutdown": {
       "description": "Clears ALL browser data on shutdown.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
     "SearchBar": {
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
@@ -26,21 +26,21 @@ const POLICIES_TESTS = [
    *
    *   // Unlocked prefs to check
    *   unlockedPrefs: { "bar.baz": 42 }
    * },
    */
 
    // POLICY: RememberPasswords
   {
-    policies: { "RememberPasswords": false },
+    policies: { "OfferToSaveLogins": false },
     lockedPrefs: { "signon.rememberSignons": false },
   },
   {
-    policies: { "RememberPasswords": true },
+    policies: { "OfferToSaveLogins": true },
     lockedPrefs: { "signon.rememberSignons": true },
   },
 
   // POLICY: DisableSecurityBypass
   {
     policies: {
       "DisableSecurityBypass": {
         "InvalidCertificate": true,
@@ -117,17 +117,17 @@ const POLICIES_TESTS = [
     lockedPrefs: {
       "security.enterprise_roots.enabled": true,
     }
   },
 
   // POLICY: InstallAddons.Default (block addon installs)
   {
     policies: {
-      "InstallAddons": {
+      "InstallAddonsPermission": {
         "Default": false,
       }
     },
     lockedPrefs: {
       "xpinstall.enabled": false,
     }
   },
 
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 add_task(async function setup() {
   await setupPolicyEngineWithJson({
     "policies": {
-      "BlockSetDesktopBackground": true
+      "DisableSetDesktopBackground": true
     }
   });
 });
 
 add_task(async function test_check_set_desktop_background() {
   const imageUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gwMDAsTBZbkNwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABNElEQVQ4y8WSsU0DURBE3yyWIaAJaqAAN4DPSL6AlIACKIEOyJEgRsIgOOkiInJqgAKowNg7BHdn7MOksNl+zZ//dvbDf5cAiklp22BdVtXdeTEpDYDB9m1VzU6OJuVp2NdEQCaI96fH2YHG4+mDduKYNMYINTcjcGbXzQVDEAphG0k48zUsajIbnAiMIXThpW8EICE0RAK4dvoKg9NIcTiQ589otyHOZLnwqK5nLwBFUZ4igc3iM0d1ff8CMC6mZ6Ihiaqq3gi1aUAnArD00SW1fq5OLBg0ymYmSZsR2/t4e/rGyCLW0sbp3oq+yTYqVgytQWui2FS7XYF7GFprY921T4CNQt8zr47dNzCkIX7y/jBtH+v+RGMQrc828W8pApnZbmEVQp/Ae7BlOy2ttib81/UFc+WRWEbjckIAAAAASUVORK5CYII=";
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, imageUrl, true);
 
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_cookie_settings.js
@@ -127,17 +127,17 @@ add_task(async function test_disabled() 
   });
   restore_prefs();
 });
 
 add_task(async function test_third_party_disabled() {
   await setupPolicyEngineWithJson({
     "policies": {
       "Cookies": {
-        "AcceptThirdParty": "none"
+        "AcceptThirdParty": "never"
       }
     }
   });
 
   await test_cookie_settings({
     cookiesEnabled: true,
     thirdPartyCookiesEnabled: false,
     cookiesExpireAfterSession: false,
@@ -146,17 +146,17 @@ add_task(async function test_third_party
   restore_prefs();
 });
 
 add_task(async function test_disabled_and_third_party_disabled() {
   await setupPolicyEngineWithJson({
     "policies": {
       "Cookies": {
         "Default": false,
-        "AcceptThirdParty": "none"
+        "AcceptThirdParty": "never"
       }
     }
   });
 
   await test_cookie_settings({
     cookiesEnabled: false,
     thirdPartyCookiesEnabled: false,
     cookiesExpireAfterSession: false,
@@ -165,17 +165,17 @@ add_task(async function test_disabled_an
   restore_prefs();
 });
 
 add_task(async function test_disabled_and_third_party_disabled_locked() {
   await setupPolicyEngineWithJson({
     "policies": {
       "Cookies": {
         "Default": false,
-        "AcceptThirdParty": "none",
+        "AcceptThirdParty": "never",
         "Locked": true
       }
     }
   });
 
   await test_cookie_settings({
     cookiesEnabled: false,
     thirdPartyCookiesEnabled: false,
@@ -240,17 +240,17 @@ add_task(async function test_cookie_expi
   restore_prefs();
 });
 
 add_task(async function test_disabled_cookie_expire_locked() {
   await setupPolicyEngineWithJson({
     "policies": {
       "Cookies": {
         "Default": false,
-        "AcceptThirdParty": "none",
+        "AcceptThirdParty": "never",
         "ExpireAtSessionEnd": true,
         "Locked": true
       }
     }
   });
 
   await test_cookie_settings({
     cookiesEnabled: false,
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js
@@ -48,21 +48,21 @@ add_task(async function test_policy_disa
 
   // No password and no policy: access to setting a master password
   // should be enabled.
   await checkDeviceManager({buttonIsDisabled: false});
   await checkAboutPreferences({checkboxIsDisabled: false});
 
   await setupPolicyEngineWithJson({
     "policies": {
-      "CreateMasterPassword": false
+      "DisableMasterPasswordCreation": true
     }
   });
 
-  // With the `CreateMasterPassword: false` policy active, the
+  // With the `DisableMasterPasswordCreation: true` policy active, the
   // UI entry points for creating a Master Password should be disabled.
   await checkDeviceManager({buttonIsDisabled: true});
   await checkAboutPreferences({checkboxIsDisabled: true});
 
   mpToken.changePassword("", MASTER_PASSWORD);
   ok(mpToken.hasPassword, "Master password was set");
 
   // If a Master Password is already set, there's no point in disabling
--- a/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
+++ b/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
@@ -14,17 +14,17 @@
       ],
 
       "Block": [
         "https://www.deny.com",
         "https://www.pre-existing-allow.com"
       ]
     },
 
-    "InstallAddons": {
+    "InstallAddonsPermission": {
       "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ]
     },
 
     "FlashPlugin": {
       "Allow": [
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_enterprisepolicy.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 // This test verifies that system addon updates are correctly blocked by the
-// DisableSysAddonUpdate enterprise policy.
+// DisableSystemAddonUpdate enterprise policy.
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 ChromeUtils.import("resource://testing-common/EnterprisePolicyTesting.jsm");
 
 // Setting PREF_DISABLE_SECURITY tells the policy engine that we are in testing
 // mode and enables restarting the policy engine without restarting the browser.
 Services.prefs.setBoolPref(PREF_DISABLE_SECURITY, true);
 registerCleanupFunction(() => {
@@ -56,17 +56,17 @@ const TEST_CONDITIONS = {
   ],
 };
 
 add_task(async function test_update_disabled_by_policy() {
   await setupSystemAddonConditions(TEST_CONDITIONS, distroDir);
 
   await EnterprisePolicyTesting.setupPolicyEngineWithJson({
     "policies": {
-      "DisableSysAddonUpdate": true
+      "DisableSystemAddonUpdate": true
     }
   });
 
   await updateAllSystemAddons(await buildSystemAddonUpdates([
     { id: "system2@tests.mozilla.org", version: "2.0", path: "system2_2.xpi" },
     { id: "system3@tests.mozilla.org", version: "2.0", path: "system3_2.xpi" }
   ], root), testserver);