Bug 824021 - Don't clear set of windows to resurrect on write when receiving messages r=yoric

This commit is contained in:
Tim Taubert 2014-04-16 14:27:47 +02:00
Родитель 2942463f2e
Коммит c26913c29d
2 изменённых файлов: 27 добавлений и 18 удалений

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

@ -678,8 +678,6 @@ let SessionStoreInternal = {
debug("received unknown message '" + aMessage.name + "'");
break;
}
this._clearRestoringWindows();
},
/**
@ -3400,6 +3398,15 @@ let SessionStoreInternal = {
this._closedWindows.splice(spliceTo, this._closedWindows.length);
},
/**
* Clears the set of windows that are "resurrected" before writing to disk to
* make closing windows one after the other until shutdown work as expected.
*
* This function should only be called when we are sure that there has been
* a user action that indicates the browser is actively being used and all
* windows that have been closed before are not part of a series of closing
* windows.
*/
_clearRestoringWindows: function ssi_clearRestoringWindows() {
for (let i = 0; i < this._closedWindows.length; i++) {
delete this._closedWindows[i]._shouldRestore;

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

@ -115,25 +115,27 @@ function test_3() {
is(curState.selectedWindow, 4, "Last window opened is the one selected");
waitForWindowClose(normalWindow, function() {
// Load another tab before checking the written state so that
// Pin and unpin a tab before checking the written state so that
// the list of restoring windows gets cleared. Otherwise the
// window we just closed would be marked as not closed.
waitForTabLoad(aWindow, "http://www.example.com/", function() {
forceWriteState(function(state) {
is(state.windows.length, 2,
"sessionstore state: 2 windows in data being written to disk");
is(state.selectedWindow, 2,
"Selected window is updated to match one of the saved windows");
state.windows.forEach(function(win) {
is(!win.isPrivate, true, "Saved window is not private");
});
is(state._closedWindows.length, 1,
"sessionstore state: 1 closed window in data being written to disk");
state._closedWindows.forEach(function(win) {
is(!win.isPrivate, true, "Closed window is not private");
});
runNextTest();
let tab = aWindow.gBrowser.tabs[0];
aWindow.gBrowser.pinTab(tab);
aWindow.gBrowser.unpinTab(tab);
forceWriteState(function(state) {
is(state.windows.length, 2,
"sessionstore state: 2 windows in data being written to disk");
is(state.selectedWindow, 2,
"Selected window is updated to match one of the saved windows");
state.windows.forEach(function(win) {
is(!win.isPrivate, true, "Saved window is not private");
});
is(state._closedWindows.length, 1,
"sessionstore state: 1 closed window in data being written to disk");
state._closedWindows.forEach(function(win) {
is(!win.isPrivate, true, "Closed window is not private");
});
runNextTest();
});
});
});