To be absolutely clear (since there's some confusion about whether we are talking about explicit MessagePorts, or about implicit ports for dedicated workers).<div><br></div><div>Are you saying that this:</div><div><br>
</div><div>var channel = new MessageChannel();</div><div>channel.port1.postMessage("hi mom");</div><div>channel.port2.addEventListener("message", function(event) {alert(event.data); }, false);</div><div>
<br></div><div>Should result in an alert dialog being fired? Because that does not match my reading of the spec at all - the spec explicitly states that a port's message queue is only enabled via start() or via setting the onmessage IDL attribute.</div>
<div><br></div><div>I would not be opposed to changing the spec to include enabling a port's message queue when addEventListener("message") is invoked.</div><div><br></div><div>-atw<br><div><div><br><div class="gmail_quote">
On Wed, Oct 14, 2009 at 3:32 AM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, 29 Sep 2009, Zoltan Herczeg wrote:<br>
><br>
> In WebKit implementation of MessagePort the addEventListener("message",<br>
> ...) does not enable the transmitting of messages. All messages are<br>
> actually discarded until a dummy function is assigned to onmessage.<br>
<br>
</div>That is a bug. The port message queue is explicitly enabled during the<br>
creation of the dedicated worker (step 12).<br>
<div class="im"><br>
<br>
> And in the normative text, it is not mentioned that addEventListener<br>
> should also enable message transmitting.<br>
<br>
</div>The normative text just says to fire an event; the DOM Events spec makes<br>
it clear that events can be handled using addEventListener()-added<br>
handlers.<br>
<div class="im"><br>
<br>
> Anyway, my qestion is:<br>
>   - should addEventListener enable message transmitting?<br>
<br>
</div>Yes.<br>
<div class="im"><br>
>   - Should it do it in all cases, or only when "message" is passed as the<br>
> first argument<br>
<br>
</div>It should only receive 'message' events if you say 'message' as the first<br>
argument.<br>
<div><div></div><div class="h5"><br>
--<br>
Ian Hickson               U+1047E                )\._.,--....,'``.    fL<br>
<a href="http://ln.hixie.ch/" target="_blank">http://ln.hixie.ch/</a>       U+263A                /,   _.. \   _\  ;`._ ,.<br>
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'<br>
</div></div></blockquote></div><br></div></div></div>