From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../test/SessionStoreTestUtils.sys.mjs | 4 +- browser/components/sessionstore/test/browser.toml | 268 +----------------- .../test/browser_354894_perwindowpb.js | 10 +- .../sessionstore/test/browser_394759_basic.js | 2 +- .../sessionstore/test/browser_394759_behavior.js | 16 +- .../sessionstore/test/browser_394759_purge.js | 2 +- .../components/sessionstore/test/browser_459906.js | 4 +- .../components/sessionstore/test/browser_461743.js | 2 +- .../components/sessionstore/test/browser_464199.js | 2 +- .../sessionstore/test/browser_464620_a.js | 2 +- .../sessionstore/test/browser_464620_b.js | 2 +- .../components/sessionstore/test/browser_526613.js | 2 +- .../components/sessionstore/test/browser_580512.js | 6 +- .../sessionstore/test/browser_586068-apptabs.js | 7 +- .../browser_586068-browser_state_interrupted.js | 9 +- .../test/browser_586068-multi_window.js | 9 +- .../test/browser_586068-window_state.js | 7 +- .../test/browser_586068-window_state_override.js | 7 +- .../components/sessionstore/test/browser_589246.js | 12 +- .../components/sessionstore/test/browser_590268.js | 2 +- ...ser_615394-SSWindowState_events_duplicateTab.js | 4 +- ..._615394-SSWindowState_events_setBrowserState.js | 2 +- ...wser_615394-SSWindowState_events_setTabState.js | 6 +- ...r_615394-SSWindowState_events_setWindowState.js | 6 +- ...ser_615394-SSWindowState_events_undoCloseTab.js | 4 +- ..._615394-SSWindowState_events_undoCloseWindow.js | 8 +- .../components/sessionstore/test/browser_618151.js | 2 +- .../components/sessionstore/test/browser_636279.js | 2 +- .../components/sessionstore/test/browser_645428.js | 2 +- .../sessionstore/test/browser_687710_2.js | 66 ++--- .../components/sessionstore/test/browser_705597.js | 10 +- .../components/sessionstore/test/browser_707862.js | 20 +- .../components/sessionstore/test/browser_739531.js | 2 +- .../sessionstore/test/browser_async_flushes.js | 52 ---- .../sessionstore/test/browser_async_remove_tab.js | 30 +- .../test/browser_async_window_flushing.js | 11 +- .../sessionstore/test/browser_attributes.js | 59 ++-- .../sessionstore/test/browser_bfcache_telemetry.js | 3 +- .../test/browser_closed_tabs_closed_windows.js | 10 - .../sessionstore/test/browser_cookies.js | 2 +- .../sessionstore/test/browser_crashedTabs.js | 2 +- .../test/browser_docshell_uuid_consistency.js | 94 ++----- .../sessionstore/test/browser_frame_history.js | 2 +- .../sessionstore/test/browser_frametree.js | 2 +- .../sessionstore/test/browser_history_persist.js | 138 +++------- .../test/browser_newtab_userTypedValue.js | 4 +- .../sessionstore/test/browser_oldformat.toml | 301 +++++++++++++++++++++ .../test/browser_parentProcessRestoreHash.js | 4 +- ...rowser_restoreLastClosedTabOrWindowOrSession.js | 2 +- .../test/browser_send_async_message_oom.js | 75 ----- .../sessionstore/test/browser_sessionHistory.js | 9 +- .../test/browser_sessionStoreContainer.js | 2 +- .../test/browser_should_restore_tab.js | 4 +- .../test/browser_windowStateContainer.js | 2 +- browser/components/sessionstore/test/head.js | 49 +--- 55 files changed, 523 insertions(+), 843 deletions(-) create mode 100644 browser/components/sessionstore/test/browser_oldformat.toml delete mode 100644 browser/components/sessionstore/test/browser_send_async_message_oom.js (limited to 'browser/components/sessionstore/test') diff --git a/browser/components/sessionstore/test/SessionStoreTestUtils.sys.mjs b/browser/components/sessionstore/test/SessionStoreTestUtils.sys.mjs index dd2885cee4..eecb1240e2 100644 --- a/browser/components/sessionstore/test/SessionStoreTestUtils.sys.mjs +++ b/browser/components/sessionstore/test/SessionStoreTestUtils.sys.mjs @@ -100,7 +100,7 @@ export var SessionStoreTestUtils = { expectedTabsRestored = aState.windows.length; } - function onSSTabRestored(aEvent) { + function onSSTabRestored() { if (++tabsRestored == expectedTabsRestored) { // Remove the event listener from each window windows.forEach(function (win) { @@ -118,7 +118,7 @@ export var SessionStoreTestUtils = { // Used to add our listener to further windows so we can catch SSTabRestored // coming from them when creating a multi-window state. - function windowObserver(aSubject, aTopic, aData) { + function windowObserver(aSubject, aTopic) { if (aTopic == "domwindowopened") { let newWindow = aSubject; newWindow.addEventListener( diff --git a/browser/components/sessionstore/test/browser.toml b/browser/components/sessionstore/test/browser.toml index 26fb4b4550..7d5b407d22 100644 --- a/browser/components/sessionstore/test/browser.toml +++ b/browser/components/sessionstore/test/browser.toml @@ -22,30 +22,11 @@ support-files = [ "browser_scrollPositions_readerModeArticle.html", "browser_sessionStorage.html", "browser_speculative_connect.html", - "browser_248970_b_sample.html", - "browser_339445_sample.html", - "browser_423132_sample.html", - "browser_447951_sample.html", - "browser_454908_sample.html", - "browser_456342_sample.xhtml", - "browser_463205_sample.html", - "browser_463206_sample.html", - "browser_466937_sample.html", - "browser_485482_sample.html", - "browser_637020_slow.sjs", - "browser_662743_sample.html", - "browser_739531_sample.html", - "browser_739531_frame.html", - "browser_911547_sample.html", - "browser_911547_sample.html^headers^", "coopHeaderCommon.sjs", "restore_redirect_http.html", "restore_redirect_http.html^headers^", "restore_redirect_js.html", "restore_redirect_target.html", - "browser_1234021_page.html", - "browser_1284886_suspend_tab.html", - "browser_1284886_suspend_tab_2.html", "empty.html", "coop_coep.html", "coop_coep.html^headers^", @@ -58,248 +39,6 @@ prefs = [ "browser.sessionstore.closedTabsFromClosedWindows=true", ] -#NB: the following are disabled -# browser_464620_a.html -# browser_464620_b.html -# browser_464620_xd.html - -#disabled-for-intermittent-failures--bug-766044, browser_459906_empty.html -#disabled-for-intermittent-failures--bug-766044, browser_459906_sample.html -#disabled-for-intermittent-failures--bug-765389, browser_461743_sample.html - -["browser_1234021.js"] - -["browser_1284886_suspend_tab.js"] - -["browser_1446343-windowsize.js"] -skip-if = ["os == 'linux'"] # Bug 1600180 - -["browser_248970_b_perwindowpb.js"] -# Disabled because of leaks. -# Re-enabling and rewriting this test is tracked in bug 936919. -skip-if = ["true"] - -["browser_339445.js"] - -["browser_345898.js"] - -["browser_350525.js"] - -["browser_354894_perwindowpb.js"] - -["browser_367052.js"] - -["browser_393716.js"] -skip-if = ["debug"] # Bug 1507747 - -["browser_394759_basic.js"] -# Disabled for intermittent failures, bug 944372. -skip-if = ["true"] - -["browser_394759_behavior.js"] -https_first_disabled = true - -["browser_394759_perwindowpb.js"] - -["browser_394759_purge.js"] - -["browser_423132.js"] - -["browser_447951.js"] - -["browser_454908.js"] - -["browser_456342.js"] - -["browser_461634.js"] - -["browser_463205.js"] - -["browser_463206.js"] - -["browser_464199.js"] -# Disabled for frequent intermittent failures - -["browser_464620_a.js"] -skip-if = ["true"] - -["browser_464620_b.js"] -skip-if = ["true"] - -["browser_465215.js"] - -["browser_465223.js"] - -["browser_466937.js"] - -["browser_467409-backslashplosion.js"] - -["browser_477657.js"] -skip-if = ["os == 'linux' && os_version == '18.04'"] # bug 1610668 for ubuntu 18.04 - -["browser_480893.js"] - -["browser_485482.js"] - -["browser_485563.js"] - -["browser_490040.js"] - -["browser_491168.js"] - -["browser_491577.js"] -skip-if = [ - "verify && debug && os == 'mac'", - "verify && debug && os == 'win'", -] - -["browser_495495.js"] - -["browser_500328.js"] - -["browser_514751.js"] - -["browser_522375.js"] - -["browser_522545.js"] -skip-if = ["true"] # Bug 1380968 - -["browser_524745.js"] -skip-if = [ - "win10_2009 && !ccov", # Bug 1418627 - "os == 'linux'", # Bug 1803187 -] - -["browser_528776.js"] - -["browser_579868.js"] - -["browser_579879.js"] -skip-if = ["os == 'linux' && (debug || asan)"] # Bug 1234404 - -["browser_581937.js"] - -["browser_586068-apptabs.js"] - -["browser_586068-apptabs_ondemand.js"] -skip-if = ["verify && (os == 'mac' || os == 'win')"] - -["browser_586068-browser_state_interrupted.js"] - -["browser_586068-cascade.js"] - -["browser_586068-multi_window.js"] - -["browser_586068-reload.js"] -https_first_disabled = true - -["browser_586068-select.js"] - -["browser_586068-window_state.js"] - -["browser_586068-window_state_override.js"] - -["browser_586147.js"] - -["browser_588426.js"] - -["browser_590268.js"] - -["browser_590563.js"] - -["browser_595601-restore_hidden.js"] - -["browser_597071.js"] -skip-if = ["true"] # Needs to be rewritten as Marionette test, bug 995916 - -["browser_600545.js"] - -["browser_601955.js"] - -["browser_607016.js"] - -["browser_615394-SSWindowState_events_duplicateTab.js"] - -["browser_615394-SSWindowState_events_setBrowserState.js"] -skip-if = ["verify && debug && os == 'mac'"] - -["browser_615394-SSWindowState_events_setTabState.js"] - -["browser_615394-SSWindowState_events_setWindowState.js"] -https_first_disabled = true - -["browser_615394-SSWindowState_events_undoCloseTab.js"] - -["browser_615394-SSWindowState_events_undoCloseWindow.js"] -skip-if = [ - "os == 'win' && !debug", # Bug 1572554 - "os == 'linux'", # Bug 1572554 -] - -["browser_618151.js"] - -["browser_623779.js"] - -["browser_624727.js"] - -["browser_625016.js"] -skip-if = [ - "os == 'mac'", # Disabled on OS X: - "os == 'linux'", # linux, Bug 1348583 - "os == 'win' && debug", # Bug 1430977 -] - -["browser_628270.js"] - -["browser_635418.js"] - -["browser_636279.js"] - -["browser_637020.js"] - -["browser_645428.js"] - -["browser_659591.js"] - -["browser_662743.js"] - -["browser_662812.js"] -skip-if = ["verify"] - -["browser_665702-state_session.js"] - -["browser_682507.js"] - -["browser_687710.js"] - -["browser_687710_2.js"] -https_first_disabled = true - -["browser_694378.js"] - -["browser_701377.js"] -skip-if = [ - "verify && debug && os == 'win'", - "verify && debug && os == 'mac'", -] - -["browser_705597.js"] - -["browser_707862.js"] - -["browser_739531.js"] - -["browser_739805.js"] - -["browser_819510_perwindowpb.js"] -skip-if = ["true"] # Bug 1284312, Bug 1341980, bug 1381451 - -["browser_906076_lazy_tabs.js"] -https_first_disabled = true -skip-if = ["os == 'linux' && os_version == '18.04'"] # bug 1446464 - -["browser_911547.js"] - ["browser_aboutPrivateBrowsing.js"] ["browser_aboutSessionRestore.js"] @@ -316,7 +55,6 @@ support-files = ["file_async_flushes.html"] run-if = ["crashreporter"] ["browser_async_remove_tab.js"] -skip-if = ["!sessionHistoryInParent"] ["browser_async_window_flushing.js"] https_first_disabled = true @@ -393,6 +131,7 @@ https_first_disabled = true skip-if = ["verify && debug"] ["browser_formdata_cc.js"] +skip-if = ["asan"] # test runs too long ["browser_formdata_face.js"] @@ -466,12 +205,12 @@ skip-if = [ ["browser_privatetabs.js"] ["browser_purge_shistory.js"] -skip-if = ["!sessionHistoryInParent"] # Bug 1271024 ["browser_remoteness_flip_on_restore.js"] ["browser_reopen_all_windows.js"] https_first_disabled = true +skip-if = ["asan"] # high memory ["browser_replace_load.js"] skip-if = ["true"] # Bug 1646894 @@ -516,9 +255,6 @@ skip-if = [ ["browser_scrollPositionsReaderMode.js"] -["browser_send_async_message_oom.js"] -skip-if = ["sessionHistoryInParent"] # Tests that the frame script OOMs, which is unused when SHIP is enabled. - ["browser_sessionHistory.js"] https_first_disabled = true support-files = ["file_sessionHistory_hashchange.html"] diff --git a/browser/components/sessionstore/test/browser_354894_perwindowpb.js b/browser/components/sessionstore/test/browser_354894_perwindowpb.js index 90368536dc..30a065c1af 100644 --- a/browser/components/sessionstore/test/browser_354894_perwindowpb.js +++ b/browser/components/sessionstore/test/browser_354894_perwindowpb.js @@ -21,7 +21,7 @@ * not enabled on that platform (platform shim; the application is kept running * although there are no windows left) * @note There is a difference when closing a browser window with - * BrowserTryToCloseWindow() as opposed to close(). The former will make + * BrowserCommands.tryToCloseWindow() as opposed to close(). The former will make * nsSessionStore restore a window next time it gets a chance and will post * notifications. The latter won't. */ @@ -133,7 +133,7 @@ let setupTest = async function (options, testFunction) { * Helper: Will observe and handle the notifications for us */ let hitCount = 0; - function observer(aCancel, aTopic, aData) { + function observer(aCancel, aTopic) { // count so that we later may compare observing[aTopic]++; @@ -182,7 +182,7 @@ function injectTestTabs(win) { } /** - * Attempts to close a window via BrowserTryToCloseWindow so that + * Attempts to close a window via BrowserCommands.tryToCloseWindow so that * we get the browser-lastwindow-close-requested and * browser-lastwindow-close-granted observer notifications. * @@ -195,7 +195,7 @@ function injectTestTabs(win) { function closeWindowForRestoration(win) { return new Promise(resolve => { let closePromise = BrowserTestUtils.windowClosed(win); - win.BrowserTryToCloseWindow(); + win.BrowserCommands.tryToCloseWindow(); if (!win.closed) { resolve(false); return; @@ -415,7 +415,7 @@ add_task(async function test_open_close_restore_from_popup() { return; } - await setupTest({}, async function (newWin, obs) { + await setupTest({}, async function (newWin) { let newWin2 = await promiseNewWindowLoaded(); await injectTestTabs(newWin2); diff --git a/browser/components/sessionstore/test/browser_394759_basic.js b/browser/components/sessionstore/test/browser_394759_basic.js index 62d5c40e17..cc1c335165 100644 --- a/browser/components/sessionstore/test/browser_394759_basic.js +++ b/browser/components/sessionstore/test/browser_394759_basic.js @@ -74,7 +74,7 @@ function test() { let expectedTabs = data[0].tabs.length; newWin2.addEventListener( "SSTabRestored", - function sstabrestoredListener(aEvent) { + function sstabrestoredListener() { ++restoredTabs; info("Restored tab " + restoredTabs + "/" + expectedTabs); if (restoredTabs < expectedTabs) { diff --git a/browser/components/sessionstore/test/browser_394759_behavior.js b/browser/components/sessionstore/test/browser_394759_behavior.js index ee4b121e84..01217f86c9 100644 --- a/browser/components/sessionstore/test/browser_394759_behavior.js +++ b/browser/components/sessionstore/test/browser_394759_behavior.js @@ -34,7 +34,7 @@ function testWindows(windowsToOpen, expectedResults) { } let closedWindowData = ss.getClosedWindowData(); - let numPopups = closedWindowData.filter(function (el, i, arr) { + let numPopups = closedWindowData.filter(function (el) { return el.isPopup; }).length; let numNormal = ss.getClosedWindowCount() - numPopups; @@ -50,7 +50,7 @@ function testWindows(windowsToOpen, expectedResults) { is( numNormal, oResults.normal, - "There were " + oResults.normal + " normal windows to repoen" + "There were " + oResults.normal + " normal windows to reopen" ); })(); } @@ -63,14 +63,15 @@ add_task(async function test_closed_window_states() { let windowsToOpen = [ { isPopup: false }, - { isPopup: false }, + { isPopup: true }, + { isPopup: true }, { isPopup: true }, { isPopup: true }, { isPopup: true }, ]; let expectedResults = { - mac: { popup: 3, normal: 0 }, - other: { popup: 3, normal: 1 }, + mac: { popup: 5, normal: 0 }, + other: { popup: 5, normal: 1 }, }; await testWindows(windowsToOpen, expectedResults); @@ -81,10 +82,11 @@ add_task(async function test_closed_window_states() { { isPopup: false }, { isPopup: false }, { isPopup: false }, + { isPopup: false }, ]; let expectedResults2 = { - mac: { popup: 0, normal: 3 }, - other: { popup: 0, normal: 3 }, + mac: { popup: 0, normal: 5 }, + other: { popup: 0, normal: 5 }, }; await testWindows(windowsToOpen2, expectedResults2); diff --git a/browser/components/sessionstore/test/browser_394759_purge.js b/browser/components/sessionstore/test/browser_394759_purge.js index e5218c9936..ea75d6e4b2 100644 --- a/browser/components/sessionstore/test/browser_394759_purge.js +++ b/browser/components/sessionstore/test/browser_394759_purge.js @@ -9,7 +9,7 @@ let { ForgetAboutSite } = ChromeUtils.importESModule( function promiseClearHistory() { return new Promise(resolve => { let observer = { - observe(aSubject, aTopic, aData) { + observe() { Services.obs.removeObserver( this, "browser:purge-session-history-for-domain" diff --git a/browser/components/sessionstore/test/browser_459906.js b/browser/components/sessionstore/test/browser_459906.js index 6827f6ad1d..5a0c1aeea3 100644 --- a/browser/components/sessionstore/test/browser_459906.js +++ b/browser/components/sessionstore/test/browser_459906.js @@ -17,7 +17,7 @@ function test() { let tab = BrowserTestUtils.addTab(gBrowser, testURL); tab.linkedBrowser.addEventListener( "load", - function listener(aEvent) { + function listener() { // wait for all frames to load completely if (frameCount++ < 2) { return; @@ -31,7 +31,7 @@ function test() { let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener( "load", - function loadListener(eventTab2) { + function loadListener() { // wait for all frames to load (and reload!) completely if (frameCount++ < 2) { return; diff --git a/browser/components/sessionstore/test/browser_461743.js b/browser/components/sessionstore/test/browser_461743.js index fd4501b5ac..a27ccc7721 100644 --- a/browser/components/sessionstore/test/browser_461743.js +++ b/browser/components/sessionstore/test/browser_461743.js @@ -24,7 +24,7 @@ function test() { let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener( "461743", - function listener(eventTab2) { + function listener() { tab2.linkedBrowser.removeEventListener("461743", listener, true); is(aEvent.data, "done", "XSS injection was attempted"); diff --git a/browser/components/sessionstore/test/browser_464199.js b/browser/components/sessionstore/test/browser_464199.js index 4ac8fba1a5..98a17c4955 100644 --- a/browser/components/sessionstore/test/browser_464199.js +++ b/browser/components/sessionstore/test/browser_464199.js @@ -9,7 +9,7 @@ let { ForgetAboutSite } = ChromeUtils.importESModule( function promiseClearHistory() { return new Promise(resolve => { let observer = { - observe(aSubject, aTopic, aData) { + observe() { Services.obs.removeObserver( this, "browser:purge-session-history-for-domain" diff --git a/browser/components/sessionstore/test/browser_464620_a.js b/browser/components/sessionstore/test/browser_464620_a.js index 9052d7bec0..6a3b56f767 100644 --- a/browser/components/sessionstore/test/browser_464620_a.js +++ b/browser/components/sessionstore/test/browser_464620_a.js @@ -27,7 +27,7 @@ function test() { let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener( "464620_a", - function listener(eventTab2) { + function listener() { tab2.linkedBrowser.removeEventListener("464620_a", listener, true); is(aEvent.data, "done", "XSS injection was attempted"); diff --git a/browser/components/sessionstore/test/browser_464620_b.js b/browser/components/sessionstore/test/browser_464620_b.js index 005bb4cc27..3e2b46d685 100644 --- a/browser/components/sessionstore/test/browser_464620_b.js +++ b/browser/components/sessionstore/test/browser_464620_b.js @@ -27,7 +27,7 @@ function test() { let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener( "464620_b", - function listener(eventTab2) { + function listener() { tab2.linkedBrowser.removeEventListener("464620_b", listener, true); is(aEvent.data, "done", "XSS injection was attempted"); diff --git a/browser/components/sessionstore/test/browser_526613.js b/browser/components/sessionstore/test/browser_526613.js index ba3f03ef32..784febd3d5 100644 --- a/browser/components/sessionstore/test/browser_526613.js +++ b/browser/components/sessionstore/test/browser_526613.js @@ -45,7 +45,7 @@ function test() { }; let pass = 1; - function observer(aSubject, aTopic, aData) { + function observer(aSubject, aTopic) { is( aTopic, "sessionstore-browser-state-restored", diff --git a/browser/components/sessionstore/test/browser_580512.js b/browser/components/sessionstore/test/browser_580512.js index 1dfd696277..e27dc61ba3 100644 --- a/browser/components/sessionstore/test/browser_580512.js +++ b/browser/components/sessionstore/test/browser_580512.js @@ -32,10 +32,10 @@ function closeFirstWin(win) { win.gBrowser.pinTab(win.gBrowser.tabs[1]); let winClosed = BrowserTestUtils.windowClosed(win); - // We need to call BrowserTryToCloseWindow in order to trigger + // We need to call BrowserCommands.tryToCloseWindow in order to trigger // the machinery that chooses whether or not to save the session // for the last window. - win.BrowserTryToCloseWindow(); + win.BrowserCommands.tryToCloseWindow(); ok(win.closed, "window closed"); winClosed.then(() => { @@ -88,7 +88,7 @@ function openWinWithCb(cb, argURIs, expectedURIs) { var expectedLoads = expectedURIs.length; win.gBrowser.addTabsProgressListener({ - onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, _aStatus) { if ( aRequest && aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && diff --git a/browser/components/sessionstore/test/browser_586068-apptabs.js b/browser/components/sessionstore/test/browser_586068-apptabs.js index b2f92f760c..24878ba267 100644 --- a/browser/components/sessionstore/test/browser_586068-apptabs.js +++ b/browser/components/sessionstore/test/browser_586068-apptabs.js @@ -69,12 +69,7 @@ add_task(async function test() { let loadCount = 0; let promiseRestoringTabs = new Promise(resolve => { - gProgressListener.setCallback(function ( - aBrowser, - aNeedRestore, - aRestoring, - aRestored - ) { + gProgressListener.setCallback(function (aBrowser) { loadCount++; // We'll make sure that the loads we get come from pinned tabs or the diff --git a/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js b/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js index b729555ff1..6ef18e2b3a 100644 --- a/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js +++ b/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js @@ -147,12 +147,7 @@ add_task(async function test() { let loadCount = 0; let promiseRestoringTabs = new Promise(resolve => { - gProgressListener.setCallback(function ( - aBrowser, - aNeedRestore, - aRestoring, - aRestored - ) { + gProgressListener.setCallback(function (aBrowser, aNeedRestore) { loadCount++; if ( @@ -188,7 +183,7 @@ add_task(async function test() { }); // We also want to catch the extra windows (there should be 2), so we need to observe domwindowopened - Services.ww.registerNotification(function observer(aSubject, aTopic, aData) { + Services.ww.registerNotification(function observer(aSubject, aTopic) { if (aTopic == "domwindowopened") { let win = aSubject; win.addEventListener( diff --git a/browser/components/sessionstore/test/browser_586068-multi_window.js b/browser/components/sessionstore/test/browser_586068-multi_window.js index bf5d839812..352c5bcefb 100644 --- a/browser/components/sessionstore/test/browser_586068-multi_window.js +++ b/browser/components/sessionstore/test/browser_586068-multi_window.js @@ -72,12 +72,7 @@ add_task(async function test() { let loadCount = 0; let promiseRestoringTabs = new Promise(resolve => { - gProgressListener.setCallback(function ( - aBrowser, - aNeedRestore, - aRestoring, - aRestored - ) { + gProgressListener.setCallback(function (aBrowser, aNeedRestore) { if (++loadCount == numTabs) { // We don't actually care about load order in this test, just that they all // do load. @@ -91,7 +86,7 @@ add_task(async function test() { }); // We also want to catch the 2nd window, so we need to observe domwindowopened - Services.ww.registerNotification(function observer(aSubject, aTopic, aData) { + Services.ww.registerNotification(function observer(aSubject, aTopic) { if (aTopic == "domwindowopened") { let win = aSubject; win.addEventListener( diff --git a/browser/components/sessionstore/test/browser_586068-window_state.js b/browser/components/sessionstore/test/browser_586068-window_state.js index 69c3742a66..25066a2db4 100644 --- a/browser/components/sessionstore/test/browser_586068-window_state.js +++ b/browser/components/sessionstore/test/browser_586068-window_state.js @@ -82,12 +82,7 @@ add_task(async function test() { let loadCount = 0; let promiseRestoringTabs = new Promise(resolve => { - gProgressListener.setCallback(function ( - aBrowser, - aNeedRestore, - aRestoring, - aRestored - ) { + gProgressListener.setCallback(function (aBrowser, aNeedRestore) { // When loadCount == 2, we'll also restore state2 into the window if (++loadCount == 2) { ss.setWindowState(window, JSON.stringify(state2), false); diff --git a/browser/components/sessionstore/test/browser_586068-window_state_override.js b/browser/components/sessionstore/test/browser_586068-window_state_override.js index 8a6eac6de2..eb3d2c709b 100644 --- a/browser/components/sessionstore/test/browser_586068-window_state_override.js +++ b/browser/components/sessionstore/test/browser_586068-window_state_override.js @@ -82,12 +82,7 @@ add_task(async function test() { let loadCount = 0; let promiseRestoringTabs = new Promise(resolve => { - gProgressListener.setCallback(function ( - aBrowser, - aNeedRestore, - aRestoring, - aRestored - ) { + gProgressListener.setCallback(function (aBrowser, aNeedRestore) { // When loadCount == 2, we'll also restore state2 into the window if (++loadCount == 2) { executeSoon(() => diff --git a/browser/components/sessionstore/test/browser_589246.js b/browser/components/sessionstore/test/browser_589246.js index 2fd92b2b82..34d9dc97a8 100644 --- a/browser/components/sessionstore/test/browser_589246.js +++ b/browser/components/sessionstore/test/browser_589246.js @@ -164,7 +164,7 @@ function setupForTest(aConditions) { ss.setBrowserState(JSON.stringify(testState)); } -function onStateRestored(aSubject, aTopic, aData) { +function onStateRestored() { info("test #" + testNum + ": onStateRestored"); Services.obs.removeObserver( onStateRestored, @@ -183,7 +183,7 @@ function onStateRestored(aSubject, aTopic, aData) { ); newWin.addEventListener( "load", - function (aEvent) { + function () { promiseBrowserLoaded(newWin.gBrowser.selectedBrowser).then(() => { // pin this tab if (shouldPinTab) { @@ -216,12 +216,12 @@ function onStateRestored(aSubject, aTopic, aData) { newWin.gBrowser.removeTab(newTab); newWin.gBrowser.removeTab(newTab2); } - newWin.BrowserTryToCloseWindow(); + newWin.BrowserCommands.tryToCloseWindow(); }, { capture: true, once: true } ); } else { - newWin.BrowserTryToCloseWindow(); + newWin.BrowserCommands.tryToCloseWindow(); } }); }, @@ -230,7 +230,7 @@ function onStateRestored(aSubject, aTopic, aData) { } // This will be called before the window is actually closed -function onLastWindowClosed(aSubject, aTopic, aData) { +function onLastWindowClosed() { info("test #" + testNum + ": onLastWindowClosed"); Services.obs.removeObserver( onLastWindowClosed, @@ -261,7 +261,7 @@ function onWindowUnloaded() { ); newWin.addEventListener( "load", - function (aEvent) { + function () { newWin.gBrowser.selectedBrowser.addEventListener( "load", function () { diff --git a/browser/components/sessionstore/test/browser_590268.js b/browser/components/sessionstore/test/browser_590268.js index cde1a1cafa..eb1940e35d 100644 --- a/browser/components/sessionstore/test/browser_590268.js +++ b/browser/components/sessionstore/test/browser_590268.js @@ -52,7 +52,7 @@ function test() { } } - function onSSTabRestored(aEvent) { + function onSSTabRestored() { if (++restoredTabsCount < NUM_TABS) { return; } diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js index b3ad6d240a..b2f7692b7c 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_duplicateTab.js @@ -29,11 +29,11 @@ function test_duplicateTab() { // We'll look to make sure this value is on the duplicated tab ss.setCustomTabValue(tab, "foo", "bar"); - function onSSWindowStateBusy(aEvent) { + function onSSWindowStateBusy() { busyEventCount++; } - function onSSWindowStateReady(aEvent) { + function onSSWindowStateReady() { newTab = gBrowser.tabs[2]; readyEventCount++; is(ss.getCustomTabValue(newTab, "foo"), "bar"); diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js index 4dfcbc844d..fbca3301e6 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setBrowserState.js @@ -84,7 +84,7 @@ function test() { // waitForBrowserState does it's own observing for windows, but doesn't attach // the listeners we want here, so do it ourselves. let newWindow; - function windowObserver(aSubject, aTopic, aData) { + function windowObserver(aSubject, aTopic) { if (aTopic == "domwindowopened") { Services.ww.unregisterNotification(windowObserver); diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js index a76a8b3dd5..4b0c256388 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setTabState.js @@ -29,17 +29,17 @@ function test_setTabState() { let busyEventCount = 0; let readyEventCount = 0; - function onSSWindowStateBusy(aEvent) { + function onSSWindowStateBusy() { busyEventCount++; } - function onSSWindowStateReady(aEvent) { + function onSSWindowStateReady() { readyEventCount++; is(ss.getCustomTabValue(tab, "foo"), "bar"); ss.setCustomTabValue(tab, "baz", "qux"); } - function onSSTabRestoring(aEvent) { + function onSSTabRestoring() { is(busyEventCount, 1); is(readyEventCount, 1); is(ss.getCustomTabValue(tab, "baz"), "qux"); diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setWindowState.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setWindowState.js index c9d4bd00f5..daa40bd75a 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setWindowState.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_setWindowState.js @@ -29,17 +29,17 @@ function test() { readyEventCount = 0, tabRestoredCount = 0; - function onSSWindowStateBusy(aEvent) { + function onSSWindowStateBusy() { busyEventCount++; } - function onSSWindowStateReady(aEvent) { + function onSSWindowStateReady() { readyEventCount++; is(ss.getCustomTabValue(gBrowser.tabs[0], "foo"), "bar"); is(ss.getCustomTabValue(gBrowser.tabs[1], "baz"), "qux"); } - function onSSTabRestored(aEvent) { + function onSSTabRestored() { if (++tabRestoredCount < 2) { return; } diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseTab.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseTab.js index 345bba516c..b5d5af2835 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseTab.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseTab.js @@ -24,11 +24,11 @@ add_task(async function test_undoCloseTab() { ss.setCustomTabValue(tab, "foo", "bar"); - function onSSWindowStateBusy(aEvent) { + function onSSWindowStateBusy() { busyEventCount++; } - function onSSWindowStateReady(aEvent) { + function onSSWindowStateReady() { Assert.equal(gBrowser.tabs.length, 2, "Should only have 2 tabs"); lastTab = gBrowser.tabs[1]; readyEventCount++; diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js index 0a5b07da29..7483583e5a 100644 --- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js +++ b/browser/components/sessionstore/test/browser_615394-SSWindowState_events_undoCloseWindow.js @@ -71,7 +71,7 @@ function test() { let newWindow, reopenedWindow; - function firstWindowObserver(aSubject, aTopic, aData) { + function firstWindowObserver(aSubject, aTopic) { if (aTopic == "domwindowopened") { newWindow = aSubject; Services.ww.unregisterNotification(firstWindowObserver); @@ -107,15 +107,15 @@ function test() { readyEventCount = 0, tabRestoredCount = 0; // These will listen to the reopened closed window... - function onSSWindowStateBusy(aEvent) { + function onSSWindowStateBusy() { busyEventCount++; } - function onSSWindowStateReady(aEvent) { + function onSSWindowStateReady() { readyEventCount++; } - function onSSTabRestored(aEvent) { + function onSSTabRestored() { if (++tabRestoredCount < 4) { return; } diff --git a/browser/components/sessionstore/test/browser_618151.js b/browser/components/sessionstore/test/browser_618151.js index c38a349818..f3c44d1e88 100644 --- a/browser/components/sessionstore/test/browser_618151.js +++ b/browser/components/sessionstore/test/browser_618151.js @@ -46,7 +46,7 @@ function runNextTest() { } function test_setup() { - function onSSTabRestored(aEvent) { + function onSSTabRestored() { gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored); runNextTest(); } diff --git a/browser/components/sessionstore/test/browser_636279.js b/browser/components/sessionstore/test/browser_636279.js index 3b71fcbb4c..4842f145b2 100644 --- a/browser/components/sessionstore/test/browser_636279.js +++ b/browser/components/sessionstore/test/browser_636279.js @@ -129,7 +129,7 @@ var TabsProgressListener = { delete this.callback; }, - observe(browser, topic, data) { + observe(browser) { TabsProgressListener.onRestored(browser); }, diff --git a/browser/components/sessionstore/test/browser_645428.js b/browser/components/sessionstore/test/browser_645428.js index bbb3b1b299..3916c44a7e 100644 --- a/browser/components/sessionstore/test/browser_645428.js +++ b/browser/components/sessionstore/test/browser_645428.js @@ -6,7 +6,7 @@ const NOTIFICATION = "sessionstore-browser-state-restored"; function test() { waitForExplicitFinish(); - function observe(subject, topic, data) { + function observe(subject, topic) { if (NOTIFICATION == topic) { finish(); ok(true, "TOPIC received"); diff --git a/browser/components/sessionstore/test/browser_687710_2.js b/browser/components/sessionstore/test/browser_687710_2.js index 81d3c55379..190b5a718a 100644 --- a/browser/components/sessionstore/test/browser_687710_2.js +++ b/browser/components/sessionstore/test/browser_687710_2.js @@ -38,61 +38,31 @@ var state = { add_task(async function test() { let tab = BrowserTestUtils.addTab(gBrowser, "about:blank"); await promiseTabState(tab, state); - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(tab.linkedBrowser, [], function () { - function compareEntries(i, j, history) { - let e1 = history.getEntryAtIndex(i); - let e2 = history.getEntryAtIndex(j); - ok(e1.sharesDocumentWith(e2), `${i} should share doc with ${j}`); - is(e1.childCount, e2.childCount, `Child count mismatch (${i}, ${j})`); + function compareEntries(i, j, history) { + let e1 = history.getEntryAtIndex(i); + let e2 = history.getEntryAtIndex(j); - for (let c = 0; c < e1.childCount; c++) { - let c1 = e1.GetChildAt(c); - let c2 = e2.GetChildAt(c); + ok(e1.sharesDocumentWith(e2), `${i} should share doc with ${j}`); + is(e1.childCount, e2.childCount, `Child count mismatch (${i}, ${j})`); - ok( - c1.sharesDocumentWith(c2), - `Cousins should share documents. (${i}, ${j}, ${c})` - ); - } - } + for (let c = 0; c < e1.childCount; c++) { + let c1 = e1.GetChildAt(c); + let c2 = e2.GetChildAt(c); - let history = docShell.browsingContext.childSessionHistory.legacySHistory; - - is(history.count, 2, "history.count"); - for (let i = 0; i < history.count; i++) { - for (let j = 0; j < history.count; j++) { - compareEntries(i, j, history); - } - } - }); - } else { - function compareEntries(i, j, history) { - let e1 = history.getEntryAtIndex(i); - let e2 = history.getEntryAtIndex(j); - - ok(e1.sharesDocumentWith(e2), `${i} should share doc with ${j}`); - is(e1.childCount, e2.childCount, `Child count mismatch (${i}, ${j})`); - - for (let c = 0; c < e1.childCount; c++) { - let c1 = e1.GetChildAt(c); - let c2 = e2.GetChildAt(c); - - ok( - c1.sharesDocumentWith(c2), - `Cousins should share documents. (${i}, ${j}, ${c})` - ); - } + ok( + c1.sharesDocumentWith(c2), + `Cousins should share documents. (${i}, ${j}, ${c})` + ); } + } - let history = tab.linkedBrowser.browsingContext.sessionHistory; + let history = tab.linkedBrowser.browsingContext.sessionHistory; - is(history.count, 2, "history.count"); - for (let i = 0; i < history.count; i++) { - for (let j = 0; j < history.count; j++) { - compareEntries(i, j, history); - } + is(history.count, 2, "history.count"); + for (let i = 0; i < history.count; i++) { + for (let j = 0; j < history.count; j++) { + compareEntries(i, j, history); } } diff --git a/browser/components/sessionstore/test/browser_705597.js b/browser/components/sessionstore/test/browser_705597.js index d497e46a97..10f4f08863 100644 --- a/browser/components/sessionstore/test/browser_705597.js +++ b/browser/components/sessionstore/test/browser_705597.js @@ -26,14 +26,8 @@ function test() { let browser = tab.linkedBrowser; promiseTabState(tab, tabState).then(() => { - let entry; - if (!Services.appinfo.sessionHistoryInParent) { - let sessionHistory = browser.sessionHistory; - entry = sessionHistory.legacySHistory.getEntryAtIndex(0); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - entry = sessionHistory.getEntryAtIndex(0); - } + let sessionHistory = browser.browsingContext.sessionHistory; + let entry = sessionHistory.getEntryAtIndex(0); whenChildCount(entry, 1, function () { whenChildCount(entry, 2, function () { diff --git a/browser/components/sessionstore/test/browser_707862.js b/browser/components/sessionstore/test/browser_707862.js index 765c63257f..4559362e21 100644 --- a/browser/components/sessionstore/test/browser_707862.js +++ b/browser/components/sessionstore/test/browser_707862.js @@ -26,26 +26,14 @@ function test() { let browser = tab.linkedBrowser; promiseTabState(tab, tabState).then(() => { - let entry; - if (!Services.appinfo.sessionHistoryInParent) { - let sessionHistory = browser.sessionHistory; - entry = sessionHistory.legacySHistory.getEntryAtIndex(0); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - entry = sessionHistory.getEntryAtIndex(0); - } + let sessionHistory = browser.browsingContext.sessionHistory; + let entry = sessionHistory.getEntryAtIndex(0); whenChildCount(entry, 1, function () { whenChildCount(entry, 2, function () { promiseBrowserLoaded(browser).then(() => { - let newEntry; - if (!Services.appinfo.sessionHistoryInParent) { - let newSessionHistory = browser.sessionHistory; - newEntry = newSessionHistory.legacySHistory.getEntryAtIndex(0); - } else { - let newSessionHistory = browser.browsingContext.sessionHistory; - newEntry = newSessionHistory.getEntryAtIndex(0); - } + let newSessionHistory = browser.browsingContext.sessionHistory; + let newEntry = newSessionHistory.getEntryAtIndex(0); whenChildCount(newEntry, 0, function () { // Make sure that we reset the state. diff --git a/browser/components/sessionstore/test/browser_739531.js b/browser/components/sessionstore/test/browser_739531.js index 507d10a5f1..e02a94d9a7 100644 --- a/browser/components/sessionstore/test/browser_739531.js +++ b/browser/components/sessionstore/test/browser_739531.js @@ -19,7 +19,7 @@ function test() { removeFunc = BrowserTestUtils.addContentEventListener( tab.linkedBrowser, "load", - function onLoad(aEvent) { + function onLoad() { // make sure both the page and the frame are loaded if (++loadCount < 2) { return; diff --git a/browser/components/sessionstore/test/browser_async_flushes.js b/browser/components/sessionstore/test/browser_async_flushes.js index e35593dc30..d0bf039ff2 100644 --- a/browser/components/sessionstore/test/browser_async_flushes.js +++ b/browser/components/sessionstore/test/browser_async_flushes.js @@ -44,58 +44,6 @@ add_task(async function test_flush() { gBrowser.removeTab(tab); }); -add_task(async function test_crash() { - if (Services.appinfo.sessionHistoryInParent) { - // This test relies on frame script message ordering. Since the frame script - // is unused with SHIP, there's no guarantee that we'll crash the frame - // before we've started the flush. - ok(true, "Test relies on frame script message ordering."); - return; - } - - // Create new tab. - let tab = BrowserTestUtils.addTab(gBrowser, URL); - gBrowser.selectedTab = tab; - let browser = tab.linkedBrowser; - await promiseBrowserLoaded(browser); - - // Flush to empty any queued update messages. - await TabStateFlusher.flush(browser); - - // There should be one history entry. - let { entries } = JSON.parse(ss.getTabState(tab)); - is(entries.length, 1, "there is a single history entry"); - - // Click the link to navigate. - await SpecialPowers.spawn(browser, [], async function () { - return new Promise(resolve => { - docShell.chromeEventHandler.addEventListener( - "hashchange", - () => resolve(), - { once: true, capture: true } - ); - - // Click the link. - content.document.querySelector("a").click(); - }); - }); - - // Crash the browser and flush. Both messages are async and will be sent to - // the content process. The "crash" message makes it first so that we don't - // get a chance to process the flush. The TabStateFlusher however should be - // notified so that the flush still completes. - let promise1 = BrowserTestUtils.crashFrame(browser); - let promise2 = TabStateFlusher.flush(browser); - await Promise.all([promise1, promise2]); - - // The pending update should be lost. - ({ entries } = JSON.parse(ss.getTabState(tab))); - is(entries.length, 1, "still only one history entry"); - - // Cleanup. - gBrowser.removeTab(tab); -}); - add_task(async function test_remove() { // Create new tab. let tab = BrowserTestUtils.addTab(gBrowser, URL); diff --git a/browser/components/sessionstore/test/browser_async_remove_tab.js b/browser/components/sessionstore/test/browser_async_remove_tab.js index 7f74c57b40..1e3a75adfa 100644 --- a/browser/components/sessionstore/test/browser_async_remove_tab.js +++ b/browser/components/sessionstore/test/browser_async_remove_tab.js @@ -92,15 +92,7 @@ add_task(async function save_worthy_tabs_remote_final() { ok(browser.isRemoteBrowser, "browser is still remote"); // Remove the tab before the update arrives. - let promise = promiseRemoveTabAndSessionState(tab); - - // With SHIP, we'll do the final tab state update sooner than we did before. - if (!Services.appinfo.sessionHistoryInParent) { - // No tab state worth saving (that we know about yet). - ok(!isValueInClosedData(r), "closed tab not saved"); - } - - await promise; + await promiseRemoveTabAndSessionState(tab); // Turns out there is a tab state worth saving. ok(isValueInClosedData(r), "closed tab saved"); @@ -117,15 +109,7 @@ add_task(async function save_worthy_tabs_nonremote_final() { ok(!browser.isRemoteBrowser, "browser is not remote anymore"); // Remove the tab before the update arrives. - let promise = promiseRemoveTabAndSessionState(tab); - - // With SHIP, we'll do the final tab state update sooner than we did before. - if (!Services.appinfo.sessionHistoryInParent) { - // No tab state worth saving (that we know about yet). - ok(!isValueInClosedData(r), "closed tab not saved"); - } - - await promise; + await promiseRemoveTabAndSessionState(tab); // Turns out there is a tab state worth saving. ok(isValueInClosedData(r), "closed tab saved"); @@ -151,15 +135,7 @@ add_task(async function dont_save_empty_tabs_final() { await entryReplaced; // Remove the tab before the update arrives. - let promise = promiseRemoveTabAndSessionState(tab); - - // With SHIP, we'll do the final tab state update sooner than we did before. - if (!Services.appinfo.sessionHistoryInParent) { - // Tab state deemed worth saving (yet). - ok(isValueInClosedData(r), "closed tab saved"); - } - - await promise; + await promiseRemoveTabAndSessionState(tab); // Turns out we don't want to save the tab state. ok(!isValueInClosedData(r), "closed tab not saved"); diff --git a/browser/components/sessionstore/test/browser_async_window_flushing.js b/browser/components/sessionstore/test/browser_async_window_flushing.js index d346f9eb1f..42e24bdd83 100644 --- a/browser/components/sessionstore/test/browser_async_window_flushing.js +++ b/browser/components/sessionstore/test/browser_async_window_flushing.js @@ -116,17 +116,10 @@ add_task(async function test_remove_uninteresting_window() { await SpecialPowers.spawn(browser, [], async function () { // Epic hackery to make this browser seem suddenly boring. docShell.setCurrentURIForSessionStore(Services.io.newURI("about:blank")); - - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - let { sessionHistory } = docShell.QueryInterface(Ci.nsIWebNavigation); - sessionHistory.legacySHistory.purgeHistory(sessionHistory.count); - } }); - if (SpecialPowers.Services.appinfo.sessionHistoryInParent) { - let { sessionHistory } = browser.browsingContext; - sessionHistory.purgeHistory(sessionHistory.count); - } + let { sessionHistory } = browser.browsingContext; + sessionHistory.purgeHistory(sessionHistory.count); // Once this windowClosed Promise resolves, we should have finished // the flush and revisited our decision to put this window into diff --git a/browser/components/sessionstore/test/browser_attributes.js b/browser/components/sessionstore/test/browser_attributes.js index a0ee6d5b0c..491ec5db22 100644 --- a/browser/components/sessionstore/test/browser_attributes.js +++ b/browser/components/sessionstore/test/browser_attributes.js @@ -38,45 +38,68 @@ add_task(async function test() { ok(tab.hasAttribute("muted"), "tab.muted exists"); // Make sure we do not persist 'image' and 'muted' attributes. - ss.persistTabAttribute("image"); - ss.persistTabAttribute("muted"); let { attributes } = JSON.parse(ss.getTabState(tab)); ok(!("image" in attributes), "'image' attribute not saved"); ok(!("muted" in attributes), "'muted' attribute not saved"); - ok(!("custom" in attributes), "'custom' attribute not saved"); - - // Test persisting a custom attribute. - tab.setAttribute("custom", "foobar"); - ss.persistTabAttribute("custom"); - - ({ attributes } = JSON.parse(ss.getTabState(tab))); - is(attributes.custom, "foobar", "'custom' attribute is correct"); - - // Make sure we're backwards compatible and restore old 'image' attributes. + ok(!("customizemode" in attributes), "'customizemode' attribute not saved"); + + // Test persisting a customizemode attribute. + { + let customizationReady = BrowserTestUtils.waitForEvent( + gNavToolbox, + "customizationready" + ); + gCustomizeMode.enter(); + await customizationReady; + } + + let customizeIcon = gBrowser.getIcon(gBrowser.selectedTab); + ({ attributes } = JSON.parse(ss.getTabState(gBrowser.selectedTab))); + ok(!("image" in attributes), "'image' attribute not saved"); + is(attributes.customizemode, "true", "'customizemode' attribute is correct"); + + { + let afterCustomization = BrowserTestUtils.waitForEvent( + gNavToolbox, + "aftercustomization" + ); + gCustomizeMode.exit(); + await afterCustomization; + } + + // Test restoring a customizemode tab. let state = { - entries: [{ url: "about:mozilla", triggeringPrincipal_base64 }], - attributes: { custom: "foobaz" }, - image: gBrowser.getIcon(tab), + entries: [], + attributes: { customizemode: "true", nonpersisted: "true" }, }; + // Customize mode doesn't like being restored on top of a non-blank tab. + // For the moment, it appears it isn't possible to restore customizemode onto + // an existing non-blank tab outside of tests, however this may be a latent + // bug if we ever try to do that in the future. + let principal = Services.scriptSecurityManager.createNullPrincipal({}); + tab.linkedBrowser.createAboutBlankDocumentViewer(principal, principal); + // Prepare a pending tab waiting to be restored. let promise = promiseTabRestoring(tab); ss.setTabState(tab, JSON.stringify(state)); await promise; ok(tab.hasAttribute("pending"), "tab is pending"); - is(gBrowser.getIcon(tab), state.image, "tab has correct icon"); + ok(tab.hasAttribute("customizemode"), "tab is in customizemode"); + ok(!tab.hasAttribute("nonpersisted"), "tab has no nonpersisted attribute"); + is(gBrowser.getIcon(tab), customizeIcon, "tab has correct icon"); ok(!state.attributes.image, "'image' attribute not saved"); // Let the pending tab load. gBrowser.selectedTab = tab; - await promiseTabRestored(tab); // Ensure no 'image' or 'pending' attributes are stored. ({ attributes } = JSON.parse(ss.getTabState(tab))); ok(!("image" in attributes), "'image' attribute not saved"); ok(!("pending" in attributes), "'pending' attribute not saved"); - is(attributes.custom, "foobaz", "'custom' attribute is correct"); + ok(!("nonpersisted" in attributes), "'nonpersisted' attribute not saved"); + is(attributes.customizemode, "true", "'customizemode' attribute is correct"); // Clean up. gBrowser.removeTab(tab); diff --git a/browser/components/sessionstore/test/browser_bfcache_telemetry.js b/browser/components/sessionstore/test/browser_bfcache_telemetry.js index 5faa2822ea..c1e9877505 100644 --- a/browser/components/sessionstore/test/browser_bfcache_telemetry.js +++ b/browser/components/sessionstore/test/browser_bfcache_telemetry.js @@ -39,7 +39,6 @@ async function test_bfcache_telemetry(probeInParent) { add_task(async () => { await test_bfcache_telemetry( - Services.appinfo.sessionHistoryInParent && - Services.prefs.getBoolPref("fission.bfcacheInParent") + Services.prefs.getBoolPref("fission.bfcacheInParent") ); }); diff --git a/browser/components/sessionstore/test/browser_closed_tabs_closed_windows.js b/browser/components/sessionstore/test/browser_closed_tabs_closed_windows.js index 081167acfa..c80e63df04 100644 --- a/browser/components/sessionstore/test/browser_closed_tabs_closed_windows.js +++ b/browser/components/sessionstore/test/browser_closed_tabs_closed_windows.js @@ -81,10 +81,6 @@ async function prepareClosedData() { const testWindow7 = await BrowserTestUtils.openNewBrowserWindow(); await openAndCloseTab(testWindow7, TEST_URLS[4]); - let closedTabsHistogram = TelemetryTestUtils.getAndClearHistogram( - "FX_SESSION_RESTORE_CLOSED_TABS_NOT_SAVED" - ); - await BrowserTestUtils.closeWindow(testWindow1); closedIds.testWindow1 = SessionStore.getClosedWindowData()[0].closedId; await BrowserTestUtils.closeWindow(testWindow2); @@ -100,13 +96,7 @@ async function prepareClosedData() { ); await BrowserTestUtils.closeWindow(testWindow6); - TelemetryTestUtils.assertHistogram(closedTabsHistogram, 0, 1); - closedTabsHistogram.clear(); - await BrowserTestUtils.closeWindow(testWindow7); - TelemetryTestUtils.assertHistogram(closedTabsHistogram, 1, 1); - closedTabsHistogram.clear(); - return closedIds; } diff --git a/browser/components/sessionstore/test/browser_cookies.js b/browser/components/sessionstore/test/browser_cookies.js index f514efc777..96244dda1a 100644 --- a/browser/components/sessionstore/test/browser_cookies.js +++ b/browser/components/sessionstore/test/browser_cookies.js @@ -14,7 +14,7 @@ function promiseSetCookie(cookie) { function waitForCookieChanged() { return new Promise(resolve => { - Services.obs.addObserver(function observer(subj, topic, data) { + Services.obs.addObserver(function observer(subj, topic) { Services.obs.removeObserver(observer, topic); resolve(); }, "session-cookie-changed"); diff --git a/browser/components/sessionstore/test/browser_crashedTabs.js b/browser/components/sessionstore/test/browser_crashedTabs.js index 32c064dd81..797cf5ecf8 100644 --- a/browser/components/sessionstore/test/browser_crashedTabs.js +++ b/browser/components/sessionstore/test/browser_crashedTabs.js @@ -82,7 +82,7 @@ function promiseTabCrashedReady(browser) { return new Promise(resolve => { browser.addEventListener( "AboutTabCrashedReady", - function ready(e) { + function ready() { browser.removeEventListener("AboutTabCrashedReady", ready, false, true); resolve(); }, diff --git a/browser/components/sessionstore/test/browser_docshell_uuid_consistency.js b/browser/components/sessionstore/test/browser_docshell_uuid_consistency.js index 1b152139d7..6fc212eb2b 100644 --- a/browser/components/sessionstore/test/browser_docshell_uuid_consistency.js +++ b/browser/components/sessionstore/test/browser_docshell_uuid_consistency.js @@ -4,38 +4,18 @@ add_task(async function duplicateTab() { let tab = BrowserTestUtils.addTab(gBrowser, TEST_URL); await BrowserTestUtils.browserLoaded(tab.linkedBrowser); - if (!Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(tab.linkedBrowser, [], function () { - let docshell = content.window.docShell.QueryInterface( - Ci.nsIWebNavigation - ); - let shEntry = docshell.sessionHistory.legacySHistory.getEntryAtIndex(0); - is(shEntry.docshellID.toString(), docshell.historyID.toString()); - }); - } else { - let historyID = tab.linkedBrowser.browsingContext.historyID; - let shEntry = - tab.linkedBrowser.browsingContext.sessionHistory.getEntryAtIndex(0); - is(shEntry.docshellID.toString(), historyID.toString()); - } + let historyID = tab.linkedBrowser.browsingContext.historyID; + let shEntry = + tab.linkedBrowser.browsingContext.sessionHistory.getEntryAtIndex(0); + is(shEntry.docshellID.toString(), historyID.toString()); let tab2 = gBrowser.duplicateTab(tab); await BrowserTestUtils.browserLoaded(tab2.linkedBrowser); - if (!Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(tab2.linkedBrowser, [], function () { - let docshell = content.window.docShell.QueryInterface( - Ci.nsIWebNavigation - ); - let shEntry = docshell.sessionHistory.legacySHistory.getEntryAtIndex(0); - is(shEntry.docshellID.toString(), docshell.historyID.toString()); - }); - } else { - let historyID = tab2.linkedBrowser.browsingContext.historyID; - let shEntry = - tab2.linkedBrowser.browsingContext.sessionHistory.getEntryAtIndex(0); - is(shEntry.docshellID.toString(), historyID.toString()); - } + historyID = tab2.linkedBrowser.browsingContext.historyID; + shEntry = + tab2.linkedBrowser.browsingContext.sessionHistory.getEntryAtIndex(0); + is(shEntry.docshellID.toString(), historyID.toString()); BrowserTestUtils.removeTab(tab); BrowserTestUtils.removeTab(tab2); @@ -47,24 +27,10 @@ add_task(async function contentToChromeNavigate() { let tab = BrowserTestUtils.addTab(gBrowser, TEST_URL); await BrowserTestUtils.browserLoaded(tab.linkedBrowser); - if (!Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(tab.linkedBrowser, [], function () { - let docshell = content.window.docShell.QueryInterface( - Ci.nsIWebNavigation - ); - let sh = docshell.sessionHistory; - is(sh.count, 1); - is( - sh.legacySHistory.getEntryAtIndex(0).docshellID.toString(), - docshell.historyID.toString() - ); - }); - } else { - let historyID = tab.linkedBrowser.browsingContext.historyID; - let sh = tab.linkedBrowser.browsingContext.sessionHistory; - is(sh.count, 1); - is(sh.getEntryAtIndex(0).docshellID.toString(), historyID.toString()); - } + let historyID = tab.linkedBrowser.browsingContext.historyID; + let sh = tab.linkedBrowser.browsingContext.sessionHistory; + is(sh.count, 1); + is(sh.getEntryAtIndex(0).docshellID.toString(), historyID.toString()); // Force the browser to navigate to the chrome process. BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, "about:config"); @@ -74,31 +40,17 @@ add_task(async function contentToChromeNavigate() { let docShell = tab.linkedBrowser.frameLoader.docShell; // 'cause we're in the chrome process, we can just directly poke at the shistory. - if (!Services.appinfo.sessionHistoryInParent) { - let sh = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory; - - is(sh.count, 2); - is( - sh.legacySHistory.getEntryAtIndex(0).docshellID.toString(), - docShell.historyID.toString() - ); - is( - sh.legacySHistory.getEntryAtIndex(1).docshellID.toString(), - docShell.historyID.toString() - ); - } else { - let sh = docShell.browsingContext.sessionHistory; - - is(sh.count, 2); - is( - sh.getEntryAtIndex(0).docshellID.toString(), - docShell.historyID.toString() - ); - is( - sh.getEntryAtIndex(1).docshellID.toString(), - docShell.historyID.toString() - ); - } + sh = docShell.browsingContext.sessionHistory; + + is(sh.count, 2); + is( + sh.getEntryAtIndex(0).docshellID.toString(), + docShell.historyID.toString() + ); + is( + sh.getEntryAtIndex(1).docshellID.toString(), + docShell.historyID.toString() + ); BrowserTestUtils.removeTab(tab); }); diff --git a/browser/components/sessionstore/test/browser_frame_history.js b/browser/components/sessionstore/test/browser_frame_history.js index 1db32e74ab..eeb6de177c 100644 --- a/browser/components/sessionstore/test/browser_frame_history.js +++ b/browser/components/sessionstore/test/browser_frame_history.js @@ -206,7 +206,7 @@ function waitForLoadsInBrowser(aBrowser, aLoadCount) { let loadCount = 0; aBrowser.addEventListener( "load", - function listener(aEvent) { + function listener() { if (++loadCount < aLoadCount) { info( "Got " + loadCount + " loads, waiting until we have " + aLoadCount diff --git a/browser/components/sessionstore/test/browser_frametree.js b/browser/components/sessionstore/test/browser_frametree.js index ce1f5cdf0b..06e0379c59 100644 --- a/browser/components/sessionstore/test/browser_frametree.js +++ b/browser/components/sessionstore/test/browser_frametree.js @@ -98,7 +98,7 @@ add_task(async function test_frametree_dynamic() { is(await enumerateIndexes(browser), "0,1", "correct indexes 0 and 1"); // Remopve a non-dynamic iframe. - await SpecialPowers.spawn(browser, [URL], async ([url]) => { + await SpecialPowers.spawn(browser, [URL], async () => { // Remove the first iframe, which should be a non-dynamic iframe. content.document.body.removeChild( content.document.getElementsByTagName("iframe")[0] diff --git a/browser/components/sessionstore/test/browser_history_persist.js b/browser/components/sessionstore/test/browser_history_persist.js index f6749b02e3..1cf8bf1b8d 100644 --- a/browser/components/sessionstore/test/browser_history_persist.js +++ b/browser/components/sessionstore/test/browser_history_persist.js @@ -25,54 +25,27 @@ add_task(async function check_history_not_persisted() { browser = tab.linkedBrowser; await promiseTabState(tab, state); - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(browser, [], function () { - let sessionHistory = - docShell.browsingContext.childSessionHistory.legacySHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - }); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - } + let sessionHistory = browser.browsingContext.sessionHistory; + + is(sessionHistory.count, 1, "Should be a single history entry"); + is( + sessionHistory.getEntryAtIndex(0).URI.spec, + "about:blank", + "Should be the right URL" + ); // Load a new URL into the tab, it should replace the about:blank history entry BrowserTestUtils.startLoadingURIString(browser, "about:robots"); await promiseBrowserLoaded(browser, false, "about:robots"); - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(browser, [], function () { - let sessionHistory = - docShell.browsingContext.childSessionHistory.legacySHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:robots", - "Should be the right URL" - ); - }); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:robots", - "Should be the right URL" - ); - } + + sessionHistory = browser.browsingContext.sessionHistory; + + is(sessionHistory.count, 1, "Should be a single history entry"); + is( + sessionHistory.getEntryAtIndex(0).URI.spec, + "about:robots", + "Should be the right URL" + ); // Cleanup. BrowserTestUtils.removeTab(tab); @@ -99,64 +72,33 @@ add_task(async function check_history_default_persisted() { tab = BrowserTestUtils.addTab(gBrowser, "about:blank"); browser = tab.linkedBrowser; await promiseTabState(tab, state); - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(browser, [], function () { - let sessionHistory = - docShell.browsingContext.childSessionHistory.legacySHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - }); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - - is(sessionHistory.count, 1, "Should be a single history entry"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - } + + let sessionHistory = browser.browsingContext.sessionHistory; + + is(sessionHistory.count, 1, "Should be a single history entry"); + is( + sessionHistory.getEntryAtIndex(0).URI.spec, + "about:blank", + "Should be the right URL" + ); // Load a new URL into the tab, it should replace the about:blank history entry BrowserTestUtils.startLoadingURIString(browser, "about:robots"); await promiseBrowserLoaded(browser, false, "about:robots"); - if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) { - await SpecialPowers.spawn(browser, [], function () { - let sessionHistory = - docShell.browsingContext.childSessionHistory.legacySHistory; - - is(sessionHistory.count, 2, "Should be two history entries"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - is( - sessionHistory.getEntryAtIndex(1).URI.spec, - "about:robots", - "Should be the right URL" - ); - }); - } else { - let sessionHistory = browser.browsingContext.sessionHistory; - - is(sessionHistory.count, 2, "Should be two history entries"); - is( - sessionHistory.getEntryAtIndex(0).URI.spec, - "about:blank", - "Should be the right URL" - ); - is( - sessionHistory.getEntryAtIndex(1).URI.spec, - "about:robots", - "Should be the right URL" - ); - } + + sessionHistory = browser.browsingContext.sessionHistory; + + is(sessionHistory.count, 2, "Should be two history entries"); + is( + sessionHistory.getEntryAtIndex(0).URI.spec, + "about:blank", + "Should be the right URL" + ); + is( + sessionHistory.getEntryAtIndex(1).URI.spec, + "about:robots", + "Should be the right URL" + ); // Cleanup. BrowserTestUtils.removeTab(tab); diff --git a/browser/components/sessionstore/test/browser_newtab_userTypedValue.js b/browser/components/sessionstore/test/browser_newtab_userTypedValue.js index 755a1f2859..cd17c9a9f0 100644 --- a/browser/components/sessionstore/test/browser_newtab_userTypedValue.js +++ b/browser/components/sessionstore/test/browser_newtab_userTypedValue.js @@ -16,7 +16,7 @@ add_task(async function () { ); // This opens about:newtab: - win.BrowserOpenTab(); + win.BrowserCommands.openTab(); let tab = await tabOpenedAndSwitchedTo; is(win.gURLBar.value, "", "URL bar should be empty"); is(tab.linkedBrowser.userTypedValue, null, "userTypedValue should be null"); @@ -55,7 +55,7 @@ add_task(async function () { for (let url of gInitialPages) { if (url == BROWSER_NEW_TAB_URL) { - continue; // We tested about:newtab using BrowserOpenTab() above. + continue; // We tested about:newtab using BrowserCommands.openTab() above. } info("Testing " + url + " - " + new Date()); await BrowserTestUtils.openNewForegroundTab(win.gBrowser, url); diff --git a/browser/components/sessionstore/test/browser_oldformat.toml b/browser/components/sessionstore/test/browser_oldformat.toml new file mode 100644 index 0000000000..7edc51dc67 --- /dev/null +++ b/browser/components/sessionstore/test/browser_oldformat.toml @@ -0,0 +1,301 @@ +[DEFAULT] +support-files = [ + "head.js", + "browser_formdata_sample.html", + "browser_formdata_xpath_sample.html", + "browser_frametree_sample.html", + "browser_frametree_sample_frameset.html", + "browser_frametree_sample_iframes.html", + "browser_frame_history_index.html", + "browser_frame_history_index2.html", + "browser_frame_history_index_blank.html", + "browser_frame_history_a.html", + "browser_frame_history_b.html", + "browser_frame_history_c.html", + "browser_frame_history_c1.html", + "browser_frame_history_c2.html", + "browser_formdata_format_sample.html", + "browser_sessionHistory_slow.sjs", + "browser_scrollPositions_sample.html", + "browser_scrollPositions_sample2.html", + "browser_scrollPositions_sample_frameset.html", + "browser_scrollPositions_readerModeArticle.html", + "browser_sessionStorage.html", + "browser_speculative_connect.html", + "browser_248970_b_sample.html", + "browser_339445_sample.html", + "browser_423132_sample.html", + "browser_447951_sample.html", + "browser_454908_sample.html", + "browser_456342_sample.xhtml", + "browser_463205_sample.html", + "browser_463206_sample.html", + "browser_466937_sample.html", + "browser_485482_sample.html", + "browser_637020_slow.sjs", + "browser_662743_sample.html", + "browser_739531_sample.html", + "browser_739531_frame.html", + "browser_911547_sample.html", + "browser_911547_sample.html^headers^", + "coopHeaderCommon.sjs", + "restore_redirect_http.html", + "restore_redirect_http.html^headers^", + "restore_redirect_js.html", + "restore_redirect_target.html", + "browser_1234021_page.html", + "browser_1284886_suspend_tab.html", + "browser_1284886_suspend_tab_2.html", + "empty.html", + "coop_coep.html", + "coop_coep.html^headers^", +] +# remove this after bug 1628486 is landed +prefs = [ + "network.cookie.cookieBehavior=5", + "gfx.font_rendering.fallback.async=false", + "browser.sessionstore.closedTabsFromAllWindows=true", + "browser.sessionstore.closedTabsFromClosedWindows=true", +] + +#NB: the following are disabled +# browser_464620_a.html +# browser_464620_b.html +# browser_464620_xd.html + +#disabled-for-intermittent-failures--bug-766044, browser_459906_empty.html +#disabled-for-intermittent-failures--bug-766044, browser_459906_sample.html +#disabled-for-intermittent-failures--bug-765389, browser_461743_sample.html + +["browser_1234021.js"] + +["browser_1284886_suspend_tab.js"] + +["browser_1446343-windowsize.js"] +skip-if = ["os == 'linux'"] # Bug 1600180 + +["browser_248970_b_perwindowpb.js"] +# Disabled because of leaks. +# Re-enabling and rewriting this test is tracked in bug 936919. +skip-if = ["true"] + +["browser_339445.js"] + +["browser_345898.js"] + +["browser_350525.js"] + +["browser_354894_perwindowpb.js"] + +["browser_367052.js"] + +["browser_393716.js"] +skip-if = ["debug"] # Bug 1507747 + +["browser_394759_basic.js"] +# Disabled for intermittent failures, bug 944372. +skip-if = ["true"] + +["browser_394759_behavior.js"] +https_first_disabled = true + +["browser_394759_perwindowpb.js"] + +["browser_394759_purge.js"] + +["browser_423132.js"] + +["browser_447951.js"] + +["browser_454908.js"] + +["browser_456342.js"] + +["browser_461634.js"] + +["browser_463205.js"] + +["browser_463206.js"] + +["browser_464199.js"] +# Disabled for frequent intermittent failures + +["browser_464620_a.js"] +skip-if = ["true"] + +["browser_464620_b.js"] +skip-if = ["true"] + +["browser_465215.js"] + +["browser_465223.js"] + +["browser_466937.js"] + +["browser_467409-backslashplosion.js"] + +["browser_477657.js"] +skip-if = ["os == 'linux' && os_version == '18.04'"] # bug 1610668 for ubuntu 18.04 + +["browser_480893.js"] + +["browser_485482.js"] + +["browser_485563.js"] + +["browser_490040.js"] + +["browser_491168.js"] + +["browser_491577.js"] +skip-if = [ + "verify && debug && os == 'mac'", + "verify && debug && os == 'win'", +] + +["browser_495495.js"] + +["browser_500328.js"] + +["browser_514751.js"] + +["browser_522375.js"] + +["browser_522545.js"] +skip-if = ["true"] # Bug 1380968 + +["browser_524745.js"] +skip-if = [ + "win10_2009 && !ccov", # Bug 1418627 + "os == 'linux'", # Bug 1803187 +] + +["browser_528776.js"] + +["browser_579868.js"] + +["browser_579879.js"] +skip-if = ["os == 'linux' && (debug || asan)"] # Bug 1234404 + +["browser_581937.js"] + +["browser_586068-apptabs.js"] + +["browser_586068-apptabs_ondemand.js"] +skip-if = ["verify && (os == 'mac' || os == 'win')"] + +["browser_586068-browser_state_interrupted.js"] + +["browser_586068-cascade.js"] + +["browser_586068-multi_window.js"] + +["browser_586068-reload.js"] +https_first_disabled = true + +["browser_586068-select.js"] + +["browser_586068-window_state.js"] + +["browser_586068-window_state_override.js"] + +["browser_586147.js"] + +["browser_588426.js"] + +["browser_590268.js"] + +["browser_590563.js"] + +["browser_595601-restore_hidden.js"] + +["browser_597071.js"] +skip-if = ["true"] # Needs to be rewritten as Marionette test, bug 995916 + +["browser_600545.js"] + +["browser_601955.js"] + +["browser_607016.js"] + +["browser_615394-SSWindowState_events_duplicateTab.js"] + +["browser_615394-SSWindowState_events_setBrowserState.js"] +skip-if = ["verify && debug && os == 'mac'"] + +["browser_615394-SSWindowState_events_setTabState.js"] + +["browser_615394-SSWindowState_events_setWindowState.js"] +https_first_disabled = true + +["browser_615394-SSWindowState_events_undoCloseTab.js"] + +["browser_615394-SSWindowState_events_undoCloseWindow.js"] +skip-if = [ + "os == 'win' && !debug", # Bug 1572554 + "os == 'linux'", # Bug 1572554 +] + +["browser_618151.js"] + +["browser_623779.js"] + +["browser_624727.js"] + +["browser_625016.js"] +skip-if = [ + "os == 'mac'", # Disabled on OS X: + "os == 'linux'", # linux, Bug 1348583 + "os == 'win' && debug", # Bug 1430977 +] + +["browser_628270.js"] + +["browser_635418.js"] + +["browser_636279.js"] + +["browser_637020.js"] + +["browser_645428.js"] + +["browser_659591.js"] + +["browser_662743.js"] + +["browser_662812.js"] +skip-if = ["verify"] + +["browser_665702-state_session.js"] + +["browser_682507.js"] + +["browser_687710.js"] + +["browser_687710_2.js"] +https_first_disabled = true + +["browser_694378.js"] + +["browser_701377.js"] +skip-if = [ + "verify && debug && os == 'win'", + "verify && debug && os == 'mac'", +] + +["browser_705597.js"] + +["browser_707862.js"] + +["browser_739531.js"] + +["browser_739805.js"] + +["browser_819510_perwindowpb.js"] +skip-if = ["true"] # Bug 1284312, Bug 1341980, bug 1381451 + +["browser_906076_lazy_tabs.js"] +https_first_disabled = true +skip-if = ["os == 'linux' && os_version == '18.04'"] # bug 1446464 + +["browser_911547.js"] diff --git a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js index 442914d580..ad8144f864 100644 --- a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js +++ b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js @@ -12,7 +12,7 @@ const TESTURL = "about:testpageforsessionrestore#foo"; let TestAboutPage = { QueryInterface: ChromeUtils.generateQI(["nsIAboutModule"]), - getURIFlags(aURI) { + getURIFlags() { // No CAN_ or MUST_LOAD_IN_CHILD means this loads in the parent: return ( Ci.nsIAboutModule.ALLOW_SCRIPT | @@ -73,7 +73,7 @@ add_task(async function () { r => (resolveLocationChangePromise = r) ); let wpl = { - onStateChange(listener, request, state, status) { + onStateChange(listener, request, state, _status) { let location = request.QueryInterface(Ci.nsIChannel).originalURI; // Ignore about:blank loads. let docStop = diff --git a/browser/components/sessionstore/test/browser_restoreLastClosedTabOrWindowOrSession.js b/browser/components/sessionstore/test/browser_restoreLastClosedTabOrWindowOrSession.js index cc340c4617..10551238f5 100644 --- a/browser/components/sessionstore/test/browser_restoreLastClosedTabOrWindowOrSession.js +++ b/browser/components/sessionstore/test/browser_restoreLastClosedTabOrWindowOrSession.js @@ -208,7 +208,7 @@ add_task(async function test_reopen_last_tab_if_no_closed_actions() { gBrowser, url: "about:blank", }, - async browser => { + async () => { const TEST_URL = "https://example.com/"; let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL); let update = BrowserTestUtils.waitForSessionStoreUpdate(tab); diff --git a/browser/components/sessionstore/test/browser_send_async_message_oom.js b/browser/components/sessionstore/test/browser_send_async_message_oom.js deleted file mode 100644 index 7e807f2fbd..0000000000 --- a/browser/components/sessionstore/test/browser_send_async_message_oom.js +++ /dev/null @@ -1,75 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -/* eslint-disable mozilla/no-arbitrary-setTimeout */ - -const HISTOGRAM_NAME = "FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM"; - -/** - * Test that an OOM in sendAsyncMessage in a framescript will be reported - * to Telemetry. - */ - -add_setup(async function () { - Services.telemetry.canRecordExtended = true; -}); - -function frameScript() { - // Make send[A]syncMessage("SessionStore:update", ...) simulate OOM. - // Other operations are unaffected. - let mm = docShell.messageManager; - - let wrap = function (original) { - return function (name, ...args) { - if (name != "SessionStore:update") { - return original(name, ...args); - } - throw new Components.Exception( - "Simulated OOM", - Cr.NS_ERROR_OUT_OF_MEMORY - ); - }; - }; - - mm.sendAsyncMessage = wrap(mm.sendAsyncMessage.bind(mm)); - mm.sendSyncMessage = wrap(mm.sendSyncMessage.bind(mm)); -} - -add_task(async function () { - // Capture original state. - let snapshot = Services.telemetry.getHistogramById(HISTOGRAM_NAME).snapshot(); - - // Open a browser, configure it to cause OOM. - let newTab = BrowserTestUtils.addTab(gBrowser, "about:robots"); - let browser = newTab.linkedBrowser; - await ContentTask.spawn(browser, null, frameScript); - - let promiseReported = new Promise(resolve => { - browser.messageManager.addMessageListener("SessionStore:error", resolve); - }); - - // Attempt to flush. This should fail. - let promiseFlushed = TabStateFlusher.flush(browser); - promiseFlushed.then(success => { - if (success) { - throw new Error("Flush should have failed"); - } - }); - - // The frame script should report an error. - await promiseReported; - - // Give us some time to handle that error. - await new Promise(resolve => setTimeout(resolve, 10)); - - // By now, Telemetry should have been updated. - let snapshot2 = Services.telemetry - .getHistogramById(HISTOGRAM_NAME) - .snapshot(); - gBrowser.removeTab(newTab); - - Assert.ok(snapshot2.sum > snapshot.sum); -}); - -add_task(async function cleanup() { - Services.telemetry.canRecordExtended = false; -}); diff --git a/browser/components/sessionstore/test/browser_sessionHistory.js b/browser/components/sessionstore/test/browser_sessionHistory.js index 69dcc4995b..34b1ef7d09 100644 --- a/browser/components/sessionstore/test/browser_sessionHistory.js +++ b/browser/components/sessionstore/test/browser_sessionHistory.js @@ -296,12 +296,9 @@ add_task(async function test_slow_subframe_load() { * Ensure that document wireframes can be persisted when they're enabled. */ add_task(async function test_wireframes() { - // Wireframes only works when Fission and SHIP are enabled. - if ( - !Services.appinfo.fissionAutostart || - !Services.appinfo.sessionHistoryInParent - ) { - ok(true, "Skipping test_wireframes when Fission or SHIP is not enabled."); + // Wireframes only works when Fission is enabled. + if (!Services.appinfo.fissionAutostart) { + ok(true, "Skipping test_wireframes when Fission is not enabled."); return; } diff --git a/browser/components/sessionstore/test/browser_sessionStoreContainer.js b/browser/components/sessionstore/test/browser_sessionStoreContainer.js index 86833dea82..e4f3ecea9f 100644 --- a/browser/components/sessionstore/test/browser_sessionStoreContainer.js +++ b/browser/components/sessionstore/test/browser_sessionStoreContainer.js @@ -14,7 +14,7 @@ add_task(async function () { await promiseBrowserLoaded(browser); let tab2 = gBrowser.duplicateTab(tab); - Assert.equal(tab2.getAttribute("usercontextid"), i); + Assert.equal(tab2.getAttribute("usercontextid") || "", i); let browser2 = tab2.linkedBrowser; await promiseTabRestored(tab2); diff --git a/browser/components/sessionstore/test/browser_should_restore_tab.js b/browser/components/sessionstore/test/browser_should_restore_tab.js index ab9513083a..958222141e 100644 --- a/browser/components/sessionstore/test/browser_should_restore_tab.js +++ b/browser/components/sessionstore/test/browser_should_restore_tab.js @@ -13,7 +13,7 @@ async function check_tab_close_notification(openedTab, expectNotification) { let tabClosed = BrowserTestUtils.waitForTabClosing(openedTab); let notified = false; - function topicObserver(_, topic) { + function topicObserver() { notified = true; } Services.obs.addObserver(topicObserver, NOTIFY_CLOSED_OBJECTS_CHANGED); @@ -73,7 +73,7 @@ add_task(async function test_about_new_tab() { () => {} ); // This opens about:newtab: - win.BrowserOpenTab(); + win.BrowserCommands.openTab(); let tab = await tabOpenedAndSwitchedTo; await check_tab_close_notification(tab, false); }); diff --git a/browser/components/sessionstore/test/browser_windowStateContainer.js b/browser/components/sessionstore/test/browser_windowStateContainer.js index f0d6f42d39..e2d2d256eb 100644 --- a/browser/components/sessionstore/test/browser_windowStateContainer.js +++ b/browser/components/sessionstore/test/browser_windowStateContainer.js @@ -11,7 +11,7 @@ add_setup(async function () { function promiseTabsRestored(win, nExpected) { return new Promise(resolve => { let nReceived = 0; - function handler(event) { + function handler() { if (++nReceived === nExpected) { win.gBrowser.tabContainer.removeEventListener( "SSTabRestored", diff --git a/browser/components/sessionstore/test/head.js b/browser/components/sessionstore/test/head.js index d475fa86a1..85db6e9d5e 100644 --- a/browser/components/sessionstore/test/head.js +++ b/browser/components/sessionstore/test/head.js @@ -144,7 +144,7 @@ function waitForTopic(aTopic, aTimeout, aCallback) { aCallback(false); }, aTimeout); - function observer(subject, topic, data) { + function observer() { removeObserver(); timeout = clearTimeout(timeout); executeSoon(() => aCallback(true)); @@ -268,7 +268,7 @@ var gWebProgressListener = { } }, - onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, _aStatus) { if ( aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK && @@ -298,7 +298,7 @@ var gProgressListener = { } }, - observe(browser, topic, data) { + observe(browser) { gProgressListener.onRestored(browser); }, @@ -451,7 +451,7 @@ function modifySessionStorage(browser, storageData, storageOptions = {}) { return SpecialPowers.spawn( browsingContext, [[storageData, storageOptions]], - async function ([data, options]) { + async function ([data]) { let frame = content; let keys = new Set(Object.keys(data)); let isClearing = !keys.size; @@ -558,35 +558,9 @@ function setPropertyOfFormField(browserContext, selector, propName, newValue) { } function promiseOnHistoryReplaceEntry(browser) { - if (SpecialPowers.Services.appinfo.sessionHistoryInParent) { - return new Promise(resolve => { - let sessionHistory = browser.browsingContext?.sessionHistory; - if (sessionHistory) { - var historyListener = { - OnHistoryNewEntry() {}, - OnHistoryGotoIndex() {}, - OnHistoryPurge() {}, - OnHistoryReload() { - return true; - }, - - OnHistoryReplaceEntry() { - resolve(); - }, - - QueryInterface: ChromeUtils.generateQI([ - "nsISHistoryListener", - "nsISupportsWeakReference", - ]), - }; - - sessionHistory.addSHistoryListener(historyListener); - } - }); - } - - return SpecialPowers.spawn(browser, [], () => { - return new Promise(resolve => { + return new Promise(resolve => { + let sessionHistory = browser.browsingContext?.sessionHistory; + if (sessionHistory) { var historyListener = { OnHistoryNewEntry() {}, OnHistoryGotoIndex() {}, @@ -605,13 +579,8 @@ function promiseOnHistoryReplaceEntry(browser) { ]), }; - var { sessionHistory } = this.docShell.QueryInterface( - Ci.nsIWebNavigation - ); - if (sessionHistory) { - sessionHistory.legacySHistory.addSHistoryListener(historyListener); - } - }); + sessionHistory.addSHistoryListener(historyListener); + } }); } -- cgit v1.2.3