Restore previous session though unchecked always tries to restore previous session on startup. It's annoying! (Revived)
I'm having the exact same problem as what was originally mentioned in this post from 4 years ago.
The "chosen solution" was to exit firefox through the hamburger menu, which I find to be absolutely ridiculous. You mean to tell me that even though I close EVERY OTHER APPLICATION either using the "X" close button or a custom keybinding that I've set for my own personal convenience, firefox requires me to exit through a menu every time in order to make it behave the way I've told it to? No. Absolutely not. If I tell firefox that I don't want it to save my last session, that means I DON'T WANT IT TO SAVE MY LAST SESSION. If I've deselected the "open previous windows and tabs" option in the settings, then under no circumstances should it be trying to open my previous windows and tabs.
I've tried the suggestion to change the value of browser.sessionstore.max_resumed_crashes from 1 to 0. The problem persists, I assume because firefox considers being closed using the close button to be a "crash", which is interesting.
I the other suggestion further down in the thread was to set browser.sessionstore.resume_from_crash from true to false, which will prevent firefox from recovering a session from a crash. This is hardly an appropriate solution. I want firefox to resume my last session if there is a legitimate (key word LEGITIMATE) crash, because my session was closed against my will due to something that went wrong. Being able to recover my last session in such a situation is nice. I do not, however, want firefox to resume my last session when I explicitly closed the last session myself, which would be the difference between a crash recovery and restoring a previous session. If no crash occurred, I don't need a crash recovery, and aside from a crash, I don't want my previous session to be restored.
Are there any solutions to this at all? Because this is one of the biggest reasons why I stopped using firefox. I want to come back to firefox because everything else that's worth using is either dog shit, or Chromium-based (i.e. also dog shit). However, I find this broken feature to be somewhat of a security issue. If a bad actor somehow gains access to my system, I don't want him to be able to open firefox and have access to my last browser session because I closed firefox using a keyboard shortcut instead of closing it through a goddamned menu.
所有回复 (8)
None of this will protect you if a bad actor has access to your system, it is trivial to manually restore the last session (History > Restore Previous Session (Ctrl+Shift+T)). If you don't want the last session to be restorable, you can enable private browsing mode.
The shortcut for the Quit menu item on Linux is Ctrl+Q. Using the close button to quit is not detected as a crash unless there is something wrong with your configuration.
Note that Firefox automatically sets browser.sessionstore.resuming_after_os_restart and browser.sessionstore.resume_session_once to true on Linux if you let the OS close Firefox instead of closing Firefox properly (Services.appinfo.restartedByOS).
See onQuitApplication:
cor-el said
Note that Firefox automatically sets browser.sessionstore.resuming_after_os_restart and browser.sessionstore.resume_session_once to true on Linux if you let the OS close Firefox instead of closing Firefox properly (Services.appinfo.restartedByOS). See onQuitApplication:
I just double checked and I have both of these set to false. Any other ideas on what might be causing this behavior?
zeroknight said
None of this will protect you if a bad actor has access to your system, it is trivial to manually restore the last session (History > Restore Previous Session (Ctrl+Shift+T)). If you don't want the last session to be restorable, you can enable private browsing mode. The shortcut for the Quit menu item on Linux is Ctrl+Q. Using the close button to quit is not detected as a crash unless there is something wrong with your configuration.
Bad actors are not always necessarily tech savvy, nor are they always necessarily bad people who mean to attack you. Your snoopy grandmother could be a type of bad actor. You and I know that it's a trivial matter to manually restore a previous session, but snoopy grandma who doesn't know how to mind her own business might not know. Snoopy grandma is also someone around whom a person could be expected to let his guard down.
Furthermore, neither using private browsing at all time nor using Firefox's keyboard shortcut are acceptable solutions a web browser not behaving as the user has told it to. My muscle memory is to use my own custom shortcut, not Firefox's.
Those two prefs are always set to false during a Firefox session (i.e. Firefox is running), they are set during shutdown when necessary, you would have to check prefs.js when Firefox is closed.
browser.sessionstore.resume_session_once is also used for restoring the last session in cases where Firefox wants/needs to be restarted and if you restart via the about:profiles page.
cor-el said
Those two prefs are always set to false during a Firefox session (i.e. Firefox is running), they are set during shutdown when necessary, you would have to check prefs.js when Firefox is closed. browser.sessionstore.resume_session_once is also used for restoring the last session in cases where Firefox wants/needs to be restarted and if you restart via the about:profiles page.
I just took a look at my prefs.js file and I actually didn't find either of those settings there. The comments at the top of the file say not to change it. It says any changes need to be made either in about:config or in the user.js file. I didn't find a user.js file, but I also didn't look very far for it. Regardless, the problem still remains that neither of these settings do quite what I want. I want to be able to close Firefox using custom keyboard shortcuts that are set through my window manager, without Firefox asking to restore my session every time the next time I open Firefox.
When I explicitly close Firefox, the next time I open it I want it to open directly to the homepage that I have set, not a prompt to restore the last session. The only time I want to be prompted to restore my last session is when an actual crash occurs. If Firefox is unable to tell the difference between a crash and a keyboard shortcut, then I'd rather have it just not ask to restore my last session at all.
Firefox uses sessionCheckpoints.json to record what tasks have been completed when Firefox is closed. Any task that isn't completed (i.e. is false) is tried again on the next start.
The warning at the top merely means that you need to be careful with making changes in this file as you can easily cripple Firefox. You shouldn't use user.js to override these prefs to false as that will cause (session) data loss if Firefox wants/needs to be restarted for legitimate reasons (browser.sessionstore.resume_session_once is used in such a case).
Signal termination (SIGTERM) should cleanly close Firefox in the latest Nightly (122.0a1) now that Bug 1837907 has been fixed.
Until this reaches stable, setting browser.sessionstore.resume_from_crash to false in about:config should solve your problem without losing the ability to manually restore the last session.
cor-el said
You shouldn't use user.js to override these prefs to false as that will cause (session) data loss
It could only lead to data loss if the last session is not manually restored but that is always the case with "Open previous windows and tabs" disabled.