This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28813 - There's no way to tell when a MessagePort is closed.
Summary: There's no way to tell when a MessagePort is closed.
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other All
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/#message...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-15 18:37 UTC by contributor
Modified: 2016-12-13 14:10 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2015-06-15 18:37:35 UTC
Specification: https://html.spec.whatwg.org/multipage/comms.html
Multipage: https://html.spec.whatwg.org/multipage/#message-ports
Complete: https://html.spec.whatwg.org/#message-ports
Referrer: https://www.google.com/

Comment:
There's no way to tell when a MessagePort is closed.

If we amend the close method of a MessagePort to send a "close" event to its
entangled partner (and ensure that when a browser tab is closed, all its open
message ports are closed) then the programmer using a MessagePort can handle
this event and remove the reference to the MessagePort.

This is a much nicer solution than the PortCollection. Sure, it can leak
memory if the programmer doesn't handle the callback and remove the reference,
but this is easy to document and understand.

Posted from: 204.14.159.168
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Comment 1 Anne 2015-09-30 12:23:09 UTC
Wouldn't you be able to observe garbage collection with this solution as well?
Comment 2 Anne 2016-02-23 07:59:37 UTC
https://lists.w3.org/Archives/Public/public-whatwg-archive/2013Oct/thread.html#msg3 has more detail on this discussion.
Comment 3 Domenic Denicola 2016-12-13 14:10:58 UTC
https://github.com/whatwg/html/issues/1766