node
node copied to clipboard
Node.js allows the `structedClone` of objects that do "not have a transferable type."
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.