Skip to content

Commit 8537f2e

Browse files
committed
lib: make structuredClone spec compliant
Fixes: #40246
1 parent 481c160 commit 8537f2e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/internal/structured_clone.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ const {
55
receiveMessageOnPort,
66
} = require('internal/worker/io');
77

8+
const { validateObject } = require('internal/validators');
9+
810
let channel;
911
function structuredClone(value, transfer) {
12+
if (transfer !== undefined)
13+
validateObject(transfer, 'transfer');
14+
1015
// TODO: Improve this with a more efficient solution that avoids
1116
// instantiating a MessageChannel
1217
channel ??= new MessageChannel();

0 commit comments

Comments
 (0)