From e5aea2f321bfedb9942bc5eca16314a2d107dd3a Mon Sep 17 00:00:00 2001 From: Marijn Kruisselbrink Date: Fri, 8 Mar 2019 14:39:43 -0800 Subject: [PATCH] Address some comments. --- index.bs | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/index.bs b/index.bs index 5ea9f6d..b4395da 100644 --- a/index.bs +++ b/index.bs @@ -545,56 +545,46 @@ It must act as follows: -

-The stream method

+### The {{Blob/stream()}} method ### {#stream-method-algo} -The stream() method returns the contents -of the blob as a {{ReadableStream}}. - -It must return the result of [=getting a stream for a Blob=] for the [=context object=]. +The stream() method, when invoked, must return +the result of [=getting a stream for a Blob=] for the [=context object=]. To get a stream for a {{Blob}} |blob|, run the following steps: 1. Let |stream| be the result of [=construct a ReadableStream object|constructing=] a {{ReadableStream}} object. -1. Return |stream| and run the following steps [=in parallel=]: +1. Run the following steps [=in parallel=]: 1. While not all bytes of |blob| have been read: 1. Let |bytes| be the byte sequence that results from reading a [=chunk=] from |blob|. 1. If a [=file read error=] occured while reading |bytes|, [$ReadableStream/error$] |stream| with a [=failure reason=] and abort these steps. 1. [=ReadableStream/Enqueue=] |bytes| into |stream|. - Issue: We need to specify more concretely what reading from a Blob actually does, and what - possible errors can happen. - -

-The text method

+ Issue: We need to specify more concretely what reading from a Blob actually does, + and what possible errors can happen. +1. Return |stream|. -The text() method returns the contents -of the blob as a {{USVString}}. +### The {{Blob/text()}} method ### {#text-method-algo} -It must act as follows: +The text() method, when invoked, must run these steps: 1. Let |stream| be the the result of [=getting a stream for a Blob=] for the [=context object=]. -1. Let |reader| be the result of [=getting a reader=] from |stream|. +1. Let |reader| be the result of [=get a reader|getting a reader=] from |stream|. If that threw an exception, return a new promise rejected with that exception. -1. Let |promise| be the result of [=reading all bytes=] from |stream| with |reader|. +1. Let |promise| be the result of [=read all bytes|reading all bytes=] from |stream| with |reader|. 1. Return the result of transforming |promise| by a fulfillment handler that returns the result of running [=UTF-8 decode=] on its first argument. -

-The arrayBuffer method

+### The {{Blob/arrayBuffer()}} method ### {#arraybuffer-method-algo} -The arrayBuffer() method returns the contents -of the blob as an {{ArrayBuffer}}. - -It must act as follows: +The arrayBuffer() method, when invoked, must run these steps: 1. Let |stream| be the the result of [=getting a stream for a Blob=] for the [=context object=]. -1. Let |reader| be the result of [=getting a reader=] from |stream|. +1. Let |reader| be the result of [=get a reader|getting a reader=] from |stream|. If that threw an exception, return a new promise rejected with that exception. -1. Let |promise| be the result of [=reading all bytes=] from |stream| with |reader|. +1. Let |promise| be the result of [=read all bytes|reading all bytes=] from |stream| with |reader|. 1. Return the result of transforming |promise| by a fulfillment handler that returns a new {{ArrayBuffer} whose contents are its first argument.