browser_sessionstore_ignore_dpip.js (1248B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const { TabStateFlusher } = ChromeUtils.importESModule( 7 "resource:///modules/sessionstore/TabStateFlusher.sys.mjs" 8 ); 9 10 add_task(async function check_document_pip_not_saved() { 11 const [tab, chromePiP] = await newTabWithPiP(); 12 13 await TabStateFlusher.flushWindow(window); 14 await TabStateFlusher.flushWindow(chromePiP); 15 let state = SessionStore.getCurrentState(true); 16 // Don't keepOnlyWorthSavingTabs as Ctrl+Shift+T can restore regardless of that 17 // and the about:blank in chromePiP might not be worth saving. 18 19 is(state.windows.length, 1, "Only one window in session store"); 20 21 // Just to be extra sure, check the only tracked window is for |tab| 22 const urls = state.windows[0].tabs 23 .flatMap(ssTab => ssTab.entries.map(entry => entry.url)) 24 .filter(url => !!url); 25 // |urls| contains an unexpected about:blank (bug 2006027). 26 // But if example.com is in there, the only tacked window is |tab| 27 ok( 28 urls.includes("https://example.com/"), 29 "Window tracked in sessionstore is tab not PiP" 30 ); 31 32 // Cleanup. 33 await BrowserTestUtils.closeWindow(chromePiP); 34 BrowserTestUtils.removeTab(tab); 35 });