This is a quick-n-dirty how-to fixit for one particularly brain-dead Firefox bug.  It’s two parts: the short term fix, and the long term fix.

This will only help you in case you encounter a particular version of the generally buggy Firefox session management.  In this version of the bug, you open Firefox one day to discover that all of your tabs (and tab groups) are gone. However, when you eventually do follow the breadcrumbs and find your sessionstore.js, you may notice that it’s really small, while sessionstore.bak is much larger.  If this is the case, then you may be suffering from this annoying (and yet fixable) problem.

So, here’s what you do when your tabs disappear.

  1. Exit Firefox.  Print this page, or open it in another browser, but get out of Firefox.
  2. Locate your sessionstore.js. This page tells you where to look for it.  
  3. Copy all of the sessionstore.* files somewhere safe, just in case.
  4. Check the file sizes.  If the backups are larger than the .js file, then you might be in luck.
  5. Make a copy of the most promising backup, and do a JSON pretty-print of it.  One tool that can help you do this is jsonpp.  Here’s an online tool that does the same thing, if you don’t care if the world sees your links or whatever.
  6. Scroll to the bottom of the file, and look around for a "windows" : [] structure.  If you find it, that’s good news: you almost certainly have encountered this bug.
  7. Scroll to the top and look for a "_closedWindows" : [ structure (yes, I intentionally omitted the closing bracket).  If it has a whole bunch of things in its brackets, then move that content into the brackets of the "windows" structure.  Don’t copy it, move it.  If you’re using vim like an intelligent and sane person, then just do: /_closedWindowsjVk$%kx/"windows"/[aPZZ
  8. Move this file to sessionstore.js in your profile directory (from where you got the original).
  9. Open Firefox.  Voila, your tabs and groups are restored.

Step two, the long term fix: stop using Firefox, and start using Chrome/Safari/Opera.