Firefox Sessionstore.js fixer

Sometimes Firefox opens with all of my tabs (and groups) empty: no session restore is provided and seems that all of my groups (more than 10 groups, with a total of 200 tabs) is simply disappeared.. it happend not only to me, as some googling shows.

What TH? Simply Firefox messed something up in your sessionstore.js file. Blogs suggest you to simply remove it and replace the backup automatically created by Firefox named sessionstore.old
But.. what if even this way gives you an empty set of tabs? Something is really wrong given the 3.8Mb sessionstore.js file!

The solution is only one: open the sessionstore.js file, fix its JSON contents and save it. But the problem here is: how can I edit a 3.8MByte JSON file without messing everything up?My solution is: write a tool to handle Firefox sessionstore.js! πŸ™‚ you can download it (calledΒ  FFSessionfix) from my BitBucket account:

It’s written in PHP (don’t blame me, it was my first and super-fast solution to get my groups and tabs back) and allowed me to fix and restore my 200 tabs! how? Simply fixing the data about closed windo that contained all of my tabs!

# Find the *real* window (look the [tabs] and the item count
php ffsessionfix.php dump sessionfile.js

# Remove the unused windows (and save to new file newsession.js)
php ffsessionfix.php removeWindow --closed-window-id=2 --output=newsession.js sessionstore.js

# Unclose the main window
php ffsessionfix.php uncloseWindow --closed-window-id=1  --output=newsession.js newsession.js

# Backup sessionstore
mv sessionstore.js sessionstore.js.old

# Replace sessionstore and use the new one
mv newsession.js sessionstore.js


Feel free to clone my repository and improve it!

Thanks to Dag Wieers post for some insights!


11 thoughts on “Firefox Sessionstore.js fixer

  1. Hi,
    I have the same bug but with _closedWindows.
    Haven’t tried a fix yet but maybe the same trick as _closedTabs will work.

    ~ Shogo.

  2. You need PHP and a shell, plus some Command Line Interface or CLI knowledege.. if your answer to the question “do I know how to run a PHP script from CLI?” is No, start googling πŸ™‚

  3. As if everybody has that nerdy Linux and PHP installed locally… make it at least an online script.

  4. keep getting this error message

    “An error occured, please reload the page and try again”

    and nothing more.


Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.