[whatwg] whatwg Digest, Vol 71, Issue 72

Boris Zbarsky bzbarsky at MIT.EDU
Wed Feb 24 10:39:02 PST 2010


On 2/24/10 1:04 PM, David Flanagan wrote:
> If I've been following the thread correctly, the justification for an
> asynchronous API was that localStorage is a mess, or something like
> that. I'm not aware of what the issues are with localStorage

In brief, the fact that if you have multiple threads or processes 
rendering web pages from the same site, then they can race each other.

> could you justify an asynchronous cookie API more explicitly? This isn't a
> blocking I/O issue, is it? Surely browsers will have the relevant
> cookies already cached in memory, won't they?

Yes, but cookies are not immutable.

> In simple use cases, a developer just wants the cookie value

Only once?  With a sync API this code:

   if (document.cookie == document.cookie) {
     alert("pass");
   } else {
     alert("fail");
   }

will sometimes alert "fail" depending on what other web pages are 
loading at the same time and what their HTTP headers look like and what 
their scripts are doing.

-Boris



More information about the whatwg mailing list