diff options
author | Luca Casonato <hello@lcas.dev> | 2022-02-16 12:21:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 12:21:46 +0100 |
commit | 19c8d7702f0ca0808ca20261f83862257c3c852b (patch) | |
tree | 2d595b3ff7405ed891d16022bb13b982d70eb82f /ext/web/14_compression.js | |
parent | 77a9683425357f106614fc04dcac5654cd4aeece (diff) |
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.
Diffstat (limited to 'ext/web/14_compression.js')
-rw-r--r-- | ext/web/14_compression.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js index 081495894..beff7a059 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, |