- From: Charles Pritchard <chuck@visc.us>
- Date: Thu, 27 Jan 2011 12:06:08 -0800
- To: Jeremy Orlow <jorlow@chromium.org>
- Cc: Felix Halim <felix.halim@gmail.com>, Jonas Sicking <jonas@sicking.cc>, Boris Zbarsky <bzbarsky@mit.edu>, João Eiras <joao.eiras@gmail.com>, public-webapps WG <public-webapps@w3.org>
- Message-Id: <A305BD5B-F988-41D9-84F8-2D614E7E58D0@visc.us>
On Jan 27, 2011, at 11:01 AM, Jeremy Orlow <jorlow@chromium.org> wrote: > On Thu, Jan 27, 2011 at 12:39 AM, Felix Halim <felix.halim@gmail.com> wrote: > 2011/1/7 Jonas Sicking <jonas@sicking.cc>: > > On Thu, Jan 6, 2011 at 7:14 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > >> On 1/6/11 5:25 PM, João Eiras wrote: > >>> > >>> Not different from two different tabs/windows running the same code. > >> > >> In which current browsers do same-origin tabs/windows end up interleaving > >> their JS (that is, one runs JS before the other has returned to the event > >> loop)? > > > > I'm fairly sure it happens both in Chrome and IE. One way it can happen is: > > > > Tab 1 opens with a page from site A > > Tab 2 opens with a page from site B > > The page in tab 2 contains an iframe with a page from site A. > > > > But I'm not even sure that Chrome and IE makes an effort to use the > > same process if you open two tabs for the same site. > > It seemed that Chrome doesn't interleave the JS when the same page is > opened in multiple tabs. > > Try running this script in multiple tabs and monitor the console output: > > http://felix-halim.net/interleave.html > > In Chrome console log, you will see many "FAIL", but not in Firefox. > > So does this mean localStorage in Chrome is broken? or this is an > intended behavior? > > Although the updates to localStorage are "interleaved", the two tabs are not: both are running in different processess/event-loops. I.e. they run parallel. i.e. localStorage (and cookies) don't support "run to completion". > > We don't implement the storage mutex as specced because it'd severely limit this concurrency. If you search the archives, you'll find a lot of discussions about this. > > If this is a problem for you, then I suggest you look at WebSQLDatabase or (soon) IndexedDB. > > J FWIW: websql is mostly abandoned, though super handy on ios mobile devices. IndexedDB is live in Chrome, Firefox and the MS interop team released a prototype for IE. Moz and webkit both just implement IDB atop of their internal sqlite processes. That is, thy create a simple websql schema. Afaik, websql does not support blobs.
Received on Thursday, 27 January 2011 20:07:34 UTC