Bug 1429144 - Policy: Don't remember search and form history. r=MattN
authorFelipe Gomes <felipc@gmail.com>
Wed, 07 Feb 2018 20:37:55 -0200
changeset 447373 5ee280615e4527c80642164d2d092bbaa36bd215
parent 447372 bbcf611ca8b93467a5fcee60be2589d5f6f9af88
child 447374 dff22255b582c72ad2a46f09d10b4410029a3e2a
push id135
push userfmarier@mozilla.com
push dateSat, 10 Feb 2018 02:56:15 +0000
reviewersMattN
bugs1429144
milestone60.0a1
Bug 1429144 - Policy: Don't remember search and form history. r=MattN MozReview-Commit-ID: GVHVe724dvv
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/browser/browser.ini
browser/components/enterprisepolicies/tests/browser/browser_policy_disable_formhistory.js
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -90,16 +90,24 @@ this.Policies = {
   "DisableFirefoxStudies": {
     onBeforeAddons(manager, param) {
       if (param == true) {
         manager.disallowFeature("Shield");
       }
     }
   },
 
+  "DisableFormHistory": {
+    onBeforeUIStartup(manager, param) {
+      if (param == true) {
+        setAndLockPref("browser.formfill.enable", false);
+      }
+    }
+  },
+
   "dont_check_default_browser": {
     onBeforeUIStartup(manager, param) {
       setAndLockPref("browser.shell.checkDefaultBrowser", false);
     }
   },
 
   "flash_plugin": {
     onBeforeUIStartup(manager, param) {
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -45,16 +45,24 @@
     "DisableFirefoxStudies": {
       "description": "Prevents Firefox from running studies.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
+    "DisableFormHistory": {
+      "description": "Don't remember search and form history.",
+      "first_available": "60.0",
+
+      "type": "boolean",
+      "enum": [true]
+    },
+
     "dont_check_default_browser": {
       "description": "Don't check for the default browser on startup.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
--- a/browser/components/enterprisepolicies/tests/browser/browser.ini
+++ b/browser/components/enterprisepolicies/tests/browser/browser.ini
@@ -10,11 +10,12 @@ support-files =
 [browser_policies_popups_cookies_addons_flash.js]
 [browser_policies_setAndLockPref_API.js]
 [browser_policies_simple_policies.js]
 [browser_policies_validate_and_parse_API.js]
 [browser_policy_block_set_desktop_background.js]
 [browser_policy_default_browser_check.js]
 [browser_policy_disable_fxscreenshots.js]
 [browser_policy_display_bookmarks.js]
+[browser_policy_disable_formhistory.js]
 [browser_policy_display_menu.js]
 [browser_policy_disable_shield.js]
 
new file mode 100644
--- /dev/null
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_formhistory.js
@@ -0,0 +1,15 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+add_task(async function test_policy_disable_formhistory() {
+  await setupPolicyEngineWithJson({
+    "policies": {
+      "DisableFormHistory": true
+    }
+  });
+
+  is(Services.prefs.getBoolPref("browser.formfill.enable"), false, "FormHistory has been disabled");
+  is(Services.prefs.prefIsLocked("browser.formfill.enable"), true, "FormHistory pref has been locked");
+});