Can I disable firefox automatic session restore
Hi, I would like to start firefox with a new session (one tab on my home page) I am using Firefox 74.0 on openSUSE Leap 42.3 - KDE Plasma 5.8.7. In the preferences I have "Restore previous session" unchecked. in about:config I have:
browser.sessionstore.resume_from_crash false browser.sessionstore.max_resumed_crashes 0
I don't have a user.js
I log out of KDE without closing firefox. At the next login all my tabs and windows are restored. I would like to start with a new session with the option of restoring the old session using the menu. I want to keep my history and the undo close tab/window functionality. Is there a way to do this ?
この投稿は leishman により
すべての返信 (10)
What is the content of sessionCheckpoints.json in the profile folder if you let KDE close Firefox compared to when you close Firefox yourself ?
Hi all and thanks again for your time.
OK we seem to be making progress. After logging in this morning and starting firefox the session was restored as usual. I looked at the profile *before* starting firefox.
in prefs.js thre is an entry:
user_pref("browser.sessionstore.resume_session_once", true);
The sessionCheckpoints.json file contains:
{"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true,"quit-application-granted":true,"quit-application":true,"sessionstore-final-state-write-complete":true,"profile-change-net-teardown":true,"profile-change-teardown":true,"profile-before-change":true}
A file sessionstore.jsonlz4 exists
But how does the resume_session_once config get set ?
The content of sessionCheckpoints.json file you posted indicates the Firefox did close properly (all items are true and none false) that last time and that is confirmed that you got the tabs back.
If the problem returns then you can check sessionCheckpoints.json to see if there are items that have a false value that indicates that not all checkpoint have been completed on the last close.
leishman said
But how does the resume_session_once config get set ?
Good question. It should be set to false after session restore. Can you see that in about:config ?
If Firefox isn't updating prefs.js to match what you see in about:config the problem could be one of the things mentioned in the following article: How to fix preferences that won't save.
If Firefox is updating prefs.js but then some other process is overriding it, the mystery remains.
Hmm...
But if I close firefox manually (quit from menu) the session *is not* restored when I restart firefox.
when I restart with the sessionCheckpoints.json I posted (together with the rest of the profile state) the session *is* restored.
The difference seems to be the browser.sessionstore.resume_session_once setting in prefs.js.
But why is it set ?
If I look in about:config the value of browser.sessionstore.resume_session_once is false.
I checked with the linux audit function which process is modifying the pref.js file - It is only the firefox-bin process.
So If I quit from the menu the resume_session_once item is not set but if I logout of the desktop firefox sets resume_session_once to be true in prefs.js
but why ???
and how can I stop it ???
leishman said
As I mentioned above - if I quit firefox by closing it manually everything is fine - When I restart firefox it will start with a new session. Why don't I do this ? When I logout (usually to shutdown) I have lots of windows open. I don't want to spend time going around my desktops closing everything (call me lazy).
<big><big>? ? ? </big></big>
Firefox will automatically reset browser.sessionstore.resume_session_once when you start Firefox, so the pref would appear default.
You can check if you have a user.js file in the profile folder to initialize prefs each time Firefox starts. The user.js file will only be present if you or other software has created this file and normally won't be present.
You can check its content with a text editor (right-click: "Open with"; do not double-click). The user.js file is read each time Firefox is started and initializes preferences to the value specified in this file, so preferences set via user.js can only be changed temporarily for the current session.
You can delete the user.js file if you didn't create this file yourself.
You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.
- Help -> Troubleshooting Information -> Profile Folder/Directory:
Windows: Open Folder; Linux: Open Directory; Mac: Show in Finder - https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
You can create a new profile as a quick test to see if your current profile is causing the problem.
See "Creating a profile":
If the new profile works then you can transfer files from a previously used profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over problems.
cor-el, could you take a look at this -- it seems that if Firefox receives a signal that it is quitting due to an OS restart, then it will set automatic session resumption:
https://dxr.mozilla.org/mozilla-release/source/browser/components/sessionstore/SessionStore.jsm#1948
I'm not aware of that happening on Windows (except Windows 10 with startup integration). Perhaps that code is directed toward a signal sent by or easily read on Linux?
Hi all and thanks again for your time.
If I understand the code correctly the resume_session_once flag is set for restart or os-restart. I checked the profile (after logout login before starting firefox) and the sessionstore.resuming_after_os_restart flag is not set. That would indicate that this is not an os-restart. But it may be a restart. I thought this was used for things like restarting the browser after installing an add-on. It certainly shouldn't be used when logging out and logging in - that would defeat the whole purpose of the configuration (restore or not) in the general preferences.
The profile I am using is new - I set it up when I moved to firefox 74.
I think I mentioned earlier in this thread that I don't have a user.js.
OK - I have a workaround. I have now created a user.js file . it contains one line:
user_pref("browser.sessionstore.resume_session_once", false);
This means the resume_session_once flag is reset and firefox starts with a new session with the ability to restore the old session from the menu - exactly what I want !!!!
The downside - resume_session_once will *NEVER* work. So for example a restart after installing an add-on will presumably start a new session. I think I can live with that.
Still I think it would be better if the resume_session_once flag is not set on logout and session restore is left to the normal configuration.