From a275155e815d031356092a843d1752d12aca60b9 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Mon, 13 Nov 2023 13:47:46 +0100 Subject: [PATCH] stream: add Symbol.toStringTag to Compression Streams PR-URL: https://github.com/nodejs/node/pull/50712 Reviewed-By: Yagiz Nizipli Reviewed-By: Matteo Collina --- lib/internal/webstreams/compression.js | 11 +++++++++++ test/parallel/test-whatwg-webstreams-compression.js | 3 +++ 2 files changed, 14 insertions(+) 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();