From 19c8d7702f0ca0808ca20261f83862257c3c852b Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 16 Feb 2022 12:21:46 +0100 Subject: [PATCH] chore: improve error messages in CompressionStream (#13585) This commit makes the error messages that one sees when passing something other than a BufferSource to a (De)CompressionStream. The WPT tests already pass, because they just check for error type (TypeError), and not error message. A TypeError was already thrown for invalid values via serde_v8. --- ext/web/14_compression.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js index 0814958949..beff7a0595 100644 --- a/ext/web/14_compression.js +++ b/ext/web/14_compression.js @@ -35,7 +35,10 @@ this.#transform = new TransformStream({ transform(chunk, controller) { - // TODO(lucacasonato): convert chunk to BufferSource + chunk = webidl.converters.BufferSource(chunk, { + prefix, + context: "chunk", + }); const output = core.opSync( "op_compression_write", rid, @@ -81,7 +84,10 @@ this.#transform = new TransformStream({ transform(chunk, controller) { - // TODO(lucacasonato): convert chunk to BufferSource + chunk = webidl.converters.BufferSource(chunk, { + prefix, + context: "chunk", + }); const output = core.opSync( "op_compression_write", rid,