зеркало из https://github.com/mozilla/gecko-dev.git
Bug 665260 - Store start time in sessionstore data [r=dietrich]
This commit is contained in:
Родитель
8b11e411f2
Коммит
65bca0d683
|
@ -196,7 +196,11 @@ SessionStoreService.prototype = {
|
||||||
_browserSetState: false,
|
_browserSetState: false,
|
||||||
|
|
||||||
// time in milliseconds (Date.now()) when the session was last written to file
|
// time in milliseconds (Date.now()) when the session was last written to file
|
||||||
_lastSaveTime: 0,
|
_lastSaveTime: 0,
|
||||||
|
|
||||||
|
// time in milliseconds when the session was started (saved across sessions),
|
||||||
|
// defaults to now if no session was restored or timestamp doesn't exist
|
||||||
|
_sessionStartTime: Date.now(),
|
||||||
|
|
||||||
// states for all currently opened windows
|
// states for all currently opened windows
|
||||||
_windows: {},
|
_windows: {},
|
||||||
|
@ -343,7 +347,12 @@ SessionStoreService.prototype = {
|
||||||
this._initialState = { windows: [{ tabs: [{ entries: [pageData] }] }] };
|
this._initialState = { windows: [{ tabs: [{ entries: [pageData] }] }] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the session start time from the previous state
|
||||||
|
this._sessionStartTime = this._initialState.session &&
|
||||||
|
this._initialState.session.startTime ||
|
||||||
|
this._sessionStartTime;
|
||||||
|
|
||||||
// make sure that at least the first window doesn't have anything hidden
|
// make sure that at least the first window doesn't have anything hidden
|
||||||
delete this._initialState.windows[0].hidden;
|
delete this._initialState.windows[0].hidden;
|
||||||
// Since nothing is hidden in the first window, it cannot be a popup
|
// Since nothing is hidden in the first window, it cannot be a popup
|
||||||
|
@ -1509,9 +1518,13 @@ SessionStoreService.prototype = {
|
||||||
this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
|
this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
|
||||||
this._capClosedWindows();
|
this._capClosedWindows();
|
||||||
}
|
}
|
||||||
// Set recent crashes
|
|
||||||
|
// Set data that persists between sessions
|
||||||
this._recentCrashes = lastSessionState.session &&
|
this._recentCrashes = lastSessionState.session &&
|
||||||
lastSessionState.session.recentCrashes || 0;
|
lastSessionState.session.recentCrashes || 0;
|
||||||
|
this._sessionStartTime = lastSessionState.session &&
|
||||||
|
lastSessionState.session.startTime ||
|
||||||
|
this._sessionStartTime;
|
||||||
|
|
||||||
this._lastSessionState = null;
|
this._lastSessionState = null;
|
||||||
},
|
},
|
||||||
|
@ -3420,7 +3433,8 @@ SessionStoreService.prototype = {
|
||||||
|
|
||||||
oState.session = {
|
oState.session = {
|
||||||
state: this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR,
|
state: this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR,
|
||||||
lastUpdate: Date.now()
|
lastUpdate: Date.now(),
|
||||||
|
startTime: this._sessionStartTime
|
||||||
};
|
};
|
||||||
if (this._recentCrashes)
|
if (this._recentCrashes)
|
||||||
oState.session.recentCrashes = this._recentCrashes;
|
oState.session.recentCrashes = this._recentCrashes;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче