Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessagePort API:add a close event #9933

Merged
merged 6 commits into from
Jan 12, 2024

Conversation

nononokam
Copy link
Contributor

@nononokam nononokam commented Nov 15, 2023

This PR adds some steps to dispatch a close event of MessagePort API.
As discussed in #1766, there is currently no timely and reliable way to detect when a MessagePort becomes disentangled. This makes it difficult to release resources associated with ports.
So, we proposed 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.

Please take a look @domenic @asutherland @annevk


/document-lifecycle.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/web-messaging.html ( diff )

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great work! Review summary:

  • A bunch of minor formatting things
  • Need to add close to the event index
  • I can't find where the garbage collection behavior is specified

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
@nononokam
Copy link
Contributor Author

nononokam commented Nov 27, 2023

thank you for reviewing this PR!
I fixed it, so could you take a look?
@domenic

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 27, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 27, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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
@domenic
Copy link
Member

domenic commented Nov 27, 2023

I've done another review. I found several more small formatting issues, but I decided to fix them directly instead of requiring you to do it. You can see my changes in 62e9ef7. Please be sure to do git pull before doing further work, so that you get my changes on your machine.

The remaining issue is the one I noted in #9933 (comment) . I cannot find anything in this PR which specifies that ports get disentangled on garbage collection. Can you please work on adding that?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 30, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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
aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 1, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 1, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 1, 2023
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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 1, 2023
This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 1, 2023
This reverts commit 6a74d3d.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 1, 2023
This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 1, 2023
This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 4, 2023
This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 4, 2023
This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

I changed two tests as follows
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js
→in order to prevent the test timing out, I added timmeout=long

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js
→change test expectations

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 4, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 4, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Dec 5, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Dec 5, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 6, 2023
This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

I changed two tests as follows
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js
→in order to prevent the test timing out, I added timmeout=long

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js
→change test expectations

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 7, 2023
This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

I changed two tests as follows
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js
→in order to prevent the test timing out, I added timmeout=long

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js
→change test expectations

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 7, 2023
This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

I changed two tests as follows
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js
→change test expectations

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js
→change test expectations

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Dec 7, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015

UltraBlame original commit: 6024446737e641a6277938deb3122ffa5b25698f
@nononokam
Copy link
Contributor Author

I've done another review. I found several more small formatting issues, but I decided to fix them directly instead of requiring you to do it. You can see my changes in 62e9ef7. Please be sure to do git pull before doing further work, so that you get my changes on your machine.

The remaining issue is the one I noted in #9933 (comment) . I cannot find anything in this PR which specifies that ports get disentangled on garbage collection. Can you please work on adding that?

Thank you! I worked on this. please take a look.

@domenic
Copy link
Member

domenic commented Dec 12, 2023

I'm sorry, I still can't see what part of the new text specifies that ports get disentangled on garbage collection. Can you quote which text you believe says that?

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 13, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 13, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465
ErichDonGubler pushed a commit to ErichDonGubler/firefox that referenced this pull request Dec 13, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015
ErichDonGubler pushed a commit to ErichDonGubler/firefox that referenced this pull request Dec 13, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Owners-Override: Hiroki Nakagawa <nhiroki@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 14, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Reland "Dispatch close event when MessagePort is disentangled"

This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

This is because the builder added in https://crrev.com/c/5005230 might be broken.
Specifically, chrome-wpt builder cannot run GC(Bug: 1509657) and BFCache doesn't
work on chrome-wpt builder(Bug: 1509303).

I changed two tests expectations described below.
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083156
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1234854}

--

wpt-commits: 05aab53917a8309fe7f1ab5c50d094ac488ce942
wpt-pr: 43491
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Dec 16, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015

UltraBlame original commit: 9328f805d865217889e27a0183ae9e47665fbc36
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Commit-Queue: Hiroki Nakagawa <nhirokichromium.org>
Owners-Override: Hiroki Nakagawa <nhirokichromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465

UltraBlame original commit: 725faaf34b655617d2433d4bd0ccb5948f7b6a66
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Reland "Dispatch close event when MessagePort is disentangled"

This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

This is because the builder added in https://crrev.com/c/5005230 might be broken.
Specifically, chrome-wpt builder cannot run GC(Bug: 1509657) and BFCache doesn't
work on chrome-wpt builder(Bug: 1509303).

I changed two tests expectations described below.
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083156
Reviewed-by: Jeremy Roman <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1234854}

--

wpt-commits: 05aab53917a8309fe7f1ab5c50d094ac488ce942
wpt-pr: 43491

UltraBlame original commit: 44d41cbaf3e883d24936ac8be51e4e3be7e5efd0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Dec 16, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015

UltraBlame original commit: 9328f805d865217889e27a0183ae9e47665fbc36
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Commit-Queue: Hiroki Nakagawa <nhirokichromium.org>
Owners-Override: Hiroki Nakagawa <nhirokichromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465

UltraBlame original commit: 725faaf34b655617d2433d4bd0ccb5948f7b6a66
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Reland "Dispatch close event when MessagePort is disentangled"

