chore: improve error messages in CompressionStream
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.
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,
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,
