[whatwg] Proposal for enhancing postMessage
atwilson at google.com
Fri Mar 13 15:02:13 PDT 2009
Yes, it sends a clone, but the source port becomes unentangled (inactive) -
step 5 of the "clone a port" specification reads:
the remote port and new port objects. The original port object will be
unentangled by this process.
So, cloning a port has the effect of killing the original port - the intent,
I think, is for the sender to permanently hand off ownership of the port to
the recipient, not to duplicate the port itself.
I think this is a side issue, though - I agree that since you can
effectively pass a message consisting of multiple objects, you probably
ought to be able to pass multiple MessagePorts along with them. As you point
out, it's primarily a matter of convenience/efficiency - you could still get
the same functionality by individually serializing each object/port pair.
On Fri, Mar 13, 2009 at 2:06 PM, Mark S. Miller <erights at google.com> wrote:
> On Wed, Mar 11, 2009 at 2:30 PM, Drew Wilson <atwilson at google.com> wrote:
> > Mark, I won't pretend to completely understand the use cases you're
> > describing as I'm not familiar with the prior work you've cited. But my
> > understanding of the postMessage() API is that they are primarily useful
> > handing off ports to new owners - your idea of a pass-by-copy
> > of a proxy object implies that there's some way to copy the message port,
> > and pass that along with the proxy to the new owner, which I don't think
> > possible in general (you can create a new port as part of a
> > but you can't really duplicate an existing port).
> > I may be misunderstanding the use case that's driving your proposal,
> And I may be misunderstanding the postMessage draft spec. But step 4
> of 7.4.4 at
> > Try to obtain a new port by cloning the messagePort argument
> > with the Window object on which the method was invoked as
> > the owner of the clone. If this returns an exception, then throw
> > that exception and abort these steps.
> Doesn't this mean that sending a MessagePort actually sends a clone?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the whatwg