Skip to content

Make MessagePort's close() set [[Detached]] - #3584

Merged
annevk merged 1 commit into
masterfrom
annevk/messagechannel-close
Apr 27, 2018
Merged

annevk merged 1 commit into
masterfrom
annevk/messagechannel-close

Conversation

@annevk

@annevk annevk commented Mar 21, 2018 •

Copy link
Copy Markdown
Member

@bakulf suggested doing this as it makes MessageChannel objects more consistent with other transferable objects that offer a close() method.


/web-messaging.html ( diff )

@annevk annevk added normative change needs tests Moving the issue forward requires someone to write tests labels Mar 21, 2018
annevk added a commit to web-platform-tests/wpt that referenced this pull request Mar 21, 2018
@annevk annevk added do not merge yet Pull request must not be merged per rationale in comment interop Implementations are not interoperable with each other and removed needs tests Moving the issue forward requires someone to write tests labels Mar 21, 2018
@annevk

annevk commented Mar 21, 2018

Copy link
Copy Markdown
Member Author

Edge is doing this, but Chrome, Firefox, and Safari are not.

Paging @cdumez @mkruisselbrink @bakulf @jeremyroman for thoughts.

@annevk

annevk commented Mar 21, 2018

Copy link
Copy Markdown
Member Author

And @dstorey, just in case Edge is running into issues because of this.

@mkruisselbrink

Copy link
Copy Markdown
Contributor

I've thought about it, since it definitely would make our chrome implementation a lot simpler (for a very long time we had a bug where transferring a closed message port would magically re-open it). No idea why ports were specified to behave the way they do. I do wonder how web compatible this change is? Of course there is not much point in transferring closed ports, but throwing where before we didn't throw might still cause sites to break...

@annevk

annevk commented Mar 21, 2018

Copy link
Copy Markdown
Member Author

Yeah, Edge is shipping it which makes me think it's feasible. Though note there's other ways to disentangle ports that wouldn't make them closed. I'm not sure such a concern would go away completely.

@mkruisselbrink

Copy link
Copy Markdown
Contributor

Yeah, it definitely feels like something that should be safe. I added a usecounter to chrome in https://chromium-review.googlesource.com/#/c/973693/ to hopefully verify that it is indeed not something websites "use".

aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 21, 2018
There is discussion in whatwg/html#3584 about no
longer allowing this, so measure how often this actually is used.

Bug: None
Change-Id: Id4ccf910993df37fa1754954f4fe9fc05cbd4493
Reviewed-on: https://chromium-review.googlesource.com/973693
Reviewed-by: Jeremy Roman <[email protected]>
Commit-Queue: Marijn Kruisselbrink <[email protected]>
Cr-Commit-Position: refs/heads/master@{#544778}
@domenic

domenic commented Apr 26, 2018

Copy link
Copy Markdown
Member

@mkruisselbrink can you estimate when that use counter will hit stable, so we can set a calendar reminder to revisit this when it does?

@mkruisselbrink

Copy link
Copy Markdown
Contributor

@mkruisselbrink can you estimate when that use counter will hit stable, so we can set a calendar reminder to revisit this when it does?

It landed in M67, so it hit beta today and should hit stable in ~6 weeks. So far I haven't seen a single hit though, so either I've made a mistake, or there really isn't any usage (in dev/canary). I'm at least convinced that it should be perfectly safe to make this change, up to you if you want to wait for stable numbers.

@annevk

annevk commented Apr 27, 2018

Copy link
Copy Markdown
Member Author

It seems that @bakulf already made this change in Fx btw.

@bakulf

bakulf commented Apr 27, 2018

Copy link
Copy Markdown

annevk added a commit to web-platform-tests/wpt that referenced this pull request Apr 27, 2018
@domenic

domenic commented Apr 27, 2018

Copy link
Copy Markdown
Member

Hmm, should we go ahead and merge and file bugs then?

@annevk

annevk commented Apr 27, 2018

Copy link
Copy Markdown
Member Author

Seems nobody is opposed, so that would work for me.

@domenic domenic removed the do not merge yet Pull request must not be merged per rationale in comment label Apr 27, 2018
@annevk
annevk merged commit ee5ff06 into master Apr 27, 2018
@annevk
annevk deleted the annevk/messagechannel-close branch April 27, 2018 16:57
annevk added a commit to web-platform-tests/wpt that referenced this pull request Apr 27, 2018
@annevk

annevk commented Apr 27, 2018

Copy link
Copy Markdown
Member Author

Sigh, it's MessagePort's close() method. I corrected it for the tests, but forgot about it here. Sorry!

@annevk annevk changed the title Make MessageChannel's close() set [[Detached]] Make MessagePort's close() set [[Detached]] Apr 27, 2018
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request May 2, 2018
…tonly

Automatic update from web-platform-testsMake MessagePort's close() detach

For whatwg/html#3584.

--

wpt-commits: b51b155ffce7a030397dc173e20628ae2742e030
wpt-pr: 10123
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…tonly

Automatic update from web-platform-testsMake MessagePort's close() detach

For whatwg/html#3584.

--

wpt-commits: b51b155ffce7a030397dc173e20628ae2742e030
wpt-pr: 10123

UltraBlame original commit: 346413cd49cafc88c2bb5a555ce3c15d9d3f3d41
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…tonly

Automatic update from web-platform-testsMake MessagePort's close() detach

For whatwg/html#3584.

--

wpt-commits: b51b155ffce7a030397dc173e20628ae2742e030
wpt-pr: 10123

UltraBlame original commit: 346413cd49cafc88c2bb5a555ce3c15d9d3f3d41
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
…tonly

Automatic update from web-platform-testsMake MessagePort's close() detach

For whatwg/html#3584.

--

wpt-commits: b51b155ffce7a030397dc173e20628ae2742e030
wpt-pr: 10123

UltraBlame original commit: 346413cd49cafc88c2bb5a555ce3c15d9d3f3d41
webkit-early-warning-system pushed a commit to cdumez/WebKit that referenced this pull request Sep 20, 2022
https://bugs.webkit.org/show_bug.cgi?id=185078

Reviewed by Brent Fulgham.

Throw a DataCloneError when trying to serialize a MessagePort that has been detached / closed:
- whatwg/html#3584

This aligns our behavior with Gecko and the HTML specification.

* LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.any.worker-expected.txt:
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::create):
* Source/WebCore/dom/MessageChannel.cpp:
(WebCore::MessageChannel::MessageChannel):
* Source/WebCore/dom/MessagePort.cpp:
(WebCore::MessagePort::close):
(WebCore::MessagePort::dispatchEvent):
(WebCore::MessagePort::virtualHasPendingActivity const):
* Source/WebCore/dom/MessagePort.h:

Canonical link: https://commits.webkit.org/254661@main
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…tonly

Automatic update from web-platform-testsMake MessagePort's close() detach

For whatwg/html#3584.

--

wpt-commits: b51b155ffce7a030397dc173e20628ae2742e030
wpt-pr: 10123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interop Implementations are not interoperable with each other normative change

Development

Successfully merging this pull request may close these issues.

4 participants