From a1016b024116309a9a885264761c378ba0830d78 Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Tue, 3 Apr 2018 15:39:35 -0300 Subject: [PATCH] Bug 1429161 - Policy: Disable Forget Button. r=jaws --- .../components/customizableui/CustomizableWidgets.jsm | 1 + browser/components/enterprisepolicies/Policies.jsm | 8 ++++++++ .../enterprisepolicies/schemas/policies-schema.json | 7 +++++++ .../tests/browser/disable_forget_button/browser.ini | 7 +++++++ .../browser_policy_disable_forgetbutton.js | 9 +++++++++ .../browser/disable_forget_button/forget_button.json | 5 +++++ browser/components/enterprisepolicies/tests/moz.build | 1 + 7 files changed, 38 insertions(+) create mode 100644 browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser.ini create mode 100644 browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js create mode 100644 browser/components/enterprisepolicies/tests/browser/disable_forget_button/forget_button.json diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index 657c5db7b7cb..00a9eb23cea8 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -804,6 +804,7 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) { id: "panic-button", type: "view", viewId: "PanelUI-panicView", + disabled: !Services.policies.isAllowed("panicButton"), forgetButtonCalled(aEvent) { let doc = aEvent.target.ownerDocument; diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index 648fe96c6fba..dc7c152fcdff 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -257,6 +257,14 @@ var Policies = { } }, + "DisableForgetButton": { + onProfileAfterChange(manager, param) { + if (param) { + manager.disallowFeature("panicButton"); + } + } + }, + "DisableFormHistory": { onBeforeUIStartup(manager, param) { if (param) { diff --git a/browser/components/enterprisepolicies/schemas/policies-schema.json b/browser/components/enterprisepolicies/schemas/policies-schema.json index e825a764ca2a..d9dc834d17b4 100644 --- a/browser/components/enterprisepolicies/schemas/policies-schema.json +++ b/browser/components/enterprisepolicies/schemas/policies-schema.json @@ -206,6 +206,13 @@ "type": "boolean" }, + "DisableForgetButton": { + "description": "Prevents access to the \"Forget\" button.", + "first_available": "60.0", + + "type": "boolean" + }, + "DisableFormHistory": { "description": "Don't remember search and form history.", "first_available": "60.0", diff --git a/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser.ini b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser.ini new file mode 100644 index 000000000000..689f54987e2f --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser.ini @@ -0,0 +1,7 @@ +[DEFAULT] +prefs = + browser.policies.alternatePath='/browser/components/enterprisepolicies/tests/browser/disable_forget_button/forget_button.json' +support-files = + forget_button.json + +[browser_policy_disable_forgetbutton.js] diff --git a/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js new file mode 100644 index 000000000000..2e2b5d5bfd08 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js @@ -0,0 +1,9 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_policy_disable_forget_button() { + let widget = CustomizableUI.getWidget("panic-button"); + is(widget.disabled, true, "Forget Button is disabled"); +}); diff --git a/browser/components/enterprisepolicies/tests/browser/disable_forget_button/forget_button.json b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/forget_button.json new file mode 100644 index 000000000000..30baf64df407 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/forget_button.json @@ -0,0 +1,5 @@ +{ + "policies": { + "DisableForgetButton": true + } +} diff --git a/browser/components/enterprisepolicies/tests/moz.build b/browser/components/enterprisepolicies/tests/moz.build index a02315d22f69..45c3cbd52bf7 100644 --- a/browser/components/enterprisepolicies/tests/moz.build +++ b/browser/components/enterprisepolicies/tests/moz.build @@ -12,6 +12,7 @@ BROWSER_CHROME_MANIFESTS += [ 'browser/disable_app_update/browser.ini', 'browser/disable_default_bookmarks/browser.ini', 'browser/disable_developer_tools/browser.ini', + 'browser/disable_forget_button/browser.ini', 'browser/disable_fxscreenshots/browser.ini', ]