Hi,
not sure if this is the right place to post, but I'll give it a try.
I am trying to access LocalStorage from two different tabs, and it seems to me that Chrome does not behave as it says in the spec. Specifically, in the sequence
read value from key K in localstorage
do something to compute new value
write new value to key K to localstorage
although the entire sequence executes in a single thread, it does not execute atomically. Is that a bug that Chrome will fix, or is it intended and will stay that way? If it stays that way, there should a way to obtain a mutex on the localstorage for a key K, like that:
LocalStorage.runExclusively(K, function() {
read value from key K in localstorage
do something to compute new value
write new value to key K to localstorage
})
It might be possible to implement such a function runExclusively in user code, but there are a couple of issues that make this really hard (for example, let's assume you run code in a response to an unload event; then chances are your code passed to a homegrown runExclusively will not be called)
Cheers,
Steven