E40C Add a close event to MessagePort · Issue #914 · mozilla/standards-positions · GitHub
[go: up one dir, main page]

Skip to content

Add a close event to MessagePort #914

@nononokam

Description

@nononokam

Request for Mozilla Position on an Emerging Web Specification

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Unscreened

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0