Re: [whatwg/streams] Fix invalid high water mark for tee branches (PR #1234)

@ricea commented on this pull request.

chromium doesn't implement tee for byte streams yet. For default streams, it uses highWaterMark 1.0, which is the same as the standard.

The reference implementation uses highWaterMark 0.0 for byte streams, and passes the tests, so I think it is correct. With highWaterMark 0.0, pull() is not called until read() is called, which avoids unnecessary buffering.

> @@ -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|).

This is the SetUpCrossRealmTransformReadable abstract operation, not the ReadableStreamDefaultTee abstract operation.

> @@ -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).

The value 0 matches what the reference implementation does, and the reference implementation passes the tests.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1234#pullrequestreview-991315087
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1234/review/991315087@github.com>

Received on Wednesday, 1 June 2022 02:04:32 UTC