[whatwg] onclose events for MessagePort

Andrew Wilson atwilson at google.com
Thu Oct 10 00:11:51 PDT 2013

On Thu, Oct 10, 2013 at 8:58 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> I could see the GC case not being solvable.
> But is there a reason that we couldn't also fire the event if the
> other side is forcefully terminated through a navigation or a
> Worker.terminate() call?

I still have the concerns I expressed earlier about figuring out who the
owner is of the port in the case where you've passed a reference around to
multiple contexts. What does "other side is forcefully terminated" mean in
the case where you may have multiple iframes with references to the same

i.e. if my iframe does this:

channel = new MessageChannel();
window.parent.port = channel.port1;
sharedWorker.port.postMessage("port", [channel.port2]);
window.location.href = "<some other url>"

What happens? Does the sharedWorker get channeldropped on it's cloned port?
I suspect this would be confusing to developers, who might otherwise expect
that merely handing a reference to port to its same-origin parent would be
sufficient to keep it alive.

More information about the whatwg mailing list