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

[whatwg] Accessing cookies from workers

From: Drew Wilson <atwilson@google.com>
Date: Mon, 9 Mar 2009 10:38:21 -0800
Message-ID: <f965ae410903091138i1d90192ewc476b86b1cc4cdd3@mail.gmail.com>
On Mon, Mar 9, 2009 at 10:23 AM, Jonas Sicking <jonas at sicking.cc> wrote:

>
> The problem is that people are likely to write code like:
>
> if (self.getAllCookies() != "magic value") {
>  a = self.getAllCookies();
>  ...do stuff...
> }
>
> at that point it's entirely possible for 'a' to have the value "magic
> value" which is likely to cause the script to break.


Here we are making assumptions about how people will use routines that don't
actually exist yet. If you were to substitute "new Date().getTime()" for
"self.getAllCookies()" in the code above, I think we'd all agree that the
user expectation is faulty - is it not feasible to state that, just like
Date().getTime(),. getAllCookies() returns a snapshot of a mutable value?

I'm OK with making setCookie() asynchronous, because I think there may be a
valid point that you don't want new worker code to suddenly break existing
JS code that expects document.cookies to remain immutable across a single
block of execution. But I don't see that argument extending to
getAllCookies().


>
> Indeed. It does seem like you would be able to ask ;)
>

I'm looking into this now, actually :) - I'll let you know what I find out.

-atw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090309/500f46e5/attachment-0001.htm>
Received on Monday, 9 March 2009 11:38:21 GMT

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