Dispatch close event when MessagePort is disentangled #43015
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to dispatch a close event when an entangled MessagePort is disconnected.
Given a pair of entangled ports, port1 and port2, if port2 is closed at any point,
a port1’s error handler is run.
So we can change an error handler to dispatch a close event.
The tests of close event are as follows:
Design Doc:https://docs.google.com/document/d/1lXZU2Pk2ycitqj8aL9kxT2aauwXqpA0vJDUalkXA29Y
Explainer:https://github.com/fergald/explainer-messageport-close
HTML spec PR:whatwg/html#9933
Bug: 1495616
Change-Id: I99f9f5a0d7cc63f0916da316ec666ba793215019
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5003089
Reviewed-by: Jeremy Roman <[email protected]>
Commit-Queue: Nonoka Muraki <[email protected]>
Reviewed-by: Ming-Ying Chung <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1231743}