[whatwg] Workers and addEventListener

Ian Hickson ian at hixie.ch
Wed Oct 14 03:32:45 PDT 2009


On Tue, 29 Sep 2009, Zoltan Herczeg wrote:
> 
> In WebKit implementation of MessagePort the addEventListener("message",
> ...) does not enable the transmitting of messages. All messages are
> actually discarded until a dummy function is assigned to onmessage.

That is a bug. The port message queue is explicitly enabled during the 
creation of the dedicated worker (step 12).


> And in the normative text, it is not mentioned that addEventListener 
> should also enable message transmitting.

The normative text just says to fire an event; the DOM Events spec makes 
it clear that events can be handled using addEventListener()-added 
handlers.


> Anyway, my qestion is:
>   - should addEventListener enable message transmitting?

Yes.

>   - Should it do it in all cases, or only when "message" is passed as the
> first argument

It should only receive 'message' events if you say 'message' as the first 
argument.

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


More information about the whatwg mailing list