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

[whatwg] Accessing cookies from workers

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Mon, 9 Mar 2009 19:26:57 +0100
Message-ID: <65307430903091126s6084acf3rceb713a6876f1f3c@mail.gmail.com>
2009/3/9 Jonas Sicking <jonas at sicking.cc>:
> On Mon, Mar 9, 2009 at 11:01 AM, Giovanni Campagna
>> This can be even worse: how would you syncronize the code in the
>> callback with code right after the call? You don't have any of
>> semaphores or mutexes in ES and I don't expect them to be added soon.
>
> I'm not sure I understand the problem you are describing. Could you
> show an example using the APIs that exist in the spec today and with
> an async cookie API added?

var x = 7;
function callback(cookies) {
x = 5;
}
getAllCookies(callback);
alert(x == 7);

True or false: who knows?
The example is rather trivial, but this issue can be very frustrating
once you start doing something useful inside the callback: since you
have neither arguments nor return values, the only way to propagate
the results from function to outside is using a global-scope object.
Btw, this problem forced me using syncronous XHR, so maybe the
introduction of a low-level threading / syncronization mechanism may
be appropriate. Something that the casual author would not usually
need, but some professional web developer will find extremely useful,
surely better than self-dispatching events.

> / Jonas
>

Giovanni
Received on Monday, 9 March 2009 11:26:57 GMT

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