diff --git a/index.bs b/index.bs index 274f4a279..8a4f5d5e3 100644 --- a/index.bs +++ b/index.bs @@ -6809,20 +6809,23 @@ a chunk from a {{ReadableStreamDefaultReader}} |reader|, given a [=read re

To read all - bytes from a {{ReadableStreamDefaultReader}} |reader|, given |successSteps|, - which is an algorithm accepting a [=byte sequence=], and |failureSteps|, which is an algorithm - accepting a JavaScript value: [=read-loop=] given |reader|, a new [=byte sequence=], - |successSteps|, and |failureSteps|. + bytes from a {{ReadableStreamDefaultReader}} |reader|, given |maxByteLength|, which is an + optional number, |successSteps|, which is an algorithm accepting a [=byte sequence=], and + |failureSteps|, which is an algorithm accepting a JavaScript value: [=read-loop=] given |reader|, a + new [=byte sequence=], |maxByteLength|, |successSteps|, and |failureSteps|.

For the purposes of the above algorithm, to read-loop given |reader|, |bytes|, - |successSteps|, and |failureSteps|: + |maxBytesLength|, |successSteps|, and |failureSteps|: 1. Let |readRequest| be a new [=read request=] with the following [=struct/items=]: : [=read request/chunk steps=], given |chunk| :: 1. If |chunk| is not a {{Uint8Array}} object, call |failureSteps| with a {{TypeError}} and abort these steps. + 1. If |maxBytesLength| is defined, and |bytes|'s [=byte sequence/length=] + + [=byte sequence/length=] of the bytes represented by |chunk| is greater than + |maxBytesLength|, call |failureSteps| with a {{QuotaExceededError}} and abort these steps. 1. Append the bytes represented by |chunk| to |bytes|. 1. [=Read-loop=] given |reader|, |bytes|, |successSteps|, and |failureSteps|.

This recursion could potentially cause a stack overflow if implemented