diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/base/content/test/general/browser_bug817947.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/general/browser_bug817947.js')
-rw-r--r-- | browser/base/content/test/general/browser_bug817947.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/browser/base/content/test/general/browser_bug817947.js b/browser/base/content/test/general/browser_bug817947.js new file mode 100644 index 0000000000..eba54aea5b --- /dev/null +++ b/browser/base/content/test/general/browser_bug817947.js @@ -0,0 +1,51 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +const URL = "http://mochi.test:8888/browser/"; +const PREF = "browser.sessionstore.restore_on_demand"; + +add_task(async () => { + Services.prefs.setBoolPref(PREF, true); + registerCleanupFunction(function () { + Services.prefs.clearUserPref(PREF); + }); + + let tab = await preparePendingTab(); + + let deferredTab = PromiseUtils.defer(); + + let win = gBrowser.replaceTabWithWindow(tab); + win.addEventListener( + "before-initial-tab-adopted", + async () => { + let [newTab] = win.gBrowser.tabs; + await BrowserTestUtils.browserLoaded(newTab.linkedBrowser); + deferredTab.resolve(newTab); + }, + { once: true } + ); + + let newTab = await deferredTab.promise; + is(newTab.linkedBrowser.currentURI.spec, URL, "correct url should be loaded"); + ok(!newTab.hasAttribute("pending"), "tab should not be pending"); + + win.close(); +}); + +async function preparePendingTab(aCallback) { + let tab = BrowserTestUtils.addTab(gBrowser, URL); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); + + let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab); + BrowserTestUtils.removeTab(tab); + await sessionUpdatePromise; + + let [{ state }] = SessionStore.getClosedTabDataForWindow(window); + + tab = BrowserTestUtils.addTab(gBrowser, "about:blank"); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); + SessionStore.setTabState(tab, JSON.stringify(state)); + ok(tab.hasAttribute("pending"), "tab should be pending"); + + return tab; +} |