W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

[whatwg] onclose events for MessagePort

From: Ehsan Akhgari <ehsan@mozilla.com>
Date: Tue, 1 Oct 2013 11:37:59 -0400
Message-ID: <CANTur_5wOh09o5M65uzaMjbOzeCVWw5862cq8s-5V-jk=NJKpA@mail.gmail.com>
To: whatwg <whatwg@lists.whatwg.org>
Hi everyone,

We're coming across a need to get notified when the other side of a channel
goes away because the user navigates away from the page, or if the page is
killed by the OS, etc.  Currently a workaround is for the application to
handle the unload event and send a message on its channel letting the other
side know that it's going to die, but that's obviously not good enough if
the application is terminated abruptly (e.g., crashes.)

We proposed an onclose event on MessagePort to handle this case [1] and it
was rejected because that would make the GC behavior observable (in case
the port on the other side is garbage collected.)  But it seems like tying
the lifetime of MessagePorts to the lifetime of their owner document will
fix that problem.

Is that going to be an acceptable solution?

[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23327

Thanks!
--
Ehsan
<http://ehsanakhgari.org/>
Received on Tuesday, 1 October 2013 15:39:09 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:11 UTC