From 88942654142764b12923228047aebf987ab599b2 Mon Sep 17 00:00:00 2001 From: Yonathan Randolph Date: Tue, 31 May 2022 17:17:59 -0700 Subject: [PATCH] Fix invalid high water mark for tee branches strategyHWM must be a positive number because ReadableStreamDefaultControllerShouldCallPull and ReadableByteStreamControllerShouldCallPull return true when desiredSize > 0, so if strategyHWM is zero (and thus desiredSize = strategyHWM - queueTotalSize will initially be 0), then the tee branches would signal backpressure forever. --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 2a9f693f0..fbdaad897 100644 --- a/index.bs +++ b/index.bs @@ -2073,7 +2073,7 @@ The following abstract operations operate on {{ReadableStream}} instances at a h 1. Perform ! [$InitializeReadableStream$](|stream|). 1. Let |controller| be a [=new=] {{ReadableByteStreamController}}. 1. Perform ? [$SetUpReadableByteStreamController$](|stream|, |controller|, |startAlgorithm|, - |pullAlgorithm|, |cancelAlgorithm|, 0, undefined). + |pullAlgorithm|, |cancelAlgorithm|, 1, undefined). 1. Return |stream|.

This abstract operation will throw an exception if and only if the supplied @@ -6459,7 +6459,7 @@ abstract operations are used to implement these "cross-realm transforms". 1. Otherwise, return [=a promise resolved with=] undefined. 1. Let |sizeAlgorithm| be an algorithm that returns 1. 1. Perform ! [$SetUpReadableStreamDefaultController$](|stream|, |controller|, |startAlgorithm|, - |pullAlgorithm|, |cancelAlgorithm|, 0, |sizeAlgorithm|). + |pullAlgorithm|, |cancelAlgorithm|, 1, |sizeAlgorithm|).

Implementations are encouraged to explicitly handle failures from the asserts in this algorithm, as the input might come from an untrusted context. Failure to do so could lead to