diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index bbc47f49643425..2dfcf90bce34b4 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, @@ -1470,8 +1469,7 @@ function readableStreamDefaultTee(stream, cloneForBranch2) { const value1 = value; let value2 = value; if (!canceled2 && cloneForBranch2) { - // Structured Clone - value2 = deserialize(serialize(value2)); + value2 = structuredClone(value2); } if (!canceled1) { readableStreamDefaultControllerEnqueue(