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

Structured cloning of transferable non-serializable objects should throw DOMException instead of TypeError #40841

Closed
zloirock opened this issue Nov 17, 2021 · 2 comments · Fixed by #47839

Comments

@zloirock
Copy link

Version

17.1.0

Platform

MacOS 12

Subsystem

No response

What steps will reproduce the bug?

structuredClone(new MessageChannel().port1); // => `TypeError` instead of `DOMException`

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal

What do you see instead?

No response

Additional information

No response

@iam-frankqiu iam-frankqiu added the macos Issues and PRs related to the macOS platform / OSX. label Nov 18, 2021
@targos targos removed the macos Issues and PRs related to the macOS platform / OSX. label Nov 21, 2021
@targos
Copy link
Member

targos commented Nov 21, 2021

Currently, structuredClone borrows the cloning code used to transfer messages between MessagePorts. Are we also supposed to throw a DOMException for that case or do we need to split the implementations?

@legendecas
Copy link
Member

legendecas commented May 4, 2023

Currently, structuredClone borrows the cloning code used to transfer messages between MessagePorts. Are we also supposed to throw a DOMException for that case or do we need to split the implementations?

The structuredClone and postMessage share the same underlying HTML structured serialize algorithm. So yes, we are supposed to throw a DOMException for MessagePorts too.

nodejs-github-bot pushed a commit that referenced this issue Oct 8, 2023
Instead of TypeError, throwing DOMException in accordance to the HTML
structured serialize algorithms.

PR-URL: #47839
Fixes: #40841
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
alexfernandez pushed a commit to alexfernandez/node that referenced this issue Nov 1, 2023
Instead of TypeError, throwing DOMException in accordance to the HTML
structured serialize algorithms.

PR-URL: nodejs#47839
Fixes: nodejs#40841
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
debadree25 pushed a commit to debadree25/node that referenced this issue Apr 15, 2024
Instead of TypeError, throwing DOMException in accordance to the HTML
structured serialize algorithms.

PR-URL: nodejs#47839
Fixes: nodejs#40841
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants