I'm saying that we should differentiate between the "closed" state and "cloned" state.<div><br></div><div>Implementors effectively need to do this anyway, because the spec says that closed ports are still task sources, while cloned ports are not.</div>
<div><br></div><div>It makes sense to be able to post closed ports via postmessage() because they are still task sources so the recipient could attach an onmessage handler and pull messages off them.</div><div><br></div><div>
It makes no sense to re-send an already-cloned port since it's not a task source and can't ever be a task source again (no way to send messages to it). Likewise it is no longer entangled and so you can't send messages via it. Re-sending a cloned port is an error, and we should treat it as such.</div>
<div><br></div><div>-atw<br><br><div class="gmail_quote">On Fri, Aug 28, 2009 at 12:11 PM, 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 Mon, 17 Aug 2009, Drew Wilson wrote:<br>
><br>
> Following up on this issue:<br>
> Currently, the checks specified for MessagePort.postMessage() are different<br>
> from the checks done in window.postMessage() (as described in section 7.2.4<br>
> "Posting messages with message ports").<br>
> In particular, step 4 of section 7.2.4 says:<br>
><br>
> If any of the entries in ports are null, *if any of the entries in<br>
> **ports** are not entangled **MessagePort** objects*, or if any<br>
> MessagePort object is listed in ports more than once, then throw an<br>
> INVALID_STATE_ERR exception.<br>
<br>
</div>It appears that this is fixed.<br>
<div class="im"><br>
<br>
> Also, as written, the spec now incorrectly lets us send a cloned port<br>
> multiple times. So code like this would not generate an error:<br>
><br>
> var channel = new MessageChannel();<br>
> otherWindow.postMessage("message1", channel.port1);<br>
> otherWindow.postMessage("message2", channel.port1); // Sent the same port<br>
> again<br>
<br>
</div>That's intentional. By the second call, channel.port1 is not entangled;<br>
the 'message2' event will have a lame duck port as its port.<br>
<div class="im"><br>
<br>
> The current WebKit behavior is to throw an INVALID_STATE_ERR in this<br>
> case, while still allowing closed ports to be sent, which I believe is<br>
> the intended behavior based on previous discussions. If this is correct,<br>
> we should update the spec to prohibit resending cloned ports.<br>
<br>
</div>I don't see how this could be correct.<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>