From 8abc1ed85ae58e38d083cd5c9dc8f1c1f471dd7c Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 24 Nov 2022 11:56:13 -0500 Subject: [PATCH 1/3] stream: use structuredClone instead of v8 --- lib/internal/webstreams/readablestream.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index 256075d3a1cfaa..846dbba99d2bf9 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -55,11 +55,6 @@ const { kEnumerableProperty, } = require('internal/util'); -const { - serialize, - deserialize, -} = require('v8'); - const { validateBuffer, validateObject, @@ -90,6 +85,10 @@ const { kIsReadable, } = require('internal/streams/utils'); +const { + structuredClone, +} = require('internal/structured_clone'); + const { ArrayBufferViewGetBuffer, ArrayBufferViewGetByteLength, @@ -1471,7 +1470,7 @@ function readableStreamDefaultTee(stream, cloneForBranch2) { let value2 = value; if (!canceled2 && cloneForBranch2) { // Structured Clone - value2 = deserialize(serialize(value2)); + value2 = structuredClone((value2)); } if (!canceled1) { readableStreamDefaultControllerEnqueue( From 26f28d4830b22238d09dc6879fb16547a980ea08 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 24 Nov 2022 13:16:42 -0500 Subject: [PATCH 2/3] fixup! stream: use structuredClone instead of v8 --- lib/internal/webstreams/readablestream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index 846dbba99d2bf9..36950de6ef7bab 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -1470,7 +1470,7 @@ function readableStreamDefaultTee(stream, cloneForBranch2) { let value2 = value; if (!canceled2 && cloneForBranch2) { // Structured Clone - value2 = structuredClone((value2)); + value2 = structuredClone(value2); } if (!canceled1) { readableStreamDefaultControllerEnqueue( From 9c76a8b7a08c96bd58465bfaa15b304be9e20eb3 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 25 Nov 2022 13:51:05 -0500 Subject: [PATCH 3/3] fixup! stream: use structuredClone instead of v8 --- lib/internal/webstreams/readablestream.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index 36950de6ef7bab..f53fb53a7e3825 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -1469,7 +1469,6 @@ function readableStreamDefaultTee(stream, cloneForBranch2) { const value1 = value; let value2 = value; if (!canceled2 && cloneForBranch2) { - // Structured Clone value2 = structuredClone(value2); } if (!canceled1) {