Bug 481786 - Current session data is getting lost when starting Firefox in "Always On" mode; r=zeniko

This commit is contained in:
Ehsan Akhgari 2009-03-08 18:23:13 +03:30
parent 238c579e67
commit ed3e8a5706
2 changed files with 11 additions and 2 deletions

View File

@ -43,7 +43,8 @@
# * Overview
# * This service reads user's session file at startup, and makes a determination
# * as to whether the session should be restored. It will restore the session
# * under the circumstances described below.
# * under the circumstances described below. If the auto-start Private Browsing
# * mode is active, however, the session is never restored.
# *
# * Crash Detection
# * The session file stores a session.state property, that
@ -95,6 +96,12 @@ SessionStartup.prototype = {
* Initialize the component
*/
init: function sss_init() {
// do not need to initialize anything in auto-started private browsing sessions
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
if (pbs.autoStarted)
return;
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).getBranch("browser.");

View File

@ -415,7 +415,9 @@ SessionStoreService.prototype = {
case "exit":
aSubject.QueryInterface(Ci.nsISupportsPRBool);
let quitting = aSubject.data;
if (quitting) {
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
if (quitting && !pbs.autoStarted) {
// save the backed up state with session set to stopped,
// otherwise resuming next time would look like a crash
if ("_stateBackup" in this) {