Skip to content

Commit 4cf155c

Browse files
panvaUlisesGascon
authored andcommitted
stream: add Symbol.toStringTag to Compression Streams
PR-URL: #50712 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 3b6b1af commit 4cf155c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/internal/webstreams/compression.js

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {
44
ObjectDefineProperties,
5+
SymbolToStringTag,
56
Symbol,
67
} = primordials;
78

@@ -149,11 +150,21 @@ class DecompressionStream {
149150
ObjectDefineProperties(CompressionStream.prototype, {
150151
readable: kEnumerableProperty,
151152
writable: kEnumerableProperty,
153+
[SymbolToStringTag]: {
154+
__proto__: null,
155+
configurable: true,
156+
value: 'CompressionStream',
157+
},
152158
});
153159

154160
ObjectDefineProperties(DecompressionStream.prototype, {
155161
readable: kEnumerableProperty,
156162
writable: kEnumerableProperty,
163+
[SymbolToStringTag]: {
164+
__proto__: null,
165+
configurable: true,
166+
value: 'DecompressionStream',
167+
},
157168
});
158169

159170
module.exports = {

test/parallel/test-whatwg-webstreams-compression.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ async function test(format) {
1515
const gzip = new CompressionStream(format);
1616
const gunzip = new DecompressionStream(format);
1717

18+
assert.strictEqual(gzip[Symbol.toStringTag], 'CompressionStream');
19+
assert.strictEqual(gunzip[Symbol.toStringTag], 'DecompressionStream');
20+
1821
gzip.readable.pipeTo(gunzip.writable).then(common.mustCall());
1922

2023
const reader = gunzip.readable.getReader();

0 commit comments

Comments
 (0)