Created attachment 261987 [details]
Same HTML page as the live demo
Doing many successive insertions into LocalStorage can cause the page to freeze, with an eternal spinning beach ball and no ability to interact with the page.
I've got a live demo to repro: http://nolanlawson.github.io/database-comparison/
1. Choose "LocalStorage"
2. Choose 100000
3. Click "insert docs"
4. Notice that the page is frozen, with a perma-beachball
This bug cannot be reproduced in Edge, Firefox, or Chrome, but I note that Safari is the only browser out of the four to *not* block DOM rendering while LocalStorage operations are ongoing. :)
I'm testing WebKit Nightly, Version 8.0.8 (10600.8.9, r190266)
I feel like this may have been reported before, but I cannot find it now.
This bug is not terribly surprisingly.
That it doesn't happen in other browsers *is* kind of surprising; LocalStorage is a synchronous API, so it's very easy to abuse.
Can you get a spin dump while this is happening?
(In reply to comment #2)
> LocalStorage is a synchronous API ...
This is not entirely true. The only synchronous operation is getting the initial values from the UI process.
(In reply to comment #3)
> (In reply to comment #2)
> > LocalStorage is a synchronous API ...
> This is not entirely true. The only synchronous operation is getting the
> initial values from the UI process.
I wasn't talking about the way we've implemented I/O, but rather how it operates from script's perspective.
Seems like only Safari has asynchronous localStorage behind the scene. Indeed surprisingly that other browsers do all the ops in sync way, naturally they cannot have async/race bugs here. Anyway, thanks for doing localStorage async!
I still don't have time to dig in to this myself at the moment, but would find a spindump very interesting. That would give the appropriate hints on how to solve this.
It seems it's a duplicate of https://bugs.webkit.org/show_bug.cgi?id=129896
Could you please verify with the latest nightly?
*** This bug has been marked as a duplicate of bug 165622 ***