diff --git a/lib/internal/webstreams/compression.js b/lib/internal/webstreams/compression.js index 32f3f9b4605032..ac10d093dcefcc 100644 --- a/lib/internal/webstreams/compression.js +++ b/lib/internal/webstreams/compression.js @@ -2,6 +2,7 @@ const { ObjectDefineProperties, + SymbolToStringTag, } = primordials; const { @@ -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 = { diff --git a/test/parallel/test-whatwg-webstreams-compression.js b/test/parallel/test-whatwg-webstreams-compression.js index fb20801543bff6..c144a0a2e3d43d 100644 --- a/test/parallel/test-whatwg-webstreams-compression.js +++ b/test/parallel/test-whatwg-webstreams-compression.js @@ -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();