Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: dont access Object.prototype.type during TransformStream init #46389

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/internal/webstreams/transformstream.js
Expand Up @@ -358,6 +358,7 @@ function initializeTransformStream(
readableSizeAlgorithm) {

const writable = new WritableStream({
__proto__: null,
start() { return startPromise.promise; },
write(chunk) {
return transformStreamDefaultSinkWriteAlgorithm(stream, chunk);
Expand All @@ -374,6 +375,7 @@ function initializeTransformStream(
});

const readable = new ReadableStream({
__proto__: null,
start() { return startPromise.promise; },
pull() {
return transformStreamDefaultSourcePullAlgorithm(stream);
Expand Down
19 changes: 19 additions & 0 deletions test/parallel/test-whatwg-transformstream.js
Expand Up @@ -186,3 +186,22 @@ class Source {
inspect(controller, { depth: 0 }),
/TransformStreamDefaultController \[/);
}

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

new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk);
},
flush(controller) {
controller.terminate();
}
});
aduh95 marked this conversation as resolved.
Show resolved Hide resolved

delete Object.prototype.type;
}