Open Bug 1544529 Opened 5 years ago Updated 2 years ago

LocalStorage should flush dirty top-level window origins to disk on window closure

Categories

(Core :: Storage: localStorage & sessionStorage, defect, P3)

defect

Tracking

()

People

(Reporter: asuth, Unassigned)

References

(Blocks 1 open bug)

Details

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.)

The priority flag is not set for this bug.
:overholt, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(overholt)
Flags: needinfo?(overholt)
Priority: -- → P3
See Also: → 1556833
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.