Skip to content

Commit

Permalink
stream: use structuredClone instead of v8
Browse files Browse the repository at this point in the history
PR-URL: #45611
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
anonrig authored and targos committed Dec 12, 2022
1 parent aabfdef commit 56eee72
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ const {
kEnumerableProperty,
} = require('internal/util');

const {
serialize,
deserialize,
} = require('v8');

const {
validateBuffer,
validateObject,
Expand Down Expand Up @@ -90,6 +85,10 @@ const {
kIsReadable,
} = require('internal/streams/utils');

const {
structuredClone,
} = require('internal/structured_clone');

const {
ArrayBufferViewGetBuffer,
ArrayBufferViewGetByteLength,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 56eee72

Please sign in to comment.