From 3d11bafaa0e91e9b9b5d495c2c10a2e95c53a600 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/nodejs/node/issues/40246 PR-URL: https://github.com/nodejs/node/pull/40251 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel --- lib/internal/structured_clone.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/structured_clone.js b/lib/internal/structured_clone.js index 1d5d0ed511c9cc..2ee9517284ab6e 100644 --- a/lib/internal/structured_clone.js +++ b/lib/internal/structured_clone.js @@ -6,13 +6,13 @@ const { } = require('internal/worker/io'); let channel; -function structuredClone(value, transfer) { +function structuredClone(value, options = undefined) { // TODO: Improve this with a more efficient solution that avoids // instantiating a MessageChannel channel ??= new MessageChannel(); channel.port1.unref(); channel.port2.unref(); - channel.port1.postMessage(value, transfer); + channel.port1.postMessage(value, options?.transfer); return receiveMessageOnPort(channel.port2).message; }