You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -2661,6 +2688,99 @@ create them does not matter.
2661
2688
1. Return « |branch1|, |branch2| ».
2662
2689
</div>
2663
2690
2691
+
<div algorithm>
2692
+
To <dfn lt="fully read">fully read</dfn> a {{ReadableStream}} |stream|, given an algorithm |processBody|, and an algorithm |processBodyError|, run these steps. |processBody| must be an algorithm accepting a [=byte sequence=]. |processBodyError| must be an algorithm optionally accepting an exception.
2693
+
2694
+
1. Let |successSteps| given a [=byte sequence=] |bytes| be to run |processBody| given |bytes|.
2695
+
1. Let |errorSteps| optionally given an exception |exception| be to run |processBodyError| given |exception|.
2696
+
1. Let |reader| be the result of getting a reader for |stream|. If that threw an exception, then run |errorSteps| with that exception and return.
2697
+
1. [=read all bytes|Read all bytes=] from |reader|, given |successSteps| and |errorSteps|.
2698
+
</div>
2699
+
2700
+
<div algorithm>
2701
+
The <dfn lt="consume fully with abort">consume fully with abort</dfn> algorithm, given a {{ReadableStream}} |stream|, an optional {{AbortSignal}} |signal|, and an algorithm that takes a [=byte sequence=] and returns a JavaScript or throws an exception |convertBytesToJSValue|, runs these steps:
2702
+
2703
+
1. Let |promise| be [=a new promise=].
2704
+
1. Let |errorSteps| given |error| to be [=reject=] |promise| with |error|.
2705
+
1. Let |successSteps| given a [=byte sequence=] |data| be to [=resolve=] |promise| with the result of running |convertBytesToJSValue| with |data|. If that threw an exception, then run |errorSteps| with that exception.
2706
+
1. If |signal| is not undefined,
2707
+
1. Let |abortAlgorithm| be the following steps:
2708
+
1. Let |error| be |signal|'s [=AbortSignal/abort reason=].
2709
+
1. Run |errorSteps| with |error|.
2710
+
1. Let |actions| be an empty [=ordered set=].
2711
+
1. If |stream|.[=ReadableStream/[[state]]=] is "`readable`", [=set/append=] the following action action to |actions|:
0 commit comments