Bug 711193 - Turn on "Don't load tabs until selected" by default. r=zpao

--HG--
extra : rebase_source : 7f3d38e4ad52f6e54512ea899466224fe836f762
This commit is contained in:
Paolo Amadini 2012-02-23 11:30:23 +01:00
Родитель 46e9753919
Коммит 71c9a87628
6 изменённых файлов: 58 добавлений и 23 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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];

Просмотреть файл

@ -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);