[whatwg] Changing postMessage() to allow sending unentangled ports

Ian Hickson ian at hixie.ch
Wed Sep 2 15:34:48 PDT 2009


On Fri, 28 Aug 2009, Drew Wilson wrote:
>
> I'm saying that we should differentiate between the "closed" state and 
> "cloned" state. Implementors effectively need to do this anyway, because 
> the spec says that closed ports are still task sources, while cloned 
> ports are not.
> 
> 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.
> 
> 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.

I've made the two postMessage() methods that post MessagePort objects 
throw INVALID_STATE_ERR if any of their ports have already been cloned.

-- 
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