[whatwg] Web Workers: Worker.onmessage

On Wed, 11 Nov 2009, Simon Pieters wrote:
> On Wed, 11 Nov 2009 16:05:53 +0100, Simon Pieters <simonp at opera.com> wrote:
> > 
> > Shouldn't setting onmessage on a Worker object enable the port message 
> > queue?
> > 
> > Currently step 8 of the "run a worker" algorithm enables the port 
> > message queue for the WorkerGlobalObjectScope side, but it is never 
> > enabled when going in the other direction, if I'm reading the spec 
> > correctly.
> 
> Hmm. Actually, step 12 and 13 of the Worker constructor enable the port 
> message queue for both the inside and outside ports. Why does the "run a 
> worker" algorithm enable one of them again? Isn't it too early to enable 
> the port message queues before the worker has run and set 'onmessage'?

I suppose that if the worker is slow to start up, it could conceivably 
receive a message before the event loop exists, which would lead to poorly 
defined behaviour. I've removed the inner port opening from the 
constructor's algorithm.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 1 December 2009 01:36:51 UTC