Bug 1073502 - Restore closed windows even when there are no open windows on startup r=yoric

This commit is contained in:
Tim Taubert 2014-09-25 12:17:00 +02:00
parent c6d1a998a4
commit 5a90497000

View File

@ -2202,12 +2202,9 @@ let SessionStoreInternal = {
if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
this.onLoad(aWindow);
let root;
try {
var root = typeof aState == "string" ? JSON.parse(aState) : aState;
if (!root.windows[0]) {
this._sendRestoreCompletedNotifications();
return; // nothing to restore
}
root = (typeof aState == "string") ? JSON.parse(aState) : aState;
}
catch (ex) { // invalid state object - don't restore anything
debug(ex);
@ -2215,15 +2212,23 @@ let SessionStoreInternal = {
return;
}
// Restore closed windows if any.
if (root._closedWindows) {
this._closedWindows = root._closedWindows;
}
// We're done here if there are no windows.
if (!root.windows || !root.windows.length) {
this._sendRestoreCompletedNotifications();
return;
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");
// We're not returning from this before we end up calling restoreTabs
// for this window, so make sure we send the SSWindowStateBusy event.
this._setWindowStateBusy(aWindow);
if (root._closedWindows)
this._closedWindows = root._closedWindows;
var winData;
if (!root.selectedWindow || root.selectedWindow > root.windows.length) {
root.selectedWindow = 0;