diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/sessionstore/test/browser_480893.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/sessionstore/test/browser_480893.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_480893.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_480893.js b/browser/components/sessionstore/test/browser_480893.js new file mode 100644 index 0000000000..3b2816da7d --- /dev/null +++ b/browser/components/sessionstore/test/browser_480893.js @@ -0,0 +1,45 @@ +"use strict"; + +/** + * Tests that we get sent to the right page when the user clicks + * the "Close" button in about:sessionrestore + */ +add_task(async function() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.startup.page", 0]], + }); + + let tab = BrowserTestUtils.addTab(gBrowser, "about:sessionrestore"); + gBrowser.selectedTab = tab; + let browser = tab.linkedBrowser; + await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore"); + + let doc = browser.contentDocument; + + // Click on the "Close" button after about:sessionrestore is loaded. + doc.getElementById("errorCancel").click(); + + await BrowserTestUtils.browserLoaded(browser, false, "about:blank"); + + // Test that starting a new session loads the homepage (set to http://mochi.test:8888) + // if Firefox is configured to display a homepage at startup (browser.startup.page = 1) + let homepage = "http://mochi.test:8888/"; + await SpecialPowers.pushPrefEnv({ + set: [ + ["browser.startup.homepage", homepage], + ["browser.startup.page", 1], + ], + }); + + BrowserTestUtils.loadURI(browser, "about:sessionrestore"); + await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore"); + doc = browser.contentDocument; + + // Click on the "Close" button after about:sessionrestore is loaded. + doc.getElementById("errorCancel").click(); + await BrowserTestUtils.browserLoaded(browser); + + is(browser.currentURI.spec, homepage, "loaded page is the homepage"); + + BrowserTestUtils.removeTab(tab); +}); |