diff --git a/lib/internal/webstreams/encoding.js b/lib/internal/webstreams/encoding.js index b5533b4287b65a..9cfea36989a228 100644 --- a/lib/internal/webstreams/encoding.js +++ b/lib/internal/webstreams/encoding.js @@ -133,6 +133,9 @@ class TextDecoderStream { this.#handle = new TextDecoder(encoding, options); this.#transform = new TransformStream({ transform: (chunk, controller) => { + if (chunk === undefined) { + throw new ERR_INVALID_THIS('TextDecoderStream'); + } const value = this.#handle.decode(chunk, { stream: true }); if (value) controller.enqueue(value); diff --git a/test/wpt/status/encoding.json b/test/wpt/status/encoding.json index e78a8b3c0791be..f9378d7195a2a7 100644 --- a/test/wpt/status/encoding.json +++ b/test/wpt/status/encoding.json @@ -66,13 +66,6 @@ "streams/decode-utf8.any.js": { "requires": ["small-icu"] }, - "streams/decode-bad-chunks.any.js": { - "fail": { - "expected": [ - "chunk of type undefined should error the stream" - ] - } - }, "streams/decode-non-utf8.any.js": { "requires": ["full-icu"] },