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

Node.js allows the structedClone of objects that do "not have a transferable type." #54602

Closed
avivkeller opened this issue Aug 28, 2024 · 1 comment · Fixed by #54764
Closed
Labels
web-standards Issues and PRs related to Web APIs

Comments

@avivkeller
Copy link
Member

avivkeller commented Aug 28, 2024

The structuredClone function in JavaScript behaves differently in Node.js and web browsers when cloning a Blob object with the transfer option. In Node.js, the Blob is cloned successfully, while in web browsers, a DataCloneError is thrown. This discrepancy is causing the web platform tests in #54468 to fail.

const blob = new Blob();
console.log(structuredClone(blob, { transfer: [blob] }));
  • Node.js Behavior: Successful cloning of the Blob
  • Web Browser Behavior: Uncaught DataCloneError: Failed to execute 'structuredClone' on 'Window': Value at index 0 does not have a transferable type.
@avivkeller avivkeller added repro-exists web-standards Issues and PRs related to Web APIs labels Aug 28, 2024
aduh95 pushed a commit that referenced this issue Sep 12, 2024
Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #54764
Fixes: #54602
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: nodejs#54764
Fixes: nodejs#54602
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
tpoisseau pushed a commit to tpoisseau/node that referenced this issue Nov 21, 2024
Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: nodejs#54764
Fixes: nodejs#54602
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-standards Issues and PRs related to Web APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@avivkeller and others