diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 419742d1651..cc49fbfa525 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -799,7 +799,7 @@ pref("browser.sessionstore.max_resumed_crashes", 1); // focused (also applies to tabs that aren't visible). When false, the values // for MAX_CONCURRENT_TAB_RESTORES and restore_hidden_tabs are respected. // Selected tabs are always restored regardless of this pref. -pref("browser.sessionstore.restore_on_demand", false); +pref("browser.sessionstore.restore_on_demand", true); // Whether to automatically restore hidden tabs (i.e., tabs in other tab groups) or not pref("browser.sessionstore.restore_hidden_tabs", false); // If restore_on_demand is set, pinned tabs are restored on startup by default. diff --git a/browser/base/content/test/browser_tabMatchesInAwesomebar.js b/browser/base/content/test/browser_tabMatchesInAwesomebar.js index c321dbecf65..b2e7ba17714 100644 --- a/browser/base/content/test/browser_tabMatchesInAwesomebar.js +++ b/browser/base/content/test/browser_tabMatchesInAwesomebar.js @@ -77,6 +77,11 @@ var gTestSteps = [ ps.setBoolPref("browser.privatebrowsing.keep_current_session", true); ps.setBoolPref("browser.tabs.warnOnClose", false); + // Make sure that all restored tabs are loaded without waiting for the user + // to bring them to the foreground. We ensure this by resetting the + // related preference (see the "firefox.js" defaults file for details). + ps.setBoolPref("browser.sessionstore.restore_on_demand", false); + gPrivateBrowsing.privateBrowsingEnabled = true; executeSoon(function() { @@ -89,12 +94,8 @@ var gTestSteps = [ executeSoon(function() { let ps = Services.prefs; - try { - ps.clearUserPref("browser.privatebrowsing.keep_current_session"); - } catch (ex) {} - try { - ps.clearUserPref("browser.tabs.warnOnClose"); - } catch (ex) {} + ps.clearUserPref("browser.privatebrowsing.keep_current_session"); + ps.clearUserPref("browser.tabs.warnOnClose"); ensure_opentabs_match_db(nextStep); }); @@ -169,12 +170,8 @@ var gTestSteps = [ Services.obs.removeObserver(arguments.callee, "private-browsing-transition-complete"); let ps = Services.prefs; - try { - ps.clearUserPref("browser.privatebrowsing.keep_current_session"); - } catch (ex) {} - try { - ps.clearUserPref("browser.tabs.warnOnClose"); - } catch (ex) {} + ps.clearUserPref("browser.privatebrowsing.keep_current_session"); + ps.clearUserPref("browser.tabs.warnOnClose"); for (let i = 1; i < gBrowser.tabs.length; i++) waitForRestoredTab(gBrowser.tabs[i]); @@ -185,6 +182,9 @@ var gTestSteps = [ }, function() { info("Running step 13 - close all tabs"); + + Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand"); + gBrowser.addTab("about:blank", {skipAnimation: true}); while (gBrowser.tabs.length > 1) { info("Removing tab: " + gBrowser.tabs[0].linkedBrowser.currentURI.spec); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js index 0164a311c56..d50ead6d765 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js @@ -60,11 +60,11 @@ function test() { Services.obs.addObserver(promptObserver, "common-dialog-loaded", false); waitForExplicitFinish(); - let browser1 = gBrowser.getBrowserForTab(gBrowser.addTab()); + let browser1 = gBrowser.addTab().linkedBrowser; browser1.addEventListener("load", function() { browser1.removeEventListener("load", arguments.callee, true); - let browser2 = gBrowser.getBrowserForTab(gBrowser.addTab()); + let browser2 = gBrowser.addTab().linkedBrowser; browser2.addEventListener("load", function() { browser2.removeEventListener("load", arguments.callee, true); @@ -75,11 +75,11 @@ function test() { is(confirmCalls, 1, "Only one confirm box should be shown"); is(gBrowser.tabs.length, 3, "No tabs should be closed because private browsing mode transition was canceled"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild).currentURI.spec, "about:blank", + is(gBrowser.tabContainer.firstChild.linkedBrowser.currentURI.spec, "about:blank", "The first tab should be a blank tab"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild.nextSibling).currentURI.spec, TEST_PAGE_1, + is(gBrowser.tabContainer.firstChild.nextSibling.linkedBrowser.currentURI.spec, TEST_PAGE_1, "The middle tab should be the same one we opened"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.lastChild).currentURI.spec, TEST_PAGE_2, + is(gBrowser.tabContainer.lastChild.linkedBrowser.currentURI.spec, TEST_PAGE_2, "The last tab should be the same one we opened"); is(rejectDialog, 0, "Only one confirm dialog should have been rejected"); @@ -113,12 +113,17 @@ function test() { is(confirmCalls, 1, "Only one confirm box should be shown"); is(gBrowser.tabs.length, 2, "No tabs should be closed because private browsing mode transition was canceled"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild).currentURI.spec, TEST_PAGE_1, + is(gBrowser.tabContainer.firstChild.linkedBrowser.currentURI.spec, TEST_PAGE_1, "The first tab should be the same one we opened"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.lastChild).currentURI.spec, TEST_PAGE_2, + is(gBrowser.tabContainer.lastChild.linkedBrowser.currentURI.spec, TEST_PAGE_2, "The last tab should be the same one we opened"); is(rejectDialog, 0, "Only one confirm dialog should have been rejected"); + // Ensure that all restored tabs are loaded without waiting for the + // user to bring them to the foreground, by resetting the related + // preference (see the "firefox.js" defaults file for details). + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + confirmCalls = 0; acceptDialog = 2; pb.privateBrowsingEnabled = false; @@ -135,11 +140,11 @@ function test() { if (++loads != 3) return; - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild).currentURI.spec, "about:blank", + is(gBrowser.tabContainer.firstChild.linkedBrowser.currentURI.spec, "about:blank", "The first tab should be a blank tab"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.firstChild.nextSibling).currentURI.spec, TEST_PAGE_1, + is(gBrowser.tabContainer.firstChild.nextSibling.linkedBrowser.currentURI.spec, TEST_PAGE_1, "The middle tab should be the same one we opened"); - is(gBrowser.getBrowserForTab(gBrowser.tabContainer.lastChild).currentURI.spec, TEST_PAGE_2, + is(gBrowser.tabContainer.lastChild.linkedBrowser.currentURI.spec, TEST_PAGE_2, "The last tab should be the same one we opened"); is(acceptDialog, 0, "Two confirm dialogs should have been accepted"); is(acceptDialog, 0, "Two prompts should have been raised"); @@ -150,6 +155,7 @@ function test() { gBrowser.getBrowserAtIndex(gBrowser.tabContainer.selectedIndex).contentWindow.focus(); Services.obs.removeObserver(promptObserver, "common-dialog-loaded", false); + Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand"); finish(); } for (let i = 0; i < gBrowser.browsers.length; ++i) diff --git a/browser/components/sessionstore/test/browser_586068-cascaded_restore.js b/browser/components/sessionstore/test/browser_586068-cascaded_restore.js index 04a0bdfdd14..628a4380ef7 100644 --- a/browser/components/sessionstore/test/browser_586068-cascaded_restore.js +++ b/browser/components/sessionstore/test/browser_586068-cascaded_restore.js @@ -90,6 +90,8 @@ function runNextTest() { function test_cascade() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { @@ -220,6 +222,8 @@ function test_select() { function test_multiWindowState() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { @@ -297,6 +301,8 @@ function test_multiWindowState() { function test_setWindowStateNoOverwrite() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { @@ -366,6 +372,8 @@ function test_setWindowStateNoOverwrite() { function test_setWindowStateOverwrite() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { @@ -435,6 +443,8 @@ function test_setWindowStateOverwrite() { function test_setBrowserStateInterrupted() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { @@ -627,6 +637,8 @@ function test_reload() { // This doesn't actually test anything, just does a cascaded restore with default // settings. This really just sets up to test that reloads work. function test_reloadCascadeSetup() { + Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); + // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { diff --git a/browser/components/sessionstore/test/head.js b/browser/components/sessionstore/test/head.js index a96de64cbc6..4c34b366677 100644 --- a/browser/components/sessionstore/test/head.js +++ b/browser/components/sessionstore/test/head.js @@ -37,6 +37,14 @@ let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); +// Some tests here assume that all restored tabs are loaded without waiting for +// the user to bring them to the foreground. We ensure this by resetting the +// related preference (see the "firefox.js" defaults file for details). +Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); +registerCleanupFunction(function () { + Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand"); +}); + // This assumes that tests will at least have some state/entries function waitForBrowserState(aState, aSetStateCallback) { let windows = [window]; diff --git a/browser/components/tabview/test/head.js b/browser/components/tabview/test/head.js index 15bde63a5d4..f62ff59d8f7 100644 --- a/browser/components/tabview/test/head.js +++ b/browser/components/tabview/test/head.js @@ -1,6 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +// Some tests here assume that all restored tabs are loaded without waiting for +// the user to bring them to the foreground. We ensure this by resetting the +// related preference (see the "firefox.js" defaults file for details). +Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false); +registerCleanupFunction(function () { + Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand"); +}); + +// ---------- function createEmptyGroupItem(contentWindow, width, height, padding, animate) { let pageBounds = contentWindow.Items.getPageBounds(); pageBounds.inset(padding, padding);