Manually removing tabs from the Firefox session manager
So… something weird happened. I clicked a link, and it crashed Firefox. And my whole Sway session. Back to my TUI login manager… Login again, open Firefox: same crash, back to the login manager again. Now this is getting annoying.
One easy way to fix that would be to remove the session manager data from my Firefox profile. But I don’t want to lose my other 114 tabs just because of that one! So, let’s get to the next best solution: manually removing the offending tab from the sesion manager data.
Firefox stores its data in a “profile”, in ~/.mozilla/firefox
. Mine is in ~/.mozilla/firefox/deh357qb.default
. The
session storage data is then stored sessionstore.jsonlz4
, although after a crash that file is no longer available, and
sessionstore-backups/recovery.jsonlz4
has to be used instead.
What’s that .jsonlz4
extension? Well, it’s JSON, compressed by a Mozilla-specific LZ4 variant. Luckily, an Open Source
tool exists to decompress and recompress this file format: mozlz4
. After
installing it from the AUR, it becomes possible to patch that file:
- Backup the original file:
cp recovery.jsonlz4 recovery.jsonlz4.old
- Decompress and unminify it:
mozlz4 -x recovery.jsonlz4 | jq > recovery.json
- Open
recovery.json
with a text editor that supports very large files. (For me, the uncompressed JSON file was 79 MB.) - Remove the offending entries from the huge JSON file.
- Minify and recompress the file:
cat recovery.json | jq -c | mozlz4 -c - > recovery.jsonlz4
- Open Firefox
- ???
ProfitIt works!
Not exactly what I’d call user-friendly, but at least Firefox works again, without losing any tab.
Comments
Join the conversation by sending an email. Your comment will be added here and to the public inbox after moderation.