Skip to content

Commit 8b1ff5a

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 d7421ba commit 8b1ff5a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

‎lib/internal/webstreams/compression.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const{
44
ObjectDefineProperties,
5-
Symbol,
5+
SymbolToStringTag,
66
}=primordials;
77

88
const{
@@ -149,11 +149,21 @@ class DecompressionStream{
149149
ObjectDefineProperties(CompressionStream.prototype,{
150150
readable: kEnumerableProperty,
151151
writable: kEnumerableProperty,
152+
[SymbolToStringTag]: {
153+
__proto__: null,
154+
configurable: true,
155+
value: 'CompressionStream',
156+
},
152157
});
153158

154159
ObjectDefineProperties(DecompressionStream.prototype,{
155160
readable: kEnumerableProperty,
156161
writable: kEnumerableProperty,
162+
[SymbolToStringTag]: {
163+
__proto__: null,
164+
configurable: true,
165+
value: 'DecompressionStream',
166+
},
157167
});
158168

159169
module.exports={

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ async function test(format){
1515
constgzip=newCompressionStream(format);
1616
constgunzip=newDecompressionStream(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
constreader=gunzip.readable.getReader();

0 commit comments

Comments
(0)