LocalStorage should flush dirty top-level window origins to disk on window closure
Categories
(Core :: Storage: localStorage & sessionStorage, defect, P3)
Tracking
()
People
(Reporter: asuth, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: dom-lws-bugdash-triage)
Bug 1536797 covers a GeckoView scenario where LocalStorage changes never make it to disk because Gecko is terminated before flushing the storage to disk.
Right now, we flush at the earlier of the following:
- The Datastore closes because: (!mPrepareDatastoreOps.Count() && !mPreparedDatastores.Count() && !mDatabases.Count())
- The kFlushTimeoutMs = 5000 timer elapses from the first write.
I do some analysis in https://bugzilla.mozilla.org/show_bug.cgi?id=1536797#c12 that covers high level issues, but I suspect what's happening that we can improve upon is that the window gets closed and we'd expect Datastore::Close() to handle this, except there's still a prepared datastore hanging around for 20 seconds, so we end up waiting for 5 seconds, but Gecko is already terminated by the time the timer would happen.
I say top-level origins because I think it's quite possible that iframes could churn at a high rate and because only top-level windows/tabs correlate with user intent. (It's possible for an iframe to do window.open() to get a top-level window of its own, of course, but that is gated on user interaction at least.)
Comment 1•6 years ago
|
||
The priority flag is not set for this bug.
:overholt, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•6 years ago
|
Updated•2 years ago
|
Comment 2•8 months ago
|
||
I assume this is still a problem?
Reporter | ||
Comment 3•8 months ago
|
||
All the code seems to still be the same in LS(NG), yes.
Comment 4•5 months ago
|
||
Are there some actions planned regarding this scope. I have a PWA running into this problem, making the app quite useless/unreliable with Firefox. Is there a workaround (trigger flush from js)?
Description
•