Closed Bug 398504 Opened 17 years ago Closed 17 years ago

New preference to always restore session if not resuming from a crash

Categories

(Firefox :: Session Restore, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mozilla, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)

This patch adds a new preference that allows power users to disable the "restore session" dialog and have it always automatically restore the previous session.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.



diff -Naur ./components/nsSessionStartup.js ../new/components/nsSessionStartup.js
--- ./components/nsSessionStartup.js    2007-10-03 21:17:51.000000000 -0500
+++ ../new/components/nsSessionStartup.js       2007-10-03 21:00:39.000000000 -0500
@@ -85,6 +85,9 @@
 // resume the current session at startup if it had previously crashed
 const DEFAULT_RESUME_FROM_CRASH = true;

+// resume the current session at startup without prompting
+const DEFAULT_RESUME_SESSION_AUTOMATICALLY = false;
+
 function debug(aMsg) {
   aMsg = ("SessionStartup: " + aMsg).replace(/\S{80}/g, "$&\n");
   Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
@@ -258,6 +261,10 @@
     if (!this._getPref("sessionstore.resume_from_crash", DEFAULT_RESUME_FROM_CRASH))  
       return false;

+    // Just resume, do not prompt if not post-crash and requested
+    if (this._getPref("sessionstore.resume_session_automatically", DEFAULT_RESUME_SESSION_AUTOMATICALLY))
+      return true;
+
     // if the prompt fails, recover anyway
     var recover = true;
     // allow extensions to hook in a more elaborate restore prompt
diff -Naur ./defaults/pref/firefox.js ../new/defaults/pref/firefox.js
--- ./defaults/pref/firefox.js  2007-10-03 20:55:37.000000000 -0500
+++ ../new/defaults/pref/firefox.js     2007-10-03 21:01:41.000000000 -0500
@@ -509,6 +509,7 @@
 pref("browser.sessionstore.enabled", true);
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_session_once", false);
+pref("browser.sessionstore.resume_session_automatically", false);

 // minimal interval between two save operations in milliseconds
 pref("browser.sessionstore.interval", 10000);
You're aware you can set Firefox to "Show my windows and tabs from last time" in options, right? How is what you're proposing different?
Setting browser.sessionstore.resume_session_automatically to true eliminates the "Restore Session / Start New Session" dialog box.  If firefox did not crash during the last session restore, then it will *always* restore the previous session without prompting.  

Setting "Show my windows and tabs from last time" just sets the browser.startup.page preference to 3 -- this (plus setting the browser.sessionstore.enabled preference to true) only enables saving/restoring the previous session but it *always* prompts with a dialog first.  In all the time I've used firefox, I've never had a reason to choose "Start New Session" except for after a during-session-restore crash.

-Michael

PS: I modified my own install to do this a while ago, but I was inspired to clean it up (actually make it a preference instead of a hack) and publish it after listening to episode #26 of the Logically Critical podcast (http://www.logicallycritical.net)

PPS: I used to use the SessionSaver extension to do this before sessionstore was added to firefox
Pretty much the same patch has already been proposed in bug 394099. Still not going to introduce a new preference without good reason (which seems to be missing completely in this bug). -> WONTFIX

Please rather file new bugs on the crashes which lead to the prompt in the first place and use the work-around from bug 394099 comment #3 until the fixes make it into an official Firefox release.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
Comment on attachment 283495 [details] [diff] [review]
Patch to implement this new preference

Two details for when you contribute your next patch:

* Asking a specific person for review largely improves your chances of actually getting one (see http://www.mozilla.org/projects/firefox/review.html for a list of Firefox reviewers).

* Always create your patches against the active development branch (or Trunk if there is none). For stable branches (such as Firefox 2.0.0.x), security and crash fixes are pretty much the only ones to stand a chance of being included at all.
Attachment #283495 - Flags: review?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: