diff options
Diffstat (limited to '')
-rw-r--r-- | dom/tests/browser/browser_alert_from_about_blank.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/dom/tests/browser/browser_alert_from_about_blank.js b/dom/tests/browser/browser_alert_from_about_blank.js new file mode 100644 index 0000000000..aa12dd1f7e --- /dev/null +++ b/dom/tests/browser/browser_alert_from_about_blank.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_check_alert_from_blank() { + await BrowserTestUtils.withNewTab( + "https://example.com/blank", + async browser => { + await SpecialPowers.spawn(browser, [], () => { + let button = content.document.createElement("button"); + button.addEventListener("click", () => { + let newWin = content.open( + "about:blank", + "", + "popup,width=600,height=600" + ); + newWin.alert("Alert from the popup."); + }); + content.document.body.append(button); + }); + let newWinPromise = BrowserTestUtils.waitForNewWindow(); + await BrowserTestUtils.synthesizeMouseAtCenter("button", {}, browser); + let otherWin = await newWinPromise; + Assert.equal( + otherWin.gBrowser.currentURI?.spec, + "about:blank", + "Should have opened about:blank" + ); + Assert.equal( + otherWin.menubar.visible, + false, + "Should be a popup window." + ); + let contentDialogManager = gBrowser + .getTabDialogBox(gBrowser.selectedBrowser) + .getContentDialogManager(); + todo_is(contentDialogManager._dialogs.length, 1, "Should have 1 dialog."); + await BrowserTestUtils.closeWindow(otherWin); + } + ); +}); |