Wednesday, August 27, 2014

How I Recovered Lost Tabs In Firefox

Recently Firefox crashed and when I opened it, all my tabs were gone.

This is how I got them back.

  1. DO NOT CLOSE AND REOPEN FIREFOX!
  2. Immediately find the "sessionstore.bak" file and make a copy of it to sessionstore.txt.
    cp ~/.mozilla/firefox/*.default/sessionstore.bak ~/sessionstore.txt
    (Windows users
    C:\Users\name\AppData\Roaming\Mozilla\Firefox\Profiles\<random>.default\sessionstore.bak)
  3. Open the file with a text editor and paste it into this site http://jsonviewer.stack.hu/. To make it readable, Click "format".
  4. Save the output to a new file named "sessionstore2.txt"
  5. Open the new file in a text editor.
At the top of my file it looked like this:

{
    "windows": [

    ],
    "selectedWindow": 0,
    "_closedWindows": [
       {
            "tabs": [
              {

I deleted 4 lines so it looked like this:

{
    "windows": [
       {
            "tabs": [
              {


  1. Save the file.
  2. Close all Firefox windows.
  3. Delete the old sessionstore.js file.
    ~/.mozilla/firefox/*.default/sessionstore.js
    OR
    C:\Users\name\AppData\Roaming\Mozilla\Firefox\Profiles\<random>.default\sessionstore.js
  4. Move "sessionstore2.txt" to replace the deleted file. Rename it correctly as sessionstore.js.
  5. Start Firefox and see if it worked.

Hopefully this helps!


An alternate way to format JSON on Linux.
$ json_reformat < sessionstore.txt > sessionstore2.txt