From 8537f2e457f2895430789ad20b060c397c48061f Mon Sep 17 00:00:00 2001 From: voltrexmaster Date: Tue, 28 Sep 2021 21:41:56 -0700 Subject: [PATCH] lib: make structuredClone spec compliant Fixes: https://github.com/nodejs/node/issues/40246 --- lib/internal/structured_clone.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/internal/structured_clone.js b/lib/internal/structured_clone.js index 1d5d0ed511c9cc9..b5f901e14280f74 100644 --- a/lib/internal/structured_clone.js +++ b/lib/internal/structured_clone.js @@ -5,8 +5,13 @@ const { receiveMessageOnPort, } = require('internal/worker/io'); +const { validateObject } = require('internal/validators'); + let channel; function structuredClone(value, transfer) { + if (transfer !== undefined) + validateObject(transfer, 'transfer'); + // TODO: Improve this with a more efficient solution that avoids // instantiating a MessageChannel channel ??= new MessageChannel();