W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2009

[whatwg] localStorage mutex - a solution?

From: Chris Jones <cjones@mozilla.com>
Date: Sat, 07 Nov 2009 02:08:18 -0600
Message-ID: <4AF52AF2.8020408@mozilla.com>
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
Received on Saturday, 7 November 2009 00:08:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC