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

Re: [whatwg] onclose events for MessagePort

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Tue, 01 Oct 2013 20:01:04 +0300
Message-ID: <524AFFD0.9040400@helsinki.fi>
To: Ehsan Akhgari <ehsan@mozilla.com>, whatwg <whatwg@lists.whatwg.org>
On 10/01/2013 06:37 PM, Ehsan Akhgari wrote:
> 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?


I don't understand what "the lifetime of MessagePorts to the lifetime of their owner document"
means in case of workers. And we sure want to delete MessagePort objects if nothing from JS side
is keeping it, or the port it is connected to alive.


-Olli


>
> [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23327
>
> Thanks!
> --
> Ehsan
> <http://ehsanakhgari.org/>
>
Received on Tuesday, 1 October 2013 17:01:34 UTC

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