Skip to content

Commit 1b65277

Browse files
Rebase to match FileReader changes.
1 parent d0b650a commit 1b65277

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

index.bs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -572,45 +572,34 @@ It must act as follows:
572572
### The {{Blob/stream()}} method ### {#stream-method-algo}
573573

574574
The <dfn method for=Blob>stream()</dfn> method, when invoked, must return
575-
the result of [=getting a stream for a Blob=] for the [=context object=].
576-
577-
To <dfn lt="get a stream for a Blob|getting a stream for a Blob">get a stream for a {{Blob}}</dfn>
578-
|blob|, run the following steps:
579-
580-
1. Let |stream| be the result of [=construct a ReadableStream object|constructing=] a
581-
{{ReadableStream}} object.
582-
1. Run the following steps [=in parallel=]:
583-
1. While not all bytes of |blob| have been read:
584-
1. Let |bytes| be the byte sequence that results from reading a [=chunk=] from |blob|.
585-
1. If a [=file read error=] occured while reading |bytes|, [$ReadableStream/error$]
586-
|stream| with a [=failure reason=] and abort these steps.
587-
1. [=ReadableStream/Enqueue=] |bytes| into |stream|.
588-
589-
Issue: We need to specify more concretely what reading from a Blob actually does,
590-
and what possible errors can happen.
591-
1. Return |stream|.
575+
the result of calling [=get stream=] on the [=context object=].
592576

593577
### The {{Blob/text()}} method ### {#text-method-algo}
594578

595579
The <dfn method for=Blob>text()</dfn> method, when invoked, must run these steps:
596580

597-
1. Let |stream| be the the result of [=getting a stream for a Blob=] for the [=context object=].
581+
1. Let |stream| be the result of calling [=get stream=] on the [=context object=].
598582
1. Let |reader| be the result of [=get a reader|getting a reader=] from |stream|.
599583
If that threw an exception, return a new promise rejected with that exception.
600584
1. Let |promise| be the result of [=read all bytes|reading all bytes=] from |stream| with |reader|.
601585
1. Return the result of transforming |promise| by a fulfillment handler that returns the result of
602586
running [=UTF-8 decode=] on its first argument.
603587

588+
Note: This is different from the behavior of {{FileReader/readAsText()}} to align better
589+
with the behavior of {{Body/text()|Body.text()}}. Specifically this method will always
590+
use UTF-8 as encoding, while {{FileReader}} can use a different encoding depending on
591+
the blob's type and passed in encoding name.
592+
604593
### The {{Blob/arrayBuffer()}} method ### {#arraybuffer-method-algo}
605594

606595
The <dfn method for=Blob>arrayBuffer()</dfn> method, when invoked, must run these steps:
607596

608-
1. Let |stream| be the the result of [=getting a stream for a Blob=] for the [=context object=].
597+
1. Let |stream| be the result of calling [=get stream=] on the [=context object=].
609598
1. Let |reader| be the result of [=get a reader|getting a reader=] from |stream|.
610599
If that threw an exception, return a new promise rejected with that exception.
611600
1. Let |promise| be the result of [=read all bytes|reading all bytes=] from |stream| with |reader|.
612601
1. Return the result of transforming |promise| by a fulfillment handler that returns
613-
a new {{ArrayBuffer} whose contents are its first argument.
602+
a new {{ArrayBuffer}} whose contents are its first argument.
614603

615604
<!--
616605
████████ ████ ██ ████████

0 commit comments

Comments
 (0)