-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Request for Mozilla Position on an Emerging Web Specification
- Specification title: Add a close event to MessagePort
- Specification or proposal URL (if available):
- Explainer URL (if available):https://github.com/fergald/explainer-messageport-close
- Proposal author(s) (
@-mention GitHub accounts): @fergald @nononokam - Caniuse.com URL (optional):
- Bugzilla URL (optional):
- Mozillians who can provide input (optional): @asutherland
Other information
Currently, there is no timely and reliable way to detect when a MessagePort becomes disentangled, which makes it difficult to release resources associated with ports. This issue has a long discussion of the problem and potential solutions. Some users have used the unload event to detect disconnect, but it is deprecated. Therefore, The approach available now is to hold a MessagePort in WeakRef and periodically check if this port has been garbage collected by using deref() or to make use of a page-hide event, which is quite inefficient.
So, I propose adding a close event. For example, if there are two entangled ports, portA and portB, and portA is closed, the close event is fired on portB.
SantaClaas and juancampa
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Unscreened