This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

This is because the builder added in https://crrev.com/c/5005230 might be broken.
Specifically, chrome-wpt builder cannot run GC(Bug: 1509657) and BFCache doesn't
work on chrome-wpt builder(Bug: 1509303).

I changed two tests expectations described below.
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083156
Reviewed-by: Jeremy Roman <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1234854}

--

wpt-commits: 05aab53917a8309fe7f1ab5c50d094ac488ce942
wpt-pr: 43491

UltraBlame original commit: 44d41cbaf3e883d24936ac8be51e4e3be7e5efd0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Dec 16, 2023
… disentangled, a=testonly

Automatic update from web-platform-tests
Dispatch close event when MessagePort is disentangled

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:
1) port was explicitly closed.
2) owning document was destroyed.
3) owning document crashed.
4) port was garbage collected.

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 <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1231743}

--

wpt-commits: dd47f140612cef24b9e9c692e77b4d3aa5307279
wpt-pr: 43015

UltraBlame original commit: 9328f805d865217889e27a0183ae9e47665fbc36
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Revert "Dispatch close event when MessagePort is disentangled"

This reverts commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0.

Reason for revert:
The tests newly added by the original CL are failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Bug: 1495616
Change-Id: Ib697597d6ab70a9a7bfc41a67dfc647698024a64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5075742
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Commit-Queue: Hiroki Nakagawa <nhirokichromium.org>
Owners-Override: Hiroki Nakagawa <nhirokichromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main{#1231780}

--

wpt-commits: 5d1c45f9f81c37c45e7acc351348cd6e9879597f
wpt-pr: 43465

UltraBlame original commit: 725faaf34b655617d2433d4bd0ccb5948f7b6a66
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Reland "Dispatch close event when MessagePort is disentangled"

This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

This is because the builder added in https://crrev.com/c/5005230 might be broken.
Specifically, chrome-wpt builder cannot run GC(Bug: 1509657) and BFCache doesn't
work on chrome-wpt builder(Bug: 1509303).

I changed two tests expectations described below.
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbromanchromium.org>
> Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
> Reviewed-by: Ming-Ying Chung <mychchromium.org>
> Cr-Commit-Position: refs/heads/main{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083156
Reviewed-by: Jeremy Roman <jbromanchromium.org>
Commit-Queue: Nonoka Muraki <murakinonokachromium.org>
Reviewed-by: Ming-Ying Chung <mychchromium.org>
Cr-Commit-Position: refs/heads/main{#1234854}

--

wpt-commits: 05aab53917a8309fe7f1ab5c50d094ac488ce942
wpt-pr: 43491

UltraBlame original commit: 44d41cbaf3e883d24936ac8be51e4e3be7e5efd0
aosmond pushed a commit to aosmond/gecko that referenced this pull request Dec 16, 2023
…ePort is disentangled", a=testonly

Automatic update from web-platform-tests
Reland "Dispatch close event when MessagePort is disentangled"

This is a reland of commit 6a74d3d8049e1744b862757a73f90f3d7a5e08b0

The tests newly added by the original CL were failing on
chrome_wpt_tests on the Linux Tests bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests/138259/overview

This is because the builder added in https://crrev.com/c/5005230 might be broken.
Specifically, chrome-wpt builder cannot run GC(Bug: 1509657) and BFCache doesn't
work on chrome-wpt builder(Bug: 1509303).

I changed two tests expectations described below.
・third_party/blink/web_tests/external/wpt/webmessaging/message-channels/close-event/garbage-collected.tentative.any.js

・third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/message-port-entangled-after-restore.https.tentative.window.js

Original change's description:
> Dispatch close event when MessagePort is disentangled
>
> 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:
> 1) port was explicitly closed.
> 2) owning document was destroyed.
> 3) owning document crashed.
> 4) port was garbage collected.
>
> 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 <jbroman@chromium.org>
> Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
> Reviewed-by: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1231743}

Change-Id: I0a8f31245d7b5abe9ddfc262dff8063316e953df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083156
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Nonoka Muraki <murakinonoka@chromium.org>
Reviewed-by: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1234854}

--

wpt-commits: 05aab53917a8309fe7f1ab5c50d094ac488ce942
wpt-pr: 43491
@nononokam
Copy link
Contributor Author

@domenic
Sorry for being late. I added the description which specifies that ports get disentangled on garbage collection.

source Show resolved Hide resolved
source Show resolved Hide resolved
@nononokam
Copy link
Contributor Author

thank you for your comments! I fixed the description and wrap some lines. @domenic

@domenic
Copy link
Member

domenic commented Jan 12, 2024

Great! I'm going to treat mozilla/standards-positions#914 as sufficient implementer support from Mozilla for the WHATWG process, and merge this momentarily.

Please file implementer bugs and an MDN issue, then update the original post with links to them. I believe for this feature the implementers include Gecko and WebKit, but also Node.js and Deno. (It's OK to do this after merging.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants