Skip to content

Commit

Permalink
stream: dont access Object.prototype.type during TransformStream init
Browse files Browse the repository at this point in the history
  • Loading branch information
debadree25 committed Jan 28, 2023
1 parent 47cd966 commit b2a828b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/internal/webstreams/transformstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ function initializeTransformStream(
close() {
return transformStreamDefaultSinkCloseAlgorithm(stream);
},
__proto__: null
}, {
highWaterMark: writableHighWaterMark,
size: writableSizeAlgorithm,
Expand All @@ -382,6 +383,7 @@ function initializeTransformStream(
transformStreamErrorWritableAndUnblockWrite(stream, reason);
return PromiseResolve();
},
__proto__: null,
}, {
highWaterMark: readableHighWaterMark,
size: readableSizeAlgorithm,
Expand Down
15 changes: 15 additions & 0 deletions test/parallel/test-whatwg-transformstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,18 @@ class Source {
inspect(controller, { depth: 0 }),
/TransformStreamDefaultController \[/);
}

{
Object.defineProperty(Object.prototype, 'type', {
get: common.mustNotCall()
});

new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk);
},
flush(controller) {
controller.terminate();
}
});
}

0 comments on commit b2a828b

Please sign in to comment.