Backed out 2 changesets (bug 1856415) for causing bc failures at browser/base/content/test/static/browser_all_files_referenced.js CLOSED TREE

Backed out changeset f5e458c049b9 (bug 1856415)
Backed out changeset ffd79f9e0881 (bug 1856415)
This commit is contained in:
Sandor Molnar 2023-12-11 20:20:33 +02:00
parent 589aedb5ba
commit 53a6546034
12 changed files with 53 additions and 941 deletions

View File

@ -1041,8 +1041,6 @@ pref("privacy.history.custom", false);
// 6 - Last 24 hours
pref("privacy.sanitize.timeSpan", 1);
pref("privacy.sanitize.useOldClearHistoryDialog", true);
pref("privacy.panicButton.enabled", true);
// Time until temporary permissions expire, in ms

View File

@ -9,19 +9,6 @@ var { Sanitizer } = ChromeUtils.importESModule(
"resource:///modules/Sanitizer.sys.mjs"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"USE_OLD_DIALOG",
"privacy.sanitize.useOldClearHistoryDialog",
false
);
Preferences.addAll([
{ id: "privacy.cpd.history", type: "bool" },
{ id: "privacy.cpd.formdata", type: "bool" },
@ -62,10 +49,7 @@ var gSanitizePromptDialog = {
}
let OKButton = this._dialog.getButton("accept");
let okButtonLabel = lazy.USE_OLD_DIALOG
? "sanitize-button-ok"
: "sanitize-button-ok2";
document.l10n.setAttributes(OKButton, okButtonLabel);
document.l10n.setAttributes(OKButton, "sanitize-button-ok");
document.addEventListener("dialogaccept", function (e) {
gSanitizePromptDialog.sanitize(e);
@ -76,12 +60,10 @@ var gSanitizePromptDialog = {
if (this.selectedTimespan === Sanitizer.TIMESPAN_EVERYTHING) {
this.prepareWarning();
this.warningBox.hidden = false;
if (lazy.USE_OLD_DIALOG) {
document.l10n.setAttributes(
document.documentElement,
"sanitize-dialog-title-everything"
);
}
document.l10n.setAttributes(
document.documentElement,
"sanitize-dialog-title-everything"
);
let warningDesc = document.getElementById("sanitizeEverythingWarning");
// Ensure we've translated and sized the warning.
await document.l10n.translateFragment(warningDesc);
@ -111,14 +93,10 @@ var gSanitizePromptDialog = {
warningBox.previousElementSibling.getBoundingClientRect().bottom;
window.resizeBy(0, diff);
}
if (lazy.USE_OLD_DIALOG) {
document.l10n.setAttributes(
document.documentElement,
"sanitize-dialog-title-everything"
);
}
document.l10n.setAttributes(
document.documentElement,
"sanitize-dialog-title-everything"
);
return;
}
@ -130,10 +108,10 @@ var gSanitizePromptDialog = {
window.resizeBy(0, -diff);
warningBox.hidden = true;
}
let datal1OnId = lazy.USE_OLD_DIALOG
? "sanitize-dialog-title"
: "sanitize-dialog-title2";
document.l10n.setAttributes(document.documentElement, datal1OnId);
document.l10n.setAttributes(
document.documentElement,
"sanitize-dialog-title"
);
},
sanitize(event) {
@ -186,14 +164,10 @@ var gSanitizePromptDialog = {
* Return the boolean prefs that correspond to the checkboxes on the dialog.
*/
_getItemPrefs() {
return Preferences.getAll().filter(pref => {
// The timespan pref isn't a bool, so don't return it
if (pref.id == "privacy.sanitize.timeSpan") {
return false;
}
// In the old dialog, cpd.downloads isn't controlled by a checkbox
return !(lazy.USE_OLD_DIALOG && pref.id == "privacy.cpd.downloads");
});
return Preferences.getAll().filter(
p =>
p.id !== "privacy.sanitize.timeSpan" && p.id !== "privacy.cpd.downloads"
);
},
/**
@ -229,25 +203,10 @@ var gSanitizePromptDialog = {
updatePrefs() {
Services.prefs.setIntPref(Sanitizer.PREF_TIMESPAN, this.selectedTimespan);
// Keep the pref for the download history in sync with the history pref.
let historyValue = Preferences.get("privacy.cpd.history").value;
if (lazy.USE_OLD_DIALOG) {
// Keep the pref for the download history in sync with the history pref.
Preferences.get("privacy.cpd.downloads").value = historyValue;
Services.prefs.setBoolPref("privacy.cpd.downloads", historyValue);
}
// Bug 1861450 - Create new prefs and categories in Sanitizer for the new dialog box
// We intend to migrate these into new prefs and categories
// sync the prefs for Form data, offline apps and sessions as they are merged
// into history and cookies for the new clear history dialog
else {
Preferences.get("privacy.cpd.formdata").value = historyValue;
let cookiesValue = Preferences.get("privacy.cpd.cookies").value;
// Keep the pref for the session history in sync with the cookies pref.
Preferences.get("privacy.cpd.sessions").value = cookiesValue;
Preferences.get("privacy.cpd.offlineApps").value = cookiesValue;
}
Preferences.get("privacy.cpd.downloads").value = historyValue;
Services.prefs.setBoolPref("privacy.cpd.downloads", historyValue);
// Now manually set the prefs from their corresponding preference
// elements.

View File

@ -13,7 +13,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
persist="lastSelected screenX screenY"
data-l10n-id="sanitize-dialog-title2"
data-l10n-id="sanitize-dialog-title"
data-l10n-attrs="style"
>
<dialog buttons="accept,cancel">
@ -31,10 +31,12 @@
rel="stylesheet"
href="chrome://browser/skin/sanitizeDialog.css"
/>
<html:link
rel="stylesheet"
href="chrome://browser/skin/sanitizeDialog_v2.css"
href="chrome://browser/content/sanitizeDialog.css"
/>
<html:link rel="localization" href="browser/sanitize.ftl" />
</linkset>
@ -43,7 +45,7 @@
<hbox id="SanitizeDurationBox" align="center">
<label
data-l10n-id="clear-time-duration-prefix2"
data-l10n-id="clear-time-duration-prefix"
control="sanitizeDurationChoice"
id="sanitizeDurationLabel"
/>
@ -96,61 +98,44 @@
</vbox>
<groupbox>
<hbox class="checkboxWithDescription">
<vbox>
<label><html:h2 data-l10n-id="history-section-label" /></label>
<hbox>
<vbox data-l10n-id="sanitize-prefs-style" data-l10n-attrs="style">
<checkbox
data-l10n-id="item-browsing-and-search"
data-l10n-id="item-history-and-downloads"
preference="privacy.cpd.history"
/>
</vbox>
</hbox>
<hbox class="checkboxWithDescription">
<vbox>
<checkbox
data-l10n-id="item-cookies-site-data"
data-l10n-id="item-active-logins"
preference="privacy.cpd.sessions"
/>
<checkbox
data-l10n-id="item-form-search-history"
preference="privacy.cpd.formdata"
/>
</vbox>
<vbox flex="1">
<checkbox
data-l10n-id="item-cookies"
preference="privacy.cpd.cookies"
aria-describedby="cookies-site-data-description"
/>
<description
class="sanitizeCheckboxDescription text-deemphasized"
data-l10n-id="item-cookies-site-data-description"
id="cookies-site-data-description"
/>
<checkbox data-l10n-id="item-cache" preference="privacy.cpd.cache" />
</vbox>
</hbox>
<hbox class="checkboxWithDescription">
<vbox>
</groupbox>
<groupbox>
<label><html:h2 data-l10n-id="data-section-label" /></label>
<hbox>
<vbox data-l10n-id="sanitize-prefs-style" data-l10n-attrs="style">
<checkbox
data-l10n-id="item-cached-content"
preference="privacy.cpd.cache"
aria-describedby="cached-content-description"
/>
<description
class="sanitizeCheckboxDescription text-deemphasized"
data-l10n-id="item-cached-content-description"
id="cached-content-description"
/>
</vbox>
</hbox>
<hbox class="checkboxWithDescription">
<vbox>
<checkbox
data-l10n-id="item-site-prefs"
data-l10n-id="item-site-settings"
preference="privacy.cpd.siteSettings"
aria-describedby="site-prefs-description"
/>
<description
class="sanitizeCheckboxDescription text-deemphasized"
data-l10n-id="item-site-prefs-description"
id="site-prefs-description"
/>
</vbox>
</hbox>
<hbox class="checkboxWithDescription">
<vbox>
<vbox flex="1">
<checkbox
data-l10n-id="item-download-history"
preference="privacy.cpd.downloads"
data-l10n-id="item-offline-apps"
preference="privacy.cpd.offlineApps"
/>
</vbox>
</hbox>

View File

@ -30,5 +30,3 @@ support-files = [
["browser_sanitize-timespans.js"]
["browser_sanitizeDialog.js"]
["browser_sanitizeDialog_v2.js"]

View File

@ -53,10 +53,6 @@ add_setup(async function () {
await blankSlate();
await PlacesTestUtils.promiseAsyncUpdates();
});
await SpecialPowers.pushPrefEnv({
set: [["privacy.sanitize.useOldClearHistoryDialog", true]],
});
});
/**

View File

@ -1,747 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Tests the sanitize dialog (a.k.a. the clear recent history dialog).
* See bug 480169.
*
* The purpose of this test is not to fully flex the sanitize timespan code;
* browser/base/content/test/sanitize/browser_sanitize-timespans.js does that. This
* test checks the UI of the dialog and makes sure it's correctly connected to
* the sanitize timespan code.
*
* Some of this code, especially the history creation parts, was taken from
* browser/base/content/test/sanitize/browser_sanitize-timespans.js.
*/
ChromeUtils.defineESModuleGetters(this, {
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
Timer: "resource://gre/modules/Timer.sys.mjs",
});
const kMsecPerMin = 60 * 1000;
const kUsecPerMin = 60 * 1000000;
let nowMsec = Date.now();
let nowUsec = nowMsec * 1000;
const EXAMPLE_ORIGIN = "https://www.example.com";
const siteUsage = 4096;
/**
* Ensures that the specified URIs are either cleared or not.
*
* @param aURIs
* Array of page URIs
* @param aShouldBeCleared
* True if each visit to the URI should be cleared, false otherwise
*/
async function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
for (let uri of aURIs) {
let visited = await PlacesUtils.history.hasVisits(uri);
Assert.equal(
visited,
!aShouldBeCleared,
`history visit ${uri.spec} should ${
aShouldBeCleared ? "no longer" : "still"
} exist`
);
}
}
/**
* Ensures that the given pref is the expected value.
*
* @param {String} aPrefName
* The pref's sub-branch under the privacy branch
* @param {Boolean} aExpectedVal
* The pref's expected value
* @param {String} aMsg
* Passed to is()
*/
function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
is(Services.prefs.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**
* Checks to see if the download with the specified path exists.
*
* @param aPath
* The path of the download to check
* @return True if the download exists, false otherwise
*/
async function downloadExists(aPath) {
let publicList = await Downloads.getList(Downloads.PUBLIC);
let listArray = await publicList.getAll();
return listArray.some(i => i.target.path == aPath);
}
/**
* Ensures that the specified downloads are either cleared or not.
*
* @param aDownloadIDs
* Array of download database IDs
* @param aShouldBeCleared
* True if each download should be cleared, false otherwise
*/
async function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
let niceStr = aShouldBeCleared ? "no longer" : "still";
for (let id of aDownloadIDs) {
is(
await downloadExists(id),
!aShouldBeCleared,
"download " + id + " should " + niceStr + " exist"
);
}
}
/**
* Checks if a form entry exists.
*/
async function formNameExists(name) {
return !!(await FormHistory.count({ fieldname: name }));
}
/**
* Adds a form entry to history.
*
* @param aMinutesAgo
* The entry will be added this many minutes ago
*/
function promiseAddFormEntryWithMinutesAgo(aMinutesAgo) {
let name = aMinutesAgo + "-minutes-ago";
// Artifically age the entry to the proper vintage.
let timestamp = nowUsec - aMinutesAgo * kUsecPerMin;
return FormHistory.update({
op: "add",
fieldname: name,
value: "dummy",
firstUsed: timestamp,
});
}
/**
* Adds a download to history.
*
* @param aMinutesAgo
* The download will be downloaded this many minutes ago
*/
async function addDownloadWithMinutesAgo(aExpectedPathList, aMinutesAgo) {
let publicList = await Downloads.getList(Downloads.PUBLIC);
let name = "fakefile-" + aMinutesAgo + "-minutes-ago";
let download = await Downloads.createDownload({
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
target: name,
});
download.startTime = new Date(nowMsec - aMinutesAgo * kMsecPerMin);
download.canceled = true;
publicList.add(download);
ok(
await downloadExists(name),
"Sanity check: download " + name + " should exist after creating it"
);
aExpectedPathList.push(name);
}
add_setup(async function () {
requestLongerTimeout(3);
await blankSlate();
registerCleanupFunction(async function () {
await blankSlate();
await PlacesTestUtils.promiseAsyncUpdates();
});
await SpecialPowers.pushPrefEnv({
set: [["privacy.sanitize.useOldClearHistoryDialog", false]],
});
});
/**
* Removes all history visits, downloads, and form entries.
*/
async function blankSlate() {
let publicList = await Downloads.getList(Downloads.PUBLIC);
let downloads = await publicList.getAll();
for (let download of downloads) {
await publicList.remove(download);
await download.finalize(true);
}
await FormHistory.update({ op: "remove" });
await PlacesUtils.history.clear();
}
/**
* This wraps the dialog and provides some convenience methods for interacting
* with it.
*
* @param browserWin (optional)
* The browser window that the dialog is expected to open in. If not
* supplied, the initial browser window of the test run is used.
*/
function DialogHelper(browserWin = window) {
this._browserWin = browserWin;
this.win = null;
this.promiseClosed = new Promise(resolve => {
this._resolveClosed = resolve;
});
}
DialogHelper.prototype = {
/**
* "Presses" the dialog's OK button.
*/
acceptDialog() {
let dialogEl = this.win.document.querySelector("dialog");
is(
dialogEl.getButton("accept").disabled,
false,
"Dialog's OK button should not be disabled"
);
dialogEl.acceptDialog();
},
/**
* "Presses" the dialog's Cancel button.
*/
cancelDialog() {
this.win.document.querySelector("dialog").cancelDialog();
},
/**
* (Un)checks a history scope checkbox (browser & download history,
* form history, etc.).
*
* @param aPrefName
* The final portion of the checkbox's privacy.cpd.* preference name
* @param aCheckState
* True if the checkbox should be checked, false otherwise
*/
checkPrefCheckbox(aPrefName, aCheckState) {
var pref = "privacy.cpd." + aPrefName;
var cb = this.win.document.querySelectorAll(
"checkbox[preference='" + pref + "']"
);
is(cb.length, 1, "found checkbox for " + pref + " preference");
if (cb[0].checked != aCheckState) {
cb[0].click();
}
},
/**
* Makes sure all the checkboxes are checked.
*/
_checkAllCheckboxesCustom(check) {
var cb = this.win.document.querySelectorAll("checkbox[preference]");
ok(cb.length > 1, "found checkboxes for preferences");
for (var i = 0; i < cb.length; ++i) {
var pref = this.win.Preferences.get(cb[i].getAttribute("preference"));
if (!!pref.value ^ check) {
cb[i].click();
}
}
},
checkAllCheckboxes() {
this._checkAllCheckboxesCustom(true);
},
uncheckAllCheckboxes() {
this._checkAllCheckboxesCustom(false);
},
/**
* @return The dialog's duration dropdown
*/
getDurationDropdown() {
return this.win.document.getElementById("sanitizeDurationChoice");
},
/**
* @return The clear-everything warning box
*/
getWarningPanel() {
return this.win.document.getElementById("sanitizeEverythingWarningBox");
},
/**
* @return True if the "Everything" warning panel is visible (as opposed to
* the tree)
*/
isWarningPanelVisible() {
return !this.getWarningPanel().hidden;
},
/**
* Opens the clear recent history dialog. Before calling this, set
* this.onload to a function to execute onload. It should close the dialog
* when done so that the tests may continue. Set this.onunload to a function
* to execute onunload. this.onunload is optional. If it returns true, the
* caller is expected to call promiseAsyncUpdates at some point; if false is
* returned, promiseAsyncUpdates is called automatically.
*/
async open() {
let dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(
null,
"chrome://browser/content/sanitize_v2.xhtml",
{
isSubDialog: true,
}
);
executeSoon(() => {
Sanitizer.showUI(this._browserWin);
});
this.win = await dialogPromise;
this.win.addEventListener(
"load",
() => {
// Run onload on next tick so that gSanitizePromptDialog.init can run first.
executeSoon(() => this.onload());
},
{ once: true }
);
this.win.addEventListener(
"unload",
() => {
// Some exceptions that reach here don't reach the test harness, but
// ok()/is() do...
(async () => {
if (this.onunload) {
await this.onunload();
}
await PlacesTestUtils.promiseAsyncUpdates();
this._resolveClosed();
this.win = null;
})();
},
{ once: true }
);
},
/**
* Selects a duration in the duration dropdown.
*
* @param aDurVal
* One of the Sanitizer.TIMESPAN_* values
*/
selectDuration(aDurVal) {
this.getDurationDropdown().value = aDurVal;
if (aDurVal === Sanitizer.TIMESPAN_EVERYTHING) {
is(
this.isWarningPanelVisible(),
true,
"Warning panel should be visible for TIMESPAN_EVERYTHING"
);
} else {
is(
this.isWarningPanelVisible(),
false,
"Warning panel should not be visible for non-TIMESPAN_EVERYTHING"
);
}
},
};
/**
* Ensures that the given pref is the expected value.
*
* @param aPrefName
* The pref's sub-branch under the privacy branch
* @param aExpectedVal
* The pref's expected value
* @param aMsg
* Passed to is()
*/
function intPrefIs(aPrefName, aExpectedVal, aMsg) {
is(Services.prefs.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**
* Creates a visit time.
*
* @param aMinutesAgo
* The visit will be visited this many minutes ago
*/
function visitTimeForMinutesAgo(aMinutesAgo) {
return nowUsec - aMinutesAgo * kUsecPerMin;
}
function promiseSanitizationComplete() {
return TestUtils.topicObserved("sanitizer-sanitization-complete");
}
/**
* Initializes the dialog to its default state.
*/
add_task(async function default_state() {
let dh = new DialogHelper();
dh.onload = function () {
// Select "Last Hour"
this.selectDuration(Sanitizer.TIMESPAN_HOUR);
this.acceptDialog();
};
dh.open();
await dh.promiseClosed;
});
/**
* Cancels the dialog, makes sure history not cleared.
*/
add_task(async function test_cancel() {
// Add history (within the past hour)
let uris = [];
let places = [];
let pURI;
for (let i = 0; i < 30; i++) {
pURI = makeURI("https://" + i + "-minutes-ago.com/");
places.push({ uri: pURI, visitDate: visitTimeForMinutesAgo(i) });
uris.push(pURI);
}
await PlacesTestUtils.addVisits(places);
let dh = new DialogHelper();
dh.onload = function () {
this.selectDuration(Sanitizer.TIMESPAN_HOUR);
this.checkPrefCheckbox("history", false);
this.cancelDialog();
};
dh.onunload = async function () {
await promiseHistoryClearedState(uris, false);
await blankSlate();
await promiseHistoryClearedState(uris, true);
};
dh.open();
await dh.promiseClosed;
});
/**
* Ensures that the "Everything" duration option works.
*/
add_task(async function test_everything() {
// Add history.
let uris = [];
let places = [];
let pURI;
// within past hour, within past two hours, within past four hours and
// outside past four hours
[10, 70, 130, 250].forEach(function (aValue) {
pURI = makeURI("https://" + aValue + "-minutes-ago.com/");
places.push({ uri: pURI, visitDate: visitTimeForMinutesAgo(aValue) });
uris.push(pURI);
});
let promiseSanitized = promiseSanitizationComplete();
await PlacesTestUtils.addVisits(places);
let dh = new DialogHelper();
dh.onload = function () {
is(
this.isWarningPanelVisible(),
false,
"Warning panel should be hidden after previously accepting dialog " +
"with a predefined timespan"
);
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
this.checkPrefCheckbox("history", true);
this.acceptDialog();
};
dh.onunload = async function () {
await promiseSanitized;
intPrefIs(
"sanitize.timeSpan",
Sanitizer.TIMESPAN_EVERYTHING,
"timeSpan pref should be everything after accepting dialog " +
"with everything selected"
);
await promiseHistoryClearedState(uris, true);
};
dh.open();
await dh.promiseClosed;
});
/**
* Ensures that the "Everything" warning is visible on dialog open after
* the previous test.
*/
add_task(async function test_everything_warning() {
// Add history.
let uris = [];
let places = [];
let pURI;
// within past hour, within past two hours, within past four hours and
// outside past four hours
[10, 70, 130, 250].forEach(function (aValue) {
pURI = makeURI("https://" + aValue + "-minutes-ago.com/");
places.push({ uri: pURI, visitDate: visitTimeForMinutesAgo(aValue) });
uris.push(pURI);
});
let promiseSanitized = promiseSanitizationComplete();
await PlacesTestUtils.addVisits(places);
let dh = new DialogHelper();
dh.onload = function () {
is(
this.isWarningPanelVisible(),
true,
"Warning panel should be visible after previously accepting dialog " +
"with clearing everything"
);
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
this.checkPrefCheckbox("history", true);
this.acceptDialog();
};
dh.onunload = async function () {
intPrefIs(
"sanitize.timeSpan",
Sanitizer.TIMESPAN_EVERYTHING,
"timeSpan pref should be everything after accepting dialog " +
"with everything selected"
);
await promiseSanitized;
await promiseHistoryClearedState(uris, true);
};
dh.open();
await dh.promiseClosed;
});
/**
* Checks if clearing history and downloads for the simple timespan
* behaves as expected
*/
add_task(async function test_history_downloads_checked() {
// Add downloads (within the past hour).
let downloadIDs = [];
for (let i = 0; i < 5; i++) {
await addDownloadWithMinutesAgo(downloadIDs, i);
}
// Add downloads (over an hour ago).
let olderDownloadIDs = [];
for (let i = 0; i < 5; i++) {
await addDownloadWithMinutesAgo(olderDownloadIDs, 61 + i);
}
// Add history (within the past hour).
let uris = [];
let places = [];
let pURI;
for (let i = 0; i < 30; i++) {
pURI = makeURI("https://" + i + "-minutes-ago.com/");
places.push({ uri: pURI, visitDate: visitTimeForMinutesAgo(i) });
uris.push(pURI);
}
// Add history (over an hour ago).
let olderURIs = [];
for (let i = 0; i < 5; i++) {
pURI = makeURI("https://" + (61 + i) + "-minutes-ago.com/");
places.push({ uri: pURI, visitDate: visitTimeForMinutesAgo(61 + i) });
olderURIs.push(pURI);
}
let promiseSanitized = promiseSanitizationComplete();
await PlacesTestUtils.addVisits(places);
let dh = new DialogHelper();
dh.onload = function () {
this.selectDuration(Sanitizer.TIMESPAN_HOUR);
this.checkPrefCheckbox("downloads", true);
this.checkPrefCheckbox("history", true);
this.acceptDialog();
};
dh.onunload = async function () {
intPrefIs(
"sanitize.timeSpan",
Sanitizer.TIMESPAN_HOUR,
"timeSpan pref should be hour after accepting dialog with " +
"hour selected"
);
boolPrefIs(
"cpd.history",
true,
"history pref should be true after accepting dialog with " +
"history checkbox checked"
);
boolPrefIs(
"cpd.downloads",
true,
"downloads pref should be true after accepting dialog with " +
"history checkbox checked"
);
await promiseSanitized;
// History visits and downloads within one hour should be cleared.
await promiseHistoryClearedState(uris, true);
await ensureDownloadsClearedState(downloadIDs, true);
// Visits and downloads > 1 hour should still exist.
await promiseHistoryClearedState(olderURIs, false);
await ensureDownloadsClearedState(olderDownloadIDs, false);
// OK, done, cleanup after ourselves.
await blankSlate();
await promiseHistoryClearedState(olderURIs, true);
await ensureDownloadsClearedState(olderDownloadIDs, true);
};
dh.open();
await dh.promiseClosed;
});
/**
* The next three tests checks that when a certain history item cannot be
* cleared then the checkbox should be both disabled and unchecked.
* In addition, we ensure that this behavior does not modify the preferences.
*/
add_task(async function test_cannot_clear_history() {
// Add form entries
let formEntries = [await promiseAddFormEntryWithMinutesAgo(10)];
let promiseSanitized = promiseSanitizationComplete();
// Add history.
let pURI = makeURI("https://" + 10 + "-minutes-ago.com/");
await PlacesTestUtils.addVisits({
uri: pURI,
visitDate: visitTimeForMinutesAgo(10),
});
let uris = [pURI];
let dh = new DialogHelper();
dh.onload = function () {
var cb = this.win.document.querySelectorAll(
"checkbox[preference='privacy.cpd.history']"
);
ok(
cb.length == 1 && !cb[0].disabled,
"There is history, checkbox to clear history should be enabled."
);
this.checkAllCheckboxes();
this.acceptDialog();
};
dh.onunload = async function () {
await promiseSanitized;
await promiseHistoryClearedState(uris, true);
let exists = await formNameExists(formEntries[0]);
ok(!exists, "form entry " + formEntries[0] + " should no longer exist");
};
dh.open();
await dh.promiseClosed;
});
add_task(async function test_no_formdata_history_to_clear() {
let promiseSanitized = promiseSanitizationComplete();
let dh = new DialogHelper();
dh.onload = function () {
boolPrefIs(
"cpd.history",
true,
"history pref should be true after accepting dialog with " +
"history checkbox checked"
);
var cb = this.win.document.querySelectorAll(
"checkbox[preference='privacy.cpd.history']"
);
ok(
cb.length == 1 && !cb[0].disabled && cb[0].checked,
"There is no history, but history checkbox should always be enabled " +
"and will be checked from previous preference."
);
this.acceptDialog();
};
dh.open();
await dh.promiseClosed;
await promiseSanitized;
});
add_task(async function test_form_entries() {
let formEntry = await promiseAddFormEntryWithMinutesAgo(10);
let promiseSanitized = promiseSanitizationComplete();
let dh = new DialogHelper();
dh.onload = function () {
var cb = this.win.document.querySelectorAll(
"checkbox[preference='privacy.cpd.history']"
);
is(cb.length, 1, "There is only one checkbox for history and form data");
ok(!cb[0].disabled, "The checkbox is enabled");
ok(cb[0].checked, "The checkbox is checked");
this.acceptDialog();
};
dh.onunload = async function () {
await promiseSanitized;
let exists = await formNameExists(formEntry);
ok(!exists, "form entry " + formEntry + " should no longer exist");
};
dh.open();
await dh.promiseClosed;
});
add_task(async function test_history_formdata() {
let promiseSanitized = promiseSanitizationComplete();
let dh = new DialogHelper();
dh.onload = function () {
this.uncheckAllCheckboxes();
this.checkPrefCheckbox("history", true);
this.acceptDialog();
};
dh.onunload = async function () {
await promiseSanitized;
// Check if form data follows history
boolPrefIs("cpd.formdata", true, `form data pref follows history pref`);
boolPrefIs("cpd.sessions", false, `sessions pref follows cookies prefs`);
boolPrefIs(
"cpd.offlineApps",
false,
`offlineapps pref follows cookies prefs`
);
};
dh.open();
await dh.promiseClosed;
});
add_task(async function test_cookies_sessions_offlineApps() {
let promiseSanitized = promiseSanitizationComplete();
let dh = new DialogHelper();
dh.onload = function () {
this.uncheckAllCheckboxes();
this.checkPrefCheckbox("cookies", true);
this.acceptDialog();
};
dh.onunload = async function () {
await promiseSanitized;
// Check if form data follows history
boolPrefIs("cpd.formdata", false, `form data pref follows history pref`);
boolPrefIs("cpd.sessions", true, `sessions pref follows cookies prefs`);
boolPrefIs(
"cpd.offlineApps",
true,
`offlineapps pref follows cookies prefs`
);
};
dh.open();
await dh.promiseClosed;
});

View File

@ -74,7 +74,6 @@ browser.jar:
content/browser/safeMode.js (content/safeMode.js)
content/browser/safeMode.xhtml (content/safeMode.xhtml)
content/browser/sanitize.xhtml (content/sanitize.xhtml)
content/browser/sanitize_v2.xhtml (content/sanitize_v2.xhtml)
content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
content/browser/tabbrowser.css (content/tabbrowser.css)

View File

@ -78,13 +78,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"useOldClearHistoryDialog",
"privacy.sanitize.useOldClearHistoryDialog",
false
);
ChromeUtils.defineESModuleGetters(this, {
DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
});
@ -2049,12 +2042,7 @@ var gPrivacyPane = {
ts.value = 0;
}
// Bug 1856418 We intend to remove the old dialog box
let dialogFile = useOldClearHistoryDialog
? "sanitize.xhtml"
: "sanitize_v2.xhtml";
gSubDialog.open(`chrome://browser/content/${dialogFile}`, {
gSubDialog.open("chrome://browser/content/sanitize.xhtml", {
features: "resizable=no",
closingCallback: () => {
// reset the timeSpan pref

View File

@ -9,10 +9,6 @@ sanitize-prefs2 =
sanitize-prefs-style =
.style = width: 17em
sanitize-dialog-title2 =
.title = Clear browsing data and cookies
.style = min-width: 34em
sanitize-dialog-title =
.title = Clear Recent History
.style = min-width: 34em
@ -37,10 +33,6 @@ clear-time-duration-prefix =
.value = Time range to clear:{ " " }
.accesskey = T
clear-time-duration-prefix2 =
.value = When:
.accesskey = W
clear-time-duration-value-last-hour =
.label = Last hour
@ -68,20 +60,10 @@ item-history-and-downloads =
.label = Browsing & download history
.accesskey = B
item-browsing-and-search =
.label = Visited sites, saved form info and searches
.accesskey = V
item-cookies =
.label = Cookies
.accesskey = C
item-cookies-site-data =
.label = Cookies and site data
.accesskey = e
item-cookies-site-data-description = May sign you out of sites or empty shopping carts
item-active-logins =
.label = Active logins
.accesskey = l
@ -90,26 +72,10 @@ item-cache =
.label = Cache
.accesskey = a
item-cached-content =
.label = Temporary cached files and pages
.accesskey = f
item-cached-content-description = Clears items that helps sites load faster
item-form-search-history =
.label = Form & search history
.accesskey = F
item-site-prefs =
.label = Site settings
.accesskey = i
item-site-prefs-description = Resets your permissions and site preferences to original settings
item-download-history =
.label = Downloaded files list
.accesskey = D
data-section-label = Data
item-site-settings =
@ -128,9 +94,6 @@ window-close =
sanitize-button-ok =
.label = Clear Now
sanitize-button-ok2 =
.label = Clear
# The label for the default button between the user clicking it and the window
# closing. Indicates the items are being cleared.
sanitize-button-clearing =

View File

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -16,13 +15,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
PrincipalsCollector: "resource://gre/modules/PrincipalsCollector.sys.mjs",
});
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"useOldClearHistoryDialog",
"privacy.sanitize.useOldClearHistoryDialog",
false
);
var logConsole;
function log(msg) {
if (!logConsole) {
@ -114,19 +106,14 @@ export var Sanitizer = {
) {
parentWindow = null;
}
let dialogFile = lazy.useOldClearHistoryDialog
? "sanitize.xhtml"
: "sanitize_v2.xhtml";
if (parentWindow?.gDialogBox) {
parentWindow.gDialogBox.open(`chrome://browser/content/${dialogFile}`, {
parentWindow.gDialogBox.open("chrome://browser/content/sanitize.xhtml", {
inBrowserWindow: true,
});
} else {
Services.ww.openWindow(
parentWindow,
`chrome://browser/content/${dialogFile}`,
"chrome://browser/content/sanitize.xhtml",
"Sanitize",
"chrome,titlebar,dialog,centerscreen,modal",
{ needNativeUI: true }

View File

@ -24,7 +24,6 @@
skin/classic/browser/menupanel.css (../shared/menupanel.css)
skin/classic/browser/notification-icons.css (../shared/notification-icons.css)
skin/classic/browser/pageInfo.css (../shared/pageInfo.css)
skin/classic/browser/sanitizeDialog_v2.css (../shared/sanitizeDialog_v2.css)
skin/classic/browser/searchbar.css (../shared/searchbar.css)
skin/classic/browser/setDesktopBackground.css (../shared/setDesktopBackground.css)
skin/classic/browser/sidebar.css (../shared/sidebar.css)

View File

@ -45,19 +45,6 @@
margin-inline: 4px;
}
.checkboxWithDescription {
padding: 8px 0;
}
.sanitizeCheckboxDescription {
padding: 0 24px;
line-height: normal;
}
#sanitizeDurationChoice {
margin-inline-end: 0;
}
dialog:not([inbrowserwindow]) #titleText {
display: none;
}