Increase Sessionstore Files or Backup times?
Hey I've been having a few problems on the "power user" extreme side of day to day use. I've had a couple big crashes now on Firefox where my session doesn't restore and because I have hundreds of tabs open at any given time I always back them up manually from sessionstore in the folder system. The problem is the session store files always reflect my most recent session- the one that doesn't have anything in it. The older sessions like "previous" and "upgrade" are always weeks old.
Is there a way to save data more frequently into the session store backup folder, or to increase the number of recovery files available to reach back to older sessions? I'd like to count on a backup at least once a week that can't be overwritten by the current session loss.
Toate răspunsurile (2)
You can search the Add-ons website for a suitable extensions manager extension.
You can also use code in the Browser Console to save/restore the current session. Creating a backup this way includes PB mode tabs/windows.
To enable the command-line in the console:
- select "Enable browser chrome and add-on debugging toolboxes" in the Web Developer Tools settings
- https://firefox-source-docs.mozilla.org/devtools-user/settings/
See:
- /questions/1401277#answer-1558166 Recover lost tabs
You can create a compressed sessionstore.jsonlz4 or not compressed sessionstore.json file with a timestamp.
/* Save Session data to .json or .jsonlz4 */ var ssj = SessionStore.getBrowserState(); if(ssj){ async function writeFile(aFile,ssj){await IOUtils.writeUTF8(aFile,ssj,/lz4$/.test(aFile) ? {compress:true} : {compress:false});} function dts(d){return(d.getFullYear()+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2, "0")+"_"+d.toTimeString().replace(/:/g,"-").split(" ")[0])} var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "Save Session", Ci.nsIFilePicker.modeSave); fp.appendFilter("JSON/LZ4 Files", "*.json*"); fp.defaultString = "sessionstore-"+dts(new Date())+".jsonlz4"; fp.open(aResult => { if (aResult == Ci.nsIFilePicker.returnOK || aResult == Ci.nsIFilePicker.returnReplace) { try { writeFile(fp.file.path, ssj); alert("Saved as:\n" + fp.file.path); } catch (err) {alert(err);} } else {alert("CANCELED");} }); }
/* Restore Session data from .json or .jsonlz4 */ async function readFile(aFile){ var ssj = await IOUtils.readUTF8(aFile, /lz4$/.test(aFile) ? {decompress:true} : {decompress:false}); SessionStore.setBrowserState(ssj); } var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "Open File - Load Session", Ci.nsIFilePicker.modeOpen); fp.appendFilter("JSON/JSONLZ4", "*.*json*"); fp.open(aResult => { if (aResult == Ci.nsIFilePicker.returnOK) { try { readFile(fp.file.path); alert("Session Restored:\n" + fp.file.path); } catch (err) {alert(err);} } else {alert("CANCELED");} });
Modificat în
You can look at this tool to inspect a compressed jsonlz4 sessionstore file. This tool works locally, no uploading done.