W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2010

[whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

From: ATSUSHI TAKAYAMA <taka.atsushi@googlemail.com>
Date: Mon, 15 Mar 2010 21:07:17 -0400
Message-ID: <9cef076f1003151807r7c2b448ata983f1ec125568e6@mail.gmail.com>
Thanks for replies,

I understood what's the problem here.

> The only option that comes to mind that doesn't expose compatibility issues
> would be to only issue onclose events if close() is explicitly called on the
> entangled port, but if you're doing that you might as well just have the
> code calling close() post a "I'm closing" message first.
> -atw

This would mean that all web pages using a SharedWorker (and keep
reference to MessagePort inside the SharedWorker) have to set "unload"
event handlers to call port.close() so that references to the ports in
the SharedWorker don't get accumulated. That is not desirable.
"pagehide" handler may not be sufficient for this purpose.

I think, as Hixie suggested, an array like object to track references
of all connected ports would be nice *for SharedWorkers*. For ports
created dynamically by new MessageChannel, it doesn't seem to work

Received on Monday, 15 March 2010 18:07:17 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC