summaryrefslogtreecommitdiffstats
path: root/toolkit/components/alerts/test/browser_bug1682866.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /toolkit/components/alerts/test/browser_bug1682866.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/alerts/test/browser_bug1682866.js')
-rw-r--r--toolkit/components/alerts/test/browser_bug1682866.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/toolkit/components/alerts/test/browser_bug1682866.js b/toolkit/components/alerts/test/browser_bug1682866.js
new file mode 100644
index 0000000000..24b8b6f7b8
--- /dev/null
+++ b/toolkit/components/alerts/test/browser_bug1682866.js
@@ -0,0 +1,56 @@
+const baseURL = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "http://example.com"
+);
+
+const alertURL = `${baseURL}file_bug1682866.html`;
+
+add_task(async function testAlertForceClosed() {
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ alertURL,
+ true /* waitForLoad */
+ );
+
+ // Open a second which is in the same process as tab
+ let secondTabIsLoaded = BrowserTestUtils.waitForNewTab(
+ gBrowser,
+ alertURL,
+ true,
+ false
+ );
+
+ let isSuspendedAfterAlert = await SpecialPowers.spawn(
+ tab.linkedBrowser.browsingContext,
+ [alertURL],
+ url => {
+ content.open(url);
+ var utils = SpecialPowers.getDOMWindowUtils(content);
+ return utils.isInputTaskManagerSuspended;
+ }
+ );
+
+ await secondTabIsLoaded;
+
+ let secondTab = gBrowser.tabs[2];
+
+ is(
+ isSuspendedAfterAlert,
+ Services.prefs.getBoolPref("dom.input_events.canSuspendInBCG.enabled"),
+ "InputTaskManager should be suspended because alert is opened"
+ );
+
+ let alertClosed = BrowserTestUtils.waitForEvent(
+ tab.linkedBrowser,
+ "DOMModalDialogClosed"
+ );
+
+ BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, "about:newtab");
+
+ await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+
+ await alertClosed;
+
+ gBrowser.removeTab(tab);
+ gBrowser.removeTab(secondTab);
+});