[whatwg] localStorage mutex - a solution?
Chris Jones
cjones at mozilla.com
Sat Nov 7 00:08:18 PST 2009
Rob Ennals wrote:
> Missed out the important final qualifier. Here's take 3:
>
> "the user agent MUST NOT release the storage mutex between calls to
> local storage, except that the user agent MAY release the storage mutex
> on any API operation /other that a local storage oeration/"
>
IMHO, this is actually worse than the current proposal of a global mutex
:S. This proposal makes atomicity guarantees not only
library-dependent, but browser-implementation-dependent. For example
a = localStorage.x()
jquery.foo()
b = localStorage.y()
If |jquery.foo()| were, say, parsing JSON or determining selector
matching, it might involve "browser API calls" in some browser, and in
others not.
Worse, if |jquery.foo()| involves accessing browser-managed things like
computed DOM attributes, then even in the *same* browser it might result
in sometimes needing a "browser API call", and sometimes only needing a
JS-only call. (Depending on DOM attribute cache status, if present.)
This of course of depends on the definition of "browser API call", but I
interpret this as approximately meaning "calling from JS to C++".
These objections are in addition to those made by Jeremy Orlow
concerning a script-managed, possibly cross-process mutex, which I also
find unpleasant.
Cheers,
Chris
More information about the whatwg
mailing list