[html5] Web Workers: Race-Condition setting onmessage handler?
atwilson at chromium.org
Tue Aug 3 08:57:42 PDT 2010
On Tue, Aug 3, 2010 at 4:21 AM, Tobias Sauerwein <
tobias.sauerwein at camptocamp.com> wrote:
> And then the message from the main script is never received by the web
> worker and it won't start its work.
> Could that happen? From what you have said, I think it could.
The portions of the spec I quoted should ensure that this does not happen,
because the MessagePort for the worker is not enabled until the initial
worker script finishes running (so events posted to the port are queued and
not delivered until after the initial worker script returns).
Furthermore, even if the port were enabled, the events related to messages
queued on that port can't be delivered (and so can't be dropped) until the
worker script returns to the event loop. So it should not be possible for
events to be dropped in the case you suggest.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Help