Skip to content

Invalid globalThis.structuredClone interface #40246

New issue

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

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

Already on GitHub? # to your account

Closed
petamoriken opened this issue Sep 28, 2021 · 0 comments
Closed

Invalid globalThis.structuredClone interface #40246

petamoriken opened this issue Sep 28, 2021 · 0 comments

Comments

@petamoriken
Copy link

petamoriken commented Sep 28, 2021

Version

v17.0.0-rc.0

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

related: #39759

According to the specification, the structuredClone options do not take a list of transfers as an array. This is different from postMessage.

https://html.spec.whatwg.org/multipage/structured-data.html#structured-cloning
https://html.spec.whatwg.org/multipage/web-messaging.html#message-ports

const value = new Uint8Array(4);

// valid
port.postMessage(value, [value.buffer]);

// valid
port.postMessage(value, { transfer: [value.buffer] });

// invalid (No transfer)
structuredClone(value, [value.buffer]);

// valid
structuredClone(value, { transfer: [value.buffer] });

minimum test code:

import assert from "assert";

const value = new Uint8Array(4);
structuredClone(value, [value.buffer]);

assert( value.length !== 0 );

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

No response

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Sep 29, 2021
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Sep 29, 2021
VoltrexKeyva added a commit to VoltrexKeyva/node that referenced this issue Sep 29, 2021
danielleadams pushed a commit that referenced this issue Oct 4, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 4, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Oct 5, 2021
Fixes: #40246

PR-URL: #40251
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant