Bug 1429161. Policy follow-up: hide instead of disabling the Forget button. r=jaws
MozReview-Commit-ID: Et9soguO5E7
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -799,17 +799,16 @@ if (AppConstants.platform == "win") {
}
CustomizableWidgets.push(preferencesButton);
if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
CustomizableWidgets.push({
id: "panic-button",
type: "view",
viewId: "PanelUI-panicView",
- disabled: !Services.policies.isAllowed("panicButton"),
forgetButtonCalled(aEvent) {
let doc = aEvent.target.ownerDocument;
let group = doc.getElementById("PanelUI-panic-timeSpan");
BrowserUITelemetry.countPanicEvent(group.selectedItem.id);
let itemsToClear = [
"cookies", "history", "openWindows", "formdata", "sessions", "cache", "downloads"
];
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -255,17 +255,17 @@ var Policies = {
manager.disallowFeature("Shield");
}
}
},
"DisableForgetButton": {
onProfileAfterChange(manager, param) {
if (param) {
- manager.disallowFeature("panicButton");
+ setAndLockPref("privacy.panicButton.enabled", false);
}
}
},
"DisableFormHistory": {
onBeforeUIStartup(manager, param) {
if (param) {
setAndLockPref("browser.formfill.enable", false);
--- 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
@@ -1,9 +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");
+ isnot(widget.type, "view", "Forget Button was not created");
});