summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js')
-rw-r--r--browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js65
1 files changed, 64 insertions, 1 deletions
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();
+});