Commit 0748631f authored by Michael Kaply's avatar Michael Kaply
Browse files

Bug 1545592 - Make SanitizeOnShutdown policy more granular. r=Felipe,flod

Differential Revision: https://phabricator.services.mozilla.com/D28145

--HG--
extra : moz-landing-system : lando
parent 241bdc39
......@@ -795,16 +795,56 @@ var Policies = {
"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);
setAndLockPref("privacy.clearOnShutdown.history", true);
setAndLockPref("privacy.clearOnShutdown.sessions", true);
setAndLockPref("privacy.clearOnShutdown.siteSettings", true);
setAndLockPref("privacy.clearOnShutdown.offlineApps", true);
if (typeof param === "boolean") {
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);
setAndLockPref("privacy.clearOnShutdown.history", true);
setAndLockPref("privacy.clearOnShutdown.sessions", true);
setAndLockPref("privacy.clearOnShutdown.siteSettings", true);
setAndLockPref("privacy.clearOnShutdown.offlineApps", true);
}
} else {
setAndLockPref("privacy.sanitize.sanitizeOnShutdown", true);
if ("Cache" in param) {
setAndLockPref("privacy.clearOnShutdown.cache", param.Cache);
} else {
setAndLockPref("privacy.clearOnShutdown.cache", false);
}
if ("Cookies" in param) {
setAndLockPref("privacy.clearOnShutdown.cookies", param.Cookies);
} else {
setAndLockPref("privacy.clearOnShutdown.cookies", false);
}
if ("Downloads" in param) {
setAndLockPref("privacy.clearOnShutdown.downloads", param.Downloads);
} else {
setAndLockPref("privacy.clearOnShutdown.downloads", false);
}
if ("FormData" in param) {
setAndLockPref("privacy.clearOnShutdown.formdata", param.FormData);
} else {
setAndLockPref("privacy.clearOnShutdown.formdata", false);
}
if ("History" in param) {
setAndLockPref("privacy.clearOnShutdown.history", param.History);
} else {
setAndLockPref("privacy.clearOnShutdown.history", false);
}
if ("Sessions" in param) {
setAndLockPref("privacy.clearOnShutdown.sessions", param.Sessions);
} else {
setAndLockPref("privacy.clearOnShutdown.sessions", false);
}
if ("SiteSettings" in param) {
setAndLockPref("privacy.clearOnShutdown.siteSettings", param.SiteSettings);
}
if ("OfflineApps" in param) {
setAndLockPref("privacy.clearOnShutdown.offlineApps", param.OfflineApps);
}
}
},
},
......
......@@ -230,6 +230,7 @@ function generateDocumentation() {
let string_mapping = {
"DisableSetDesktopBackground": "DisableSetAsDesktopBackground",
"Certificates": "CertificatesDescription",
"SanitizeOnShutdown": "SanitizeOnShutdown2",
};
for (let policyName in schema.properties) {
......
......@@ -656,7 +656,33 @@
},
"SanitizeOnShutdown": {
"type": "boolean"
"type": ["boolean", "object"],
"properties": {
"Cache": {
"type": "boolean"
},
"Cookies": {
"type": "boolean"
},
"Downloads": {
"type": "boolean"
},
"FormData": {
"type": "boolean"
},
"History": {
"type": "boolean"
},
"Sessions": {
"type": "boolean"
},
"SiteSettings": {
"type": "boolean"
},
"OfflineApps": {
"type": "boolean"
}
}
},
"SearchBar": {
......
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
......@@ -174,6 +175,144 @@ const POLICIES_TESTS = [
},
},
{
policies: {
"SanitizeOnShutdown": {
"Cache": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": true,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
},
},
{
policies: {
"SanitizeOnShutdown": {
"Cookies": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": true,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
},
},
{
policies: {
"SanitizeOnShutdown": {
"Downloads": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": true,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
},
},
{
policies: {
"SanitizeOnShutdown": {
"FormData": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": true,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
},
},
{
policies: {
"SanitizeOnShutdown": {
"History": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": true,
"privacy.clearOnShutdown.sessions": false,
},
},
{
policies: {
"SanitizeOnShutdown": {
"Sessions": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": true,
},
},
{
policies: {
"SanitizeOnShutdown": {
"SiteSettings": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
"privacy.clearOnShutdown.siteSettings": true,
},
},
{
policies: {
"SanitizeOnShutdown": {
"OfflineApps": true,
},
},
lockedPrefs: {
"privacy.sanitize.sanitizeOnShutdown": true,
"privacy.clearOnShutdown.cache": false,
"privacy.clearOnShutdown.cookies": false,
"privacy.clearOnShutdown.downloads": false,
"privacy.clearOnShutdown.formdata": false,
"privacy.clearOnShutdown.history": false,
"privacy.clearOnShutdown.sessions": false,
"privacy.clearOnShutdown.offlineApps": true,
},
},
// POLICY: DNSOverHTTPS Locked
{
policies: {
......@@ -290,7 +429,7 @@ const POLICIES_TESTS = [
},
];
add_task(async function test_policy_remember_passwords() {
add_task(async function test_policy_simple_prefs() {
for (let test of POLICIES_TESTS) {
await setupPolicyEngineWithJson({
"policies": test.policies,
......
......@@ -119,7 +119,7 @@ policy-Proxy = Configure proxy settings.
policy-RequestedLocales = Set the list of requested locales for the application in order of preference.
policy-SanitizeOnShutdown = Clear all navigation data on shutdown.
policy-SanitizeOnShutdown2 = Clear navigation data on shutdown.
policy-SearchBar = Set the default location of the search bar. The user is still allowed to customize it.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment