From 5d345ab137d85fa99a3b9f866b6812dfa4101da7 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 5 Apr 2023 09:13:53 +0200 Subject: [PATCH] Use "pull from bytes" algorithm --- fetch.bs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/fetch.bs b/fetch.bs index d719cdf35..6d5db5414 100644 --- a/fetch.bs +++ b/fetch.bs @@ -6110,7 +6110,7 @@ optional boolean forceNewConnection (default false), run these steps:
  • -

    Let |buffer| be an empty buffer that can have bytes appended to it. +

    Let |buffer| be an empty [=byte sequence=].

    This represents an internal buffer inside the network layer of the user agent. @@ -6134,28 +6134,7 @@ optional boolean forceNewConnection (default false), run these steps: [=task destination=].

      -
    1. Let |available| be the size of |buffer|. - -

    2. Let |desiredSize| be |available|. - -

    3. If |stream|'s [=ReadableStream/current BYOB request view=] is non-null, then set - |desiredSize| to |stream|'s [=ReadableStream/current BYOB request view=]'s - [=BufferSource/byte length=]. - -

    4. Let |extractSize| be the smaller value of |available| and |desiredSize|. - -

    5. Let bytes be the result of extracting |extractSize| of bytes from - buffer. - -

    6. If |stream|s [=ReadableStream/current BYOB request view=] is non-null, then - [=ArrayBufferView/write=] |bytes| into |stream|'s - [=ReadableStream/current BYOB request view=], and set |view| to |stream|'s - [=ReadableStream/current BYOB request view=]. - -

    7. Otherwise, set |view| to the result of [=ArrayBufferView/create|creating=] a - {{Uint8Array}} from |bytes| in |stream|'s [=relevant Realm=]. - -
    8. [=ReadableStream/Enqueue=] |view| into |stream|. +

    9. [=ReadableStream/Pull from bytes=] |buffer| into |stream|.

    10. If |stream| is [=ReadableStream/errored=], then [=fetch controller/terminate=] |fetchParams|'s [=fetch params/controller=].