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. With my script you can also change/remove _closedWindows data… give it a try! πŸ™‚

  3. how can i use it? im a simple user with no knowledge πŸ™

  4. 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 πŸ™‚

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

  6. I know, but why don’t you provide it? It’s free software, not free solutions..

  7. keep getting this error message

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

    and nothing more.


Comments are closed.