Re: [whatwg] onclose events for MessagePort

On Thu, Oct 10, 2013 at 8:58 AM, Jonas Sicking <jonas@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
port?

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.

Received on Thursday, 10 October 2013 07:12:19 UTC