Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
const { _LastSession } = ChromeUtils.importESModule(
"resource:///modules/sessionstore/SessionStore.sys.mjs"
);
const state = {
windows: [
{
tabs: [
{
entries: [
{
triggeringPrincipal_base64: E10SUtils.SERIALIZED_SYSTEMPRINCIPAL,
},
],
},
],
selected: 1,
},
],
};
add_task(async function test_RESTORE_SESSION() {
let win = await BrowserTestUtils.openNewBrowserWindow();
await BrowserTestUtils.loadURIString({
browser: win.gBrowser.selectedBrowser,
uriString: "about:asrouter",
});
let tabCreated = BrowserTestUtils.waitForEvent(win, "TabOpen");
_LastSession.setState(state);
is(win.gBrowser.tabs.length, 1, "Number of tabs is 1");
await SMATestUtils.executeAndValidateAction({ type: "RESTORE_SESSION" });
info("validated");
await tabCreated;
info("all tabs restored");
is(win.gBrowser.tabs.length, 2, "Number of tabs is 2");
await BrowserTestUtils.closeWindow(win);
});