summaryrefslogtreecommitdiff
path: root/ext/web/06_streams.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r--ext/web/06_streams.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 933d7b09c..361e5e055 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -813,6 +813,12 @@
const { value: chunk, done } = await reader.read();
if (done) break;
+ if (!ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk)) {
+ throw new TypeError(
+ "Can't convert value to Uint8Array while consuming the stream",
+ );
+ }
+
ArrayPrototypePush(chunks, chunk);
totalLength += chunk.byteLength;
}