Backed out 2 changesets (bug 1892947) due to critical failure with clear on shutdown CLOSED TREE

Backed out changeset 5c4c36caa85d (bug 1892947)
Backed out changeset eeabe25b2ac3 (bug 1892947)
This commit is contained in:
Sandor Molnar 2024-05-03 19:56:31 +03:00
Родитель fc28f99fbb
Коммит 235e66e12a
4 изменённых файлов: 27 добавлений и 412 удалений

Просмотреть файл

@ -25,6 +25,18 @@ const CONTENT_BLOCKING_PREFS = [
"privacy.fingerprintingProtection.pbmode",
];
/*
* Prefs that are unique to sanitizeOnShutdown and are not shared
* with the deleteOnClose mechanism like privacy.clearOnShutdown.cookies, -cache and -offlineApps
*/
const SANITIZE_ON_SHUTDOWN_PREFS_ONLY = [
"privacy.clearOnShutdown.history",
"privacy.clearOnShutdown.downloads",
"privacy.clearOnShutdown.sessions",
"privacy.clearOnShutdown.formdata",
"privacy.clearOnShutdown.siteSettings",
];
const PREF_OPT_OUT_STUDIES_ENABLED = "app.shield.optoutstudies.enabled";
const PREF_NORMANDY_ENABLED = "app.normandy.enabled";
@ -80,34 +92,6 @@ ChromeUtils.defineESModuleGetters(this, {
DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
});
const SANITIZE_ON_SHUTDOWN_MAPPINGS = {
history: "privacy.clearOnShutdown.history",
downloads: "privacy.clearOnShutdown.downloads",
formdata: "privacy.clearOnShutdown.formdata",
sessions: "privacy.clearOnShutdown.sessions",
siteSettings: "privacy.clearOnShutdown.siteSettings",
cookies: "privacy.clearOnShutdown.cookies",
cache: "privacy.clearOnShutdown.cache",
offlineApps: "privacy.clearOnShutdown.offlineApps",
};
/*
* Prefs that are unique to sanitizeOnShutdown and are not shared
* with the deleteOnClose mechanism like privacy.clearOnShutdown.cookies, -cache and -offlineApps
*/
const SANITIZE_ON_SHUTDOWN_PREFS_ONLY = [
"privacy.clearOnShutdown.history",
"privacy.clearOnShutdown.downloads",
"privacy.clearOnShutdown.sessions",
"privacy.clearOnShutdown.formdata",
"privacy.clearOnShutdown.siteSettings",
];
const SANITIZE_ON_SHUTDOWN_PREFS_ONLY_V2 = [
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads",
"privacy.clearOnShutdown_v2.siteSettings",
];
Preferences.addAll([
// Content blocking / Tracking Protection
{ id: "privacy.trackingprotection.enabled", type: "bool" },
@ -171,20 +155,13 @@ Preferences.addAll([
{ id: "privacy.sanitize.sanitizeOnShutdown", type: "bool" },
{ id: "privacy.sanitize.timeSpan", type: "int" },
{ id: "privacy.clearOnShutdown.cookies", type: "bool" },
{ id: "privacy.clearOnShutdown_v2.cookiesAndStorage", type: "bool" },
{ id: "privacy.clearOnShutdown.cache", type: "bool" },
{ id: "privacy.clearOnShutdown_v2.cache", type: "bool" },
{ id: "privacy.clearOnShutdown.offlineApps", type: "bool" },
{ id: "privacy.clearOnShutdown.history", type: "bool" },
{
id: "privacy.clearOnShutdown_v2.historyFormDataAndDownloads",
type: "bool",
},
{ id: "privacy.clearOnShutdown.downloads", type: "bool" },
{ id: "privacy.clearOnShutdown.sessions", type: "bool" },
{ id: "privacy.clearOnShutdown.formdata", type: "bool" },
{ id: "privacy.clearOnShutdown.siteSettings", type: "bool" },
{ id: "privacy.clearOnShutdown_v2.siteSettings", type: "bool" },
// Do not track
{ id: "privacy.donottrackheader.enabled", type: "bool" },
@ -2117,25 +2094,11 @@ var gPrivacyPane = {
*/
initDeleteOnCloseBox() {
let deleteOnCloseBox = document.getElementById("deleteOnClose");
// We have to branch between the old clear on shutdown prefs and new prefs after the clear history revamp (Bug 1853996)
// Once the old dialog is deprecated, we can remove these branches.
let isCookiesAndStorageClearingOnShutdown;
if (useOldClearHistoryDialog) {
isCookiesAndStorageClearingOnShutdown =
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value &&
deleteOnCloseBox.checked =
(Preferences.get("privacy.sanitize.sanitizeOnShutdown").value &&
Preferences.get("privacy.clearOnShutdown.cookies").value &&
Preferences.get("privacy.clearOnShutdown.cache").value &&
Preferences.get("privacy.clearOnShutdown.offlineApps").value;
} else {
isCookiesAndStorageClearingOnShutdown =
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value &&
Preferences.get("privacy.clearOnShutdown_v2.cookiesAndStorage").value &&
Preferences.get("privacy.clearOnShutdown_v2.cache").value;
}
deleteOnCloseBox.checked =
isCookiesAndStorageClearingOnShutdown ||
Preferences.get("privacy.clearOnShutdown.offlineApps").value) ||
Preferences.get("browser.privatebrowsing.autostart").value;
},
@ -2148,17 +2111,12 @@ var gPrivacyPane = {
let sanitizeOnShutdownPref = Preferences.get(
"privacy.sanitize.sanitizeOnShutdown"
);
// ClearOnClose cleaning categories
let cookiePref = useOldClearHistoryDialog
? Preferences.get("privacy.clearOnShutdown.cookies")
: Preferences.get("privacy.clearOnShutdown_v2.cookiesAndStorage");
let cachePref = useOldClearHistoryDialog
? Preferences.get("privacy.clearOnShutdown.cache")
: Preferences.get("privacy.clearOnShutdown_v2.cache");
let offlineAppsPref = useOldClearHistoryDialog
? Preferences.get("privacy.clearOnShutdown.offlineApps")
: Preferences.get("privacy.clearOnShutdown_v2.cookiesAndStorage");
let cookiePref = Preferences.get("privacy.clearOnShutdown.cookies");
let cachePref = Preferences.get("privacy.clearOnShutdown.cache");
let offlineAppsPref = Preferences.get(
"privacy.clearOnShutdown.offlineApps"
);
// Sync the cleaning prefs with the deleteOnClose box
deleteOnCloseBox.addEventListener("command", () => {
@ -2198,32 +2156,18 @@ var gPrivacyPane = {
*/
_onSanitizePrefChangeSyncClearOnClose() {
let deleteOnCloseBox = document.getElementById("deleteOnClose");
// We have to branch between the old clear on shutdown prefs and new prefs after the clear history revamp (Bug 1853996)
// Once the old dialog is deprecated, we can remove these branches.
if (useOldClearHistoryDialog) {
deleteOnCloseBox.checked =
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value &&
Preferences.get("privacy.clearOnShutdown.cookies").value &&
Preferences.get("privacy.clearOnShutdown.cache").value &&
Preferences.get("privacy.clearOnShutdown.offlineApps").value;
} else {
deleteOnCloseBox.checked =
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value &&
Preferences.get("privacy.clearOnShutdown_v2.cookiesAndStorage").value &&
Preferences.get("privacy.clearOnShutdown_v2.cache").value;
}
deleteOnCloseBox.checked =
Preferences.get("privacy.clearOnShutdown.cookies").value &&
Preferences.get("privacy.clearOnShutdown.cache").value &&
Preferences.get("privacy.clearOnShutdown.offlineApps").value &&
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value;
},
/*
* Unsets cleaning prefs that do not belong to DeleteOnClose
*/
_resetCleaningPrefs() {
let sanitizeOnShutdownPrefsArray = useOldClearHistoryDialog
? SANITIZE_ON_SHUTDOWN_PREFS_ONLY
: SANITIZE_ON_SHUTDOWN_PREFS_ONLY_V2;
return sanitizeOnShutdownPrefsArray.forEach(
SANITIZE_ON_SHUTDOWN_PREFS_ONLY.forEach(
pref => (Preferences.get(pref).value = false)
);
},
@ -2232,11 +2176,7 @@ var gPrivacyPane = {
Checks if the user set cleaning prefs that do not belong to DeleteOnClose
*/
_isCustomCleaningPrefPresent() {
let sanitizeOnShutdownPrefsArray = useOldClearHistoryDialog
? SANITIZE_ON_SHUTDOWN_PREFS_ONLY
: SANITIZE_ON_SHUTDOWN_PREFS_ONLY_V2;
return sanitizeOnShutdownPrefsArray.some(
return SANITIZE_ON_SHUTDOWN_PREFS_ONLY.some(
pref => Preferences.get(pref).value
);
},

Просмотреть файл

@ -201,8 +201,6 @@ skip-if = ["true"]
["browser_privacy_syncDataClearing.js"]
["browser_privacy_syncDataClearing_v2.js"]
["browser_privacypane_2.js"]
["browser_privacypane_3.js"]

Просмотреть файл

@ -6,12 +6,6 @@
* the checkboxes "alwaysClear" and "deleteOnClose" should share the same state.
* The state of the cleaning categories cookies, cache and offlineApps should be in the state of the "deleteOnClose" box.
*/
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
set: [["privacy.sanitize.useOldClearHistoryDialog", true]],
});
});
add_task(async function test_syncWithoutCustomPrefs() {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,

Просмотреть файл

@ -1,317 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* With no custom cleaning categories set and sanitizeOnShutdown disabled,
* the checkboxes "alwaysClear" and "deleteOnClose" should share the same state.
* The state of the cleaning categories cookiesAndStorage and cache should be in the state of the "deleteOnClose" box.
*/
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown.cookies", true],
["privacy.sanitize.useOldClearHistoryDialog", false],
],
});
});
add_task(async function test_syncWithoutCustomPrefs() {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
let document = gBrowser.contentDocument;
let deleteOnCloseBox = document.getElementById("deleteOnClose");
let alwaysClearBox = document.getElementById("alwaysClear");
ok(!deleteOnCloseBox.checked, "DeleteOnClose initial state is deselected");
ok(!alwaysClearBox.checked, "AlwaysClear initial state is deselected");
deleteOnCloseBox.click();
ok(deleteOnCloseBox.checked, "DeleteOnClose is selected");
is(
deleteOnCloseBox.checked,
alwaysClearBox.checked,
"DeleteOnClose sets alwaysClear in the same state, selected"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cookiesAndStorage"),
"Cookie cleaning pref is set"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cache"),
"Cache cleaning pref is set"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown.cookies"),
"Old cookie cleaning pref is not changed"
);
ok(
!Services.prefs.getBoolPref(
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads"
),
"History cleaning pref is not set"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.siteSettings"),
"Site settings cleaning pref is not set"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown.siteSettings"),
"Old Site settings cleaning pref is not set"
);
deleteOnCloseBox.click();
ok(!deleteOnCloseBox.checked, "DeleteOnClose is deselected");
is(
deleteOnCloseBox.checked,
alwaysClearBox.checked,
"DeleteOnclose sets alwaysClear in the same state, deselected"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cookiesAndStorage"),
"Cookie cleaning pref is reset"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cache"),
"Cache cleaning pref is reset"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown.cookies"),
"Old cookie cleaning pref is not changed"
);
ok(
!Services.prefs.getBoolPref(
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads"
),
"History cleaning pref is not set"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.siteSettings"),
"Site settings cleaning pref is not set"
);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
Services.prefs.clearUserPref(
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads"
);
Services.prefs.clearUserPref("privacy.clearOnShutdown_v2.siteSettings");
Services.prefs.clearUserPref("privacy.clearOnShutdown_v2.cache");
Services.prefs.clearUserPref("privacy.clearOnShutdown_v2.cookiesAndStorage");
Services.prefs.clearUserPref("privacy.sanitize.sanitizeOnShutdown");
});
/*
* With custom cleaning category already set and SanitizeOnShutdown enabled,
* deselecting "deleteOnClose" should not change the state of "alwaysClear".
* The state of the cleaning categories cookiesAndStorage and cache should be in the state of the "deleteOnClose" box.
*/
add_task(async function test_syncWithCustomPrefs() {
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown_v2.historyFormDataAndDownloads", true],
["privacy.clearOnShutdown.history", false],
["privacy.clearOnShutdown_v2.siteSettings", true],
["privacy.sanitize.sanitizeOnShutdown", true],
],
});
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
let document = gBrowser.contentDocument;
let deleteOnCloseBox = document.getElementById("deleteOnClose");
let alwaysClearBox = document.getElementById("alwaysClear");
ok(deleteOnCloseBox.checked, "DeleteOnClose initial state is selected");
ok(alwaysClearBox.checked, "AlwaysClear initial state is selected");
is(
deleteOnCloseBox.checked,
alwaysClearBox.checked,
"AlwaysClear and deleteOnClose are in the same state, selected"
);
ok(
Services.prefs.getBoolPref(
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads"
),
"History cleaning pref is still set"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown.history"),
"Old history cleaning pref is not changed"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.siteSettings"),
"Site settings cleaning pref is still set"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cookiesAndStorage"),
"Cookie cleaning pref is set"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cache"),
"Cache cleaning pref is set"
);
deleteOnCloseBox.click();
ok(!deleteOnCloseBox.checked, "DeleteOnClose is deselected");
is(
!deleteOnCloseBox.checked,
alwaysClearBox.checked,
"AlwaysClear is not synced with deleteOnClose, only deleteOnClose is deselected"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cookiesAndStorage"),
"Cookie cleaning pref is reset"
);
ok(
!Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.cache"),
"Cache cleaning pref is reset"
);
ok(
Services.prefs.getBoolPref(
"privacy.clearOnShutdown_v2.historyFormDataAndDownloads"
),
"History cleaning pref is still set"
);
ok(
Services.prefs.getBoolPref("privacy.clearOnShutdown_v2.siteSettings"),
"Site settings cleaning pref is still set"
);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
await SpecialPowers.popPrefEnv();
});
/*
* Setting/resetting cleaning prefs for cookies, cache, offline apps
* and selecting/deselecting the "alwaysClear" Box, also selects/deselects
* the "deleteOnClose" box.
*/
add_task(async function test_syncWithCustomPrefs() {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
let document = gBrowser.contentDocument;
let deleteOnCloseBox = document.getElementById("deleteOnClose");
let alwaysClearBox = document.getElementById("alwaysClear");
ok(!deleteOnCloseBox.checked, "DeleteOnClose initial state is deselected");
ok(!alwaysClearBox.checked, "AlwaysClear initial state is deselected");
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown_v2.cookiesAndStorage", true],
["privacy.clearOnShutdown_v2.cache", true],
["privacy.sanitize.sanitizeOnShutdown", true],
],
});
ok(alwaysClearBox.checked, "AlwaysClear is selected");
is(
deleteOnCloseBox.checked,
alwaysClearBox.checked,
"AlwaysClear and deleteOnClose are in the same state, selected"
);
alwaysClearBox.click();
ok(!alwaysClearBox.checked, "AlwaysClear is deselected");
is(
deleteOnCloseBox.checked,
alwaysClearBox.checked,
"AlwaysClear and deleteOnClose are in the same state, deselected"
);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
await SpecialPowers.popPrefEnv();
});
/*
* On loading the page, the ClearOnClose box should be set according to the pref selection
*/
add_task(async function test_initialState() {
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown_v2.cookiesAndStorage", true],
["privacy.clearOnShutdown_v2.cache", true],
["privacy.sanitize.sanitizeOnShutdown", true],
],
});
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
let document = gBrowser.contentDocument;
let deleteOnCloseBox = document.getElementById("deleteOnClose");
ok(
deleteOnCloseBox.checked,
"DeleteOnClose is set accordingly to the prefs, selected"
);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown_v2.cookiesAndStorage", false],
["privacy.clearOnShutdown_v2.cache", false],
["privacy.sanitize.sanitizeOnShutdown", true],
["privacy.clearOnShutdown_v2.historyFormDataAndDownloads", true],
],
});
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
document = gBrowser.contentDocument;
deleteOnCloseBox = document.getElementById("deleteOnClose");
ok(
!deleteOnCloseBox.checked,
"DeleteOnClose is set accordingly to the prefs, deselected"
);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
// When private browsing mode autostart is selected, the deleteOnClose Box is selected always
await SpecialPowers.pushPrefEnv({
set: [
["privacy.clearOnShutdown_v2.cookiesAndStorage", false],
["privacy.clearOnShutdown_v2.cache", false],
["privacy.sanitize.sanitizeOnShutdown", false],
["browser.privatebrowsing.autostart", true],
],
});
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
leaveOpen: true,
});
document = gBrowser.contentDocument;
deleteOnCloseBox = document.getElementById("deleteOnClose");
ok(
deleteOnCloseBox.checked,
"DeleteOnClose is set accordingly to the private Browsing autostart pref, selected"
);
// Reset history mode
let historyMode = document.getElementById("historyMode");
historyMode.value = "remember";
historyMode.doCommand();
BrowserTestUtils.removeTab(gBrowser.selectedTab);
await SpecialPowers.popPrefEnv();
});