From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../components/sessionstore/test/browser_480893.js | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 browser/components/sessionstore/test/browser_480893.js (limited to 'browser/components/sessionstore/test/browser_480893.js') diff --git a/browser/components/sessionstore/test/browser_480893.js b/browser/components/sessionstore/test/browser_480893.js new file mode 100644 index 0000000000..410f986d47 --- /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.loadURIString(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); +}); -- cgit v1.2.3