summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_pending_tabs.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/sessionstore/test/browser_pending_tabs.js
parentInitial commit. (diff)
downloadfirefox-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_pending_tabs.js')
-rw-r--r--browser/components/sessionstore/test/browser_pending_tabs.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_pending_tabs.js b/browser/components/sessionstore/test/browser_pending_tabs.js
new file mode 100644
index 0000000000..617cddf5e1
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_pending_tabs.js
@@ -0,0 +1,38 @@
+"use strict";
+
+const TAB_STATE = {
+ entries: [
+ { url: "about:mozilla", triggeringPrincipal_base64 },
+ { url: "about:robots", triggeringPrincipal_base64 },
+ ],
+ index: 1,
+};
+
+add_task(async function() {
+ // Create a background tab.
+ let tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
+ let browser = tab.linkedBrowser;
+ await promiseBrowserLoaded(browser);
+
+ // The tab shouldn't be restored right away.
+ Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
+
+ // Prepare the tab state.
+ let promise = promiseTabRestoring(tab);
+ ss.setTabState(tab, JSON.stringify(TAB_STATE));
+ ok(tab.hasAttribute("pending"), "tab is pending");
+ await promise;
+
+ // Flush to ensure the parent has all data.
+ await TabStateFlusher.flush(browser);
+
+ // Check that the shistory index is the one we restored.
+ let tabState = TabState.collect(tab, ss.getInternalObjectState(tab));
+ is(tabState.index, TAB_STATE.index, "correct shistory index");
+
+ // Check we don't collect userTypedValue when we shouldn't.
+ ok(!tabState.userTypedValue, "tab didn't have a userTypedValue");
+
+ // Cleanup.
+ gBrowser.removeTab(tab);
+});