Where does Firefox store the sessionStorage content

后端 未结 1 1658
遥遥无期
遥遥无期 2021-01-12 14:52

I am trying to find out where Firefox stores the sessionStorage content but have been unable to find so. I am expecting it to be in a SqLite database like the localStorage c

相关标签:
1条回答
  • 2021-01-12 15:42

    localStorage data is saved in the file webappsstore.sqlite in the Firefox profile. There is a funny tweak that host names are reverted (gro.allizom instead of mozilla.org) but other than that it is pretty much what you would expect. There is only one table:

    CREATE TABLE webappsstore2 (
      scope TEXT,
      key TEXT,
      value TEXT,
      secure INTEGER,
      owner TEXT
    )
    

    Note that this structure might change in a future Firefox version.

    As to sessionStorage, it only needs to persist for one browser session. Restarting the browser normally clears it, so it doesn't need to be stored in a database. Firefox still writes it to disk to allow restoring the current browsing session, namely to the sessionstore.js file (JSON format). There is a key storage, its value is a map from URLs to their corresponding sessionStorage data. I am not sure whether this data is complete however given that its main purpose is to recover from crashes.

    0 讨论(0)
提交回复
热议问题