Skip to content

Commit

Permalink
stream: add Symbol.toStringTag to Compression Streams
Browse files Browse the repository at this point in the history
PR-URL: #50712
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
panva authored and UlisesGascon committed Jan 9, 2024
1 parent 3b6b1af commit 4cf155c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/internal/webstreams/compression.js
Expand Up @@ -2,6 +2,7 @@

const {
ObjectDefineProperties,
SymbolToStringTag,
Symbol,
} = primordials;

Expand Down Expand Up @@ -149,11 +150,21 @@ class DecompressionStream {
ObjectDefineProperties(CompressionStream.prototype, {
readable: kEnumerableProperty,
writable: kEnumerableProperty,
[SymbolToStringTag]: {
__proto__: null,
configurable: true,
value: 'CompressionStream',
},
});

ObjectDefineProperties(DecompressionStream.prototype, {
readable: kEnumerableProperty,
writable: kEnumerableProperty,
[SymbolToStringTag]: {
__proto__: null,
configurable: true,
value: 'DecompressionStream',
},
});

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-whatwg-webstreams-compression.js
Expand Up @@ -15,6 +15,9 @@ async function test(format) {
const gzip = new CompressionStream(format);
const gunzip = new DecompressionStream(format);

assert.strictEqual(gzip[Symbol.toStringTag], 'CompressionStream');
assert.strictEqual(gunzip[Symbol.toStringTag], 'DecompressionStream');

gzip.readable.pipeTo(gunzip.writable).then(common.mustCall());

const reader = gunzip.readable.getReader();
Expand Down

0 comments on commit 4cf155c

Please sign in to comment.