diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/base/test/browser_bug1554070.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/browser_bug1554070.js')
-rw-r--r-- | dom/base/test/browser_bug1554070.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dom/base/test/browser_bug1554070.js b/dom/base/test/browser_bug1554070.js new file mode 100644 index 0000000000..342ed3c515 --- /dev/null +++ b/dom/base/test/browser_bug1554070.js @@ -0,0 +1,49 @@ +"use strict"; + +const HTTPS_TEST_ROOT = getRootDirectory(gTestPath).replace( + "chrome://mochitests/content", + "https://example.com" +); + +const URL0 = HTTPS_TEST_ROOT + "file_bug1554070_1.html"; +const URL1 = HTTPS_TEST_ROOT + "file_bug1554070_2.html"; +const URL2 = "https://example.org/"; + +add_task(async function() { + let tab = await BrowserTestUtils.openNewForegroundTab({ + gBrowser, + waitForLoad: true, + }); + + let browser = tab.linkedBrowser; + + function click() { + return SpecialPowers.spawn(browser, [], () => { + let anchor = content.document.querySelector("a"); + anchor.click(); + }); + } + + // Load file_bug1554070_1.html. + BrowserTestUtils.loadURI(browser, URL0); + await BrowserTestUtils.browserLoaded(browser, false, URL0); + is(gBrowser.currentURI.spec, URL0, "loaded file_bug1554070_1.html"); + + // Click the link in file_bug1554070_1.html. It should open + // file_bug1554070_2.html in the current tab. + await click(); + await BrowserTestUtils.browserLoaded(browser, false, URL1); + is(gBrowser.currentURI.spec, URL1, "loaded file_bug1554070_2.html"); + + // Click the link in file_bug1554070_2.html. It should open example.org in + // a new tab. + await Promise.all([ + click(), + BrowserTestUtils.waitForNewTab(gBrowser, URL2, true), + ]); + is(gBrowser.tabs.length, 3, "got new tab"); + is(gBrowser.currentURI.spec, URL2, "loaded example.org"); + + BrowserTestUtils.removeTab(gBrowser.selectedTab); + BrowserTestUtils.removeTab(tab); +}); |