Persist SamizdatInfo even between ServiceWorker restarts
On Firefox (and possibly other browsers) when a tab is open but no fetch()
events are handled for a while, the ServiceWorker goes into a stopped
stage, losing all internal state. When a new fetch()
request is issued, the SW gets activated anew and enters the running
state.
This means all SamizdatInfo
data are lost, thus making it impossible to get the info for resources fetched before the SW went into the stopped
stage.
There are multiple strategies we can use to persist SamizdatInfo
:
-
Indexed DB
API- seems like the right choice here
-
Service Workerscache
API- unwieldy, stores
Request
andResponse
pairs
- unwieldy, stores
-
sessionStorage
-
localStorage