Session lost during Windows update, now I can't force Firefox to recover the session from my sessionstore.jsonlz4 file
After a windows update yesterday, when I started Firefox it didn't load my previous session as usual. Previously, I've been able to go to settings and restore the session, but there were no options for that and the relevant session wasn't shown in the recently closed tabs or windows, even though the history was intact. It loaded a new/blank window, and since then when I close and either re-open or try to restore a previous session, it only opens the tabs that I've opened today.
Firefox 118.0.2 (64-bit), Windows 10 PC.
Here are the steps I've taken:
- Turned off the "Open previous windows and tabs" in the startup options to get access to the "restore previous session" option
- Gone to the profile folder and copied, then removed the contents of the sessionstore-backups folder
- Copied the relevant backup session file (looks like it has the tabs I need when I scan it) to my desktop and renamed it "sessionstore.jsonlz4"
- Replaced the existing "sessionstore.jsonlz4" file in the root profile folder with the new one from my backups
- Reopened Firefox
It still just loaded my tabs from today, and doesn't show the session I'm looking for in recently closed tabs or recently closed windows. When I go to about::sessionstore, it says it's having trouble getting my tabs and pages back, and there's no option to reload a session.
I checked my sessionCheckpoints file in my profile root folder, and it only had these values: {"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true}
I updated it to include these values and restarted again, but the result was identical: {"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}
When I open the sessionstore.jsonlz4 file in Notepad++ I can read it normally, and when I just double-click to open it in Firefox it appears to parse correctly in terms of both structure and data... the tab 0/entry 0/URL shows the URL of the first tab that I had open, tab 1/entry 0/URL shows the URL of the second tab, and so on. So it looks like the data is there, but I can't seem to force Firefox to load that.
Any suggestions for what I'm missing?
모든 댓글 (5)
A sessionstore file with a .jsonlz4 file extension is normally LZ4 compressed, so you can't open it in a text editor for inspection as you would only see binary garbage. Did you decompress the file as in that case you need to use the .json file extension?
You can look at this tool to inspect a compressed jsonlz4 sessionstore file to find a suitable backup to restore. This tool works locally, no uploading done.
Best in such a case is restoring a recent upgrade file created with the most recent update (current is 118.0.2).
You can restore a upgrade.jsonlz4 file from a recent/last update or use a utility to browse Windows System Restore points to see if you can find a recent sessionstore.jsonlz4 file.
cor-el said
A sessionstore file with a .jsonlz4 file extension is normally LZ4 compressed, so you can't open it in a text editor for inspection as you would only see binary garbage. Did you decompress the file as in that case you need to use the .json file extension? You can look at this tool to inspect a compressed jsonlz4 sessionstore file to find a suitable backup to restore. This tool works locally, no uploading done.
Best in such a case is restoring a recent upgrade file created with the most recent update (current is 118.0.2).
You can restore a upgrade.jsonlz4 file from a recent/last update or use a utility to browse Windows System Restore points to see if you can find a recent sessionstore.jsonlz4 file.
Thanks - that helps! That is the tool I used to recover it, so I believe that what I have is the uncompressed version (which is why I can read it).
In the "step 2" on the Session History Scrounger page, the only options I see to save the file are uncompressed JSON (sessionstore.js format), embedded session (first round only), and uncompressed JSON as text, so I used the uncompressed JSON (sessionstore.js format) option.
Is there a way to convert my js file to jsonlz4? Or another step to use the sessionstore.js file to get my sessions back?
If you still have the compressed .jsonlz4 file you used with the scrounger then easiest is to use that file and rename it to sessionstore.jsonlz4 and place it at the root level of the profile folder with Firefox closed to replace the existing sessionstore.jsonlz4. This is an example of the case where you only use the tool to inspect a compressed file to see whether it is of use and determine what file is best to use for restoring a session.
cor-el said
If you still have the compressed .jsonlz4 file you used with the scrounger then easiest is to use that file and rename it to sessionstore.jsonlz4 and place it at the root level of the profile folder with Firefox closed to replace the existing sessionstore.jsonlz4. This is an example of the case where you only use the tool to inspect a compressed file to see whether it is of use and determine what file is best to use for restoring a session.
Oh, I may be out of luck, then... I do have a file where the file type (not just the extension) shows as JSONLZ4, but I can read it in notepad, so it reads like a typical uncompressed file (not binary gibberish). I must have overwritten the original. Any option to still use that uncompressed file, or does it come down to going through the JSON and manually re-opening the tabs from that one by one?
I think that Firefox would still be able to build the bookmarks from an uncompressed backup since you can create such a backup yourself, you only need to give it the correct file extension (i.e. remove the trailing lz4 to get .json).
You can possibly use this code in the Browser Console to compress or decompress a JSON file.
javascript:/*(DE)COMPRESS LZ4::2023/10-14*/ (function(){ /*IOUTILS - [80]*/ async function copyFile(inpFile, outFile) { var data = await IOUtils.readUTF8(inpFile, /lz4$/.test(inpFile) ? {decompress:true} : {decompress:false}); await IOUtils.writeUTF8(outFile, data, /lz4$/.test(outFile) ? {compress:true} : {compress:false}); } var fu = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "Open File", Ci.nsIFilePicker.modeOpen); fp.appendFilter(".JSON Uncompressed Files","*.json"); fp.appendFilter(".*LZ4* Compressed Files","*.*lz4"); fp.displayDirectory=fu.File(PathUtils.join(PathUtils.profileDir,"")); fp.open((aResult)=>{ if (aResult==Ci.nsIFilePicker.returnOK){ if(fp.file.exists()&&fp.file.isFile()&&fp.file.isReadable()){ var inpFile=fp.file.path; var outFile=inpFile.replace(/lz4$/i,"")+(/lz4$/.test(inpFile)?"":"lz4"); // prompt(inpFile+"\n"+outFile); try{ copyFile(inpFile, outFile); console.log("Saved as: \"file://" + outFile + "\""); // prompt("Saved as:\n" + outFile,"file://" + outFile); } catch(err){console.log(err);} } }else{console.log("<canceled>");} }); })()
글쓴이 cor-el 수정일시