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
RedYetiDev opened this issue Aug 28, 2024 · 1 comment · Fixed by #54764
Closed
Labels
repro-exists Issues with reproductions. web-standards Issues and PRs related to Web APIs

Comments

@RedYetiDev
Copy link
Member

RedYetiDev 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.
@RedYetiDev RedYetiDev added repro-exists Issues with reproductions. web-standards Issues and PRs related to Web APIs labels Aug 28, 2024
@WontonSam

This comment was marked as spam.

aduh95 pushed a commit that referenced this issue Sep 12, 2024
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: #54764
Fixes: #54602
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: nodejs#54764
Fixes: nodejs#54602
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repro-exists Issues with reproductions. web-standards Issues and PRs related to Web APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants