What if Firefox loses your tabs ?
It happened to me today, not sure if it was because I closed my main window and firefox had some other window in the back ? But the next run all my tabs were gone, and they were nowhere to be found in my 'Recently Closed Tabs' list. My sessionstore.js was huge, but re-opening Firefox only brought up the default homepage.
If this happens to you on re-opening Firefox, don't blink a second, make a copy of your sessionstore.bak and sessionstore.js so that Firefox doesn't replace them and you lose everything.
In my case re-opening didn't really make any difference, all tabs were still in the sessionstore.js, even though I couldn't get to them properly from within Firefox. Even my pinned tabs were missing.
Some websites provide tools (in perl or python) to recover all URLs from your sessionstore.js, but that included a lot more than what was open, so many that Firefox would start swapping and the machine died on me. So no luck there.
The sessionstore.js is in fact one big JSON file. But it is unusable as everything is on a single line. No luck using an editor on that file like this. So the first thing was to look for something to make the information readable. There is a JSONview add-on for Firefox, but before complicating my problem with new tools I wanted to look at it using VIM.
On my RHEL 6.1 desktop I had two JSON commands: json_verify and json_reformat. My first thought was the sessionstore.js was somehow corrupt, but json_verify did not agree with me. Sending my sessionstore.js to json_reformat
# cat sessionstore.bak.copy | json_reformat >sessionstore.js
provided me with human-parseable output. By looking at the file, it was obvious that the sessions I wanted were considered Closed Tabs and there was only one Tab active.
By deleting the active session(s) and deleting the start of the _ClosedTabs structure, so that all my sessions are inside the tabs structure, you can restore those _ClosedTabs with the least amount of effort (so simply deleting the right lines so the structures parse fine in the right section)
Hope this is of use to you one day too !