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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
panva authored and RafaelGSS committed Nov 29, 2023
1 parent 36380eb commit a275155
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ObjectDefineProperties,
SymbolToStringTag,
} = primordials;

const {
Expand Down Expand Up @@ -137,11 +138,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
Original file line number Diff line number Diff line change
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 a275155

Please sign in to comment.