On Wed, Aug 26, 2009 at 3:24 PM, Jeremy Orlow <span dir="ltr">&lt;<a href="mailto:jorlow@chromium.org" target="_blank">jorlow@chromium.org</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div class="gmail_quote"><div>On Wed, Aug 26, 2009 at 3:05 PM, Robert O&#39;Callahan <span dir="ltr">&lt;<a href="mailto:robert@ocallahan.org" target="_blank">robert@ocallahan.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>On Wed, Aug 26, 2009 at 2:54 PM, Jeremy Orlow <span dir="ltr">&lt;<a href="mailto:jorlow@chromium.org" target="_blank">jorlow@chromium.org</a>&gt;</span> wrote:<br></div><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div class="gmail_quote">Is there any data (or any way to collect the data) on how much of the web IE and Chrome&#39;s current behavior has broken?  Given that there hasn&#39;t been panic in the streets, I&#39;m assuming approximately 0%?</div>





</blockquote></div><div><br>We previously had a lengthy discussion about this.<br><br>If a site has a cookie race that causes a problem in IE/Chrome one in every 10,000 page loads, are you comfortable with that?</div></div>




</blockquote><div><br></div></div><div>I&#39;m much more comfortable with that than the cost of a global mutex that all cookies and LocalStorage share.  There are other ways to come about this problem (like developer tools).</div>




<div><br></div><div>I&#39;m pretty sure Chromium has no intention of implementing a global storage mutex and putting all cookie access under it.  Has anyone heard anything (either way) from Microsoft?  Are there any browsers moving to a multi-event-loop (be it multi-threaded or multi-process) based model that intend to implement this?  If not, then it would seem like the spec is not grounded in reality.</div>




</div>
</blockquote></div><br><div>Does the silence mean that no one has any intention of implementing this?  If so, maybe we should resign ourselves to a break in the single threaded illusion for cookies.  This doesn&#39;t seem too outlandish considering that web servers working with cookies will never have such a guarantee and given that we have no evidence of widespread breakage with IE 8 and Chrome.</div>


<div><br></div><div>If we were to get rid of the storage mutex for cookie manipulation (as I believe we should) maybe we should re-examine it for local storage.  At a minimum, it could be implemented as a per-origin mutex.  But I feel strongly we should go further.  Why not have an asynchronous mechanism for atomic updates?  For example, if I wanted to write an ATM application, I would have to do the following:</div>


<div><br></div><div>var accountDelta = /* something */;</div><div>window.localStorage.executeAtomic(function() {</div><div>    localStorage.accountBalance = localStorage.accountBalance + accountDelta;</div><div>}</div><div>


<br></div><div>Alternatively, we could make it so that each statement is atomic, but that you have to use such a mechanism for anything more complicated. For example:</div><div><br></div><div>localStorage.accountBalance = localStorage.accountBalance + accountDelta;  // It&#39;s atomic, so no worries!</div>

<div>var balance = localStorage.accountBalance;  /* Oh no!!!!  This isn&#39;t safe since it&#39;s implemented via multiple statements... */</div><div>localStorage.accountBalance = balance + accountDelta;  /* ....we should have used localStorage.executeAtomic! */</div>

<div><br></div><div>Such ideas would definitely lighten lock contention and possibly eliminate the need for yieldForStorageUpdates (formerly getStorageUpdates).  Another major bonus is that it&#39;d allow us to expose localStorage to workers again, which is one of the top complaints I&#39;ve gotten when talking to web developers about localStorage.</div>

<div><br></div><div>I know this is radical stuff, but the way things are speced currently just are not practical.</div><div><br>
</div><div>J</div>