- From: Jonas Sicking <jonas@sicking.cc>
- Date: Thu, 5 Mar 2009 17:42:47 -0800
On Thu, Mar 5, 2009 at 5:23 PM, Michael Nordman <michaeln at google.com> wrote:
>> Allowing cookie to be set would unfortunately create a synchronous
>> communication channel between the worker and the main window. This is
>> something that we need to avoid to prevent users from having to deal
>> with locking and other thread related issues.
>
> Hmmm... the cookie setting API could be async in workers.
Or you could just use postMessage() and ask the main thread to do it?
What is the use case for reading/writing cookies though? Could use use
localStorage instead (once we figure out a different API for it that
doesn't have the shared-state problem that the current API has)
Even just synchronous read access has race-condition problems. For
example the following script:
if (docCookies == "hello") {
doStuff();
}
else {
log("cookies certainly aren't 'hello', they are: " + docCookies);
}
could result in "cookies certainly aren't 'hello', they are: hello"
being printed.
/ Jonas
Received on Thursday, 5 March 2009 17:42:47 UTC