diff options
Diffstat (limited to 'browser/base/content/test/sanitize')
6 files changed, 72 insertions, 9 deletions
diff --git a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js index ada8286437..ff6badb535 100644 --- a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js +++ b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js @@ -15,10 +15,10 @@ function checkDataForAboutURL() { {} ); let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1); - request.onupgradeneeded = function (e) { + request.onupgradeneeded = function () { data = false; }; - request.onsuccess = function (e) { + request.onsuccess = function () { resolve(data); }; }); diff --git a/browser/base/content/test/sanitize/browser_sanitize-timespans.js b/browser/base/content/test/sanitize/browser_sanitize-timespans.js index f9be12775b..28b528d71f 100644 --- a/browser/base/content/test/sanitize/browser_sanitize-timespans.js +++ b/browser/base/content/test/sanitize/browser_sanitize-timespans.js @@ -20,7 +20,7 @@ function promiseFormHistoryRemoved() { function promiseDownloadRemoved(list) { return new Promise(resolve => { let view = { - onDownloadRemoved(download) { + onDownloadRemoved() { list.removeView(view); resolve(); }, diff --git a/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js b/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js index c732262a1a..067a651890 100644 --- a/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js +++ b/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js @@ -23,7 +23,7 @@ function promiseFormHistoryRemoved() { function promiseDownloadRemoved(list) { return new Promise(resolve => { let view = { - onDownloadRemoved(download) { + onDownloadRemoved() { list.removeView(view); resolve(); }, diff --git a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js index 8ae0263c82..ecdc5490d4 100644 --- a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js +++ b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js @@ -844,14 +844,14 @@ add_task(async function testLoadtimeTelemetry() { let loadTimeDistribution = Glean.privacySanitize.loadTime.testGetValue(); let expectedNumberOfCounts = Object.entries(EXPECTED_CONTEXT_COUNTS).reduce( - (acc, [key, value]) => acc + value, + (acc, [, value]) => acc + value, 0 ); // No guarantees from timers means no guarantees on buckets. // But we can guarantee it's only two samples. is( Object.entries(loadTimeDistribution.values).reduce( - (acc, [bucket, count]) => acc + count, + (acc, [, count]) => acc + count, 0 ), expectedNumberOfCounts, diff --git a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js index ccb3c7d519..736df32e81 100644 --- a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js +++ b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js @@ -10,6 +10,14 @@ ChromeUtils.defineESModuleGetters(this, { Sanitizer: "resource:///modules/Sanitizer.sys.mjs", }); +const LARGE_USAGE_NUM = 100000000000000000000000000000000000000000000000000; + +function isIframeOverflowing(win) { + return ( + win.scrollWidth > win.clientWidth || win.scrollHeight > win.clientHeight + ); +} + add_setup(async function () { await blankSlate(); registerCleanupFunction(async function () { @@ -275,7 +283,7 @@ add_task(async function testClearingBeforeDataSizesLoad() { info("stub called"); info("This promise should never resolve"); - await new Promise(resolve => {}); + await new Promise(() => {}); }); dh.onload = async function () { // we don't need to initiate a event listener to wait for the resolver to be assigned for this @@ -308,3 +316,58 @@ add_task(async function testClearingBeforeDataSizesLoad() { // Restore the sandbox after the test is complete sandbox.restore(); }); + +// tests the dialog resizing upon wrapping of text +// so that the clear buttons do not get cut out of the dialog. +add_task(async function testPossibleWrappingOfDialog() { + await blankSlate(); + + let dh = new ClearHistoryDialogHelper({ + checkingDataSizes: true, + }); + // Create a sandbox for isolated stubbing within the test + let sandbox = sinon.createSandbox(); + sandbox + .stub(SiteDataManager, "getQuotaUsageForTimeRanges") + .callsFake(async () => { + info("stubbed getQuotaUsageForTimeRanges called"); + + return { + TIMESPAN_HOUR: 0, + TIMESPAN_2HOURS: 0, + TIMESPAN_4HOURS: LARGE_USAGE_NUM, + TIMESPAN_TODAY: 0, + TIMESPAN_EVERYTHING: 0, + }; + }); + + dh.onload = async function () { + let windowObj = + window.browsingContext.topChromeWindow.gDialogBox._dialog._frame + .contentWindow; + let promise = new Promise(resolve => { + windowObj.addEventListener("resize", resolve); + }); + this.selectDuration(Sanitizer.TIMESPAN_4HOURS); + + await promise; + ok( + !isIframeOverflowing(windowObj.document.getElementById("SanitizeDialog")), + "There should be no overflow on wrapping in the dialog" + ); + + this.selectDuration(Sanitizer.TIMESPAN_2HOURS); + await promise; + ok( + !isIframeOverflowing(windowObj.document.getElementById("SanitizeDialog")), + "There should be no overflow on wrapping in the dialog" + ); + + this.cancelDialog(); + }; + dh.open(); + await dh.promiseClosed; + + // Restore the sandbox after the test is complete + sandbox.restore(); +}); diff --git a/browser/base/content/test/sanitize/head.js b/browser/base/content/test/sanitize/head.js index 30d96c69f6..1b41226fd1 100644 --- a/browser/base/content/test/sanitize/head.js +++ b/browser/base/content/test/sanitize/head.js @@ -49,10 +49,10 @@ function checkIndexedDB(host, originAttributes) { originAttributes ); let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1); - request.onupgradeneeded = function (e) { + request.onupgradeneeded = function () { data = false; }; - request.onsuccess = function (e) { + request.onsuccess = function () { resolve(data); }; }); |