browser_firefoxView_restore.js (1242B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const CLOSED_URI = "https://www.example.com/"; 7 8 add_task(async function test_TODO() { 9 let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, CLOSED_URI); 10 11 Assert.equal(gBrowser.tabs[0].linkedBrowser.currentURI.filePath, "blank"); 12 13 Assert.equal(gBrowser.tabs[1].linkedBrowser.currentURI.spec, CLOSED_URI); 14 15 Assert.equal(gBrowser.selectedTab, tab); 16 17 let state = ss.getCurrentState(true); 18 19 // SessionStore uses one-based indexes 20 Assert.equal(state.windows[0].selected, 2); 21 22 await EventUtils.synthesizeMouseAtCenter( 23 window.document.getElementById("firefox-view-button"), 24 { type: "mousedown" }, 25 window 26 ); 27 Assert.ok(window.FirefoxViewHandler.tab.selected); 28 29 Assert.equal(gBrowser.tabs[2], window.FirefoxViewHandler.tab); 30 31 state = ss.getCurrentState(true); 32 33 // The FxView tab doesn't get recorded in the session state, but if it's the last selected tab when a window is closed 34 // we want to point to the first tab in the tab strip upon restore 35 Assert.equal(state.windows[0].selected, 1); 36 37 gBrowser.removeTab(window.FirefoxViewHandler.tab); 38 gBrowser.removeTab(tab); 39 });