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