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

[whatwg] localStorage + worker processes

From: Aaron Boodman <aa@google.com>
Date: Sat, 21 Mar 2009 15:25:05 -0700
Message-ID: <278fd46c0903211525k266f10afh28ba9c2c4e945f6d@mail.gmail.com>
On Sat, Mar 21, 2009 at 1:51 PM, Jonas Sicking <jonas at sicking.cc> wrote:
> The problem with synchronously grabbing the lock is that we can only
> ever have one feature that uses synchronous locks, otherwise we'll
> risk dead-locks.
>
> Say that we make document.cookie behave the same way (to prevent
> multi-process browsers like IE8 and chrome from having race
> conditions). So that if you call document.getCookiesWithLock(callback)
> we'll synchronously grab a lock and call the callback function. This
> would cause two pages like the ones below to potentially deadlock:
>
> Page 1:
> getLocalStorage(function(storage) {
> ?document.getCookiesWithLock(function(cookieContainer) {
> ? ?storage.foo = cookieContainer.getCookie('cookieName');
> ?});
> ]);
>
> Page 2:
> document.getCookiesWithLock(function(cookieContainer) {
> ?getLocalStorage(function(storage) {
> ? ?cookieContainer.setCookie('cookieName', storage.bar);
> ?});
> });

Good point. Ok, I agree that an asynchronous callback makes most sense
for this API.

- a
Received on Saturday, 21 March 2009 15:25:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT