[html5] Web Workers: Race-Condition setting onmessage handler?

Drew Wilson 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.
>
> Tobias
>

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.

-atw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20100803/ca49587b/attachment-0002.htm>


More information about the Help mailing list