Re: File API for Review

On Thu, Mar 7, 2013 at 9:09 PM, Arun Ranganathan
<> wrote:
>> I'm also not convinced that leaving what exactly to return in the
>> HTTP scenario open to implementors is a good thing. We've been through
>> such things before and learned that handwaving is bad. Lets just pick
>> something.
> Just to be clear, are you referring to the 500 Error Condition for Blob URLs?
> If so, the only handwaving is about the text of the error message.  I'm happy to tighten even this.

So what I actually think we should do here is treat this as a network
error. XMLHttpRequest already knows about that concept and every other
end point also deals with network errors in a predictable and
standardized way. Phrasing such as "Act as if a network error
occurred" seems sufficient for now (until Fetch provides hooks).

> Right now, the specification encourages user agents to get encoding from:
> 1. The encoding parameter supplied with the readAsText.
> 2. A byte order detection heuristic, if 1. is missing.
> 3. The charset component of Blob.type, if provided and if 1. and 2. yield no result.
> 4. Just use utf-8 if 1, 2, and 3 yield no result.
> Under the encoding spec., it returns failure if encoding isn't valid, and it returns
> failure if the BOM check fails.  So should the spec. say something about throwing?

So I think the decoding part of readAsText() should become something
like this (assuming the argument to readAsText() is renamed to label):

1. Let /encoding/ be null.

2. If /label/ is given, set /encoding/ to the result of "geting an
encoding" (Encoding Standard) for /label/.

3. If /encoding/ is failure, throw a TypeError.

4. If /encoding/ is null, "get an encoding from Blob.type" (not sure
where this would be defined), and if that does not return failure, set
/encoding/ to the result.

5. If /encoding/ is null, set /encoding/ to utf-8.

6. "Decode" (Encoding Standard) the /byte stream/ (or whatever this is
called) using fallback encoding /encoding/.

If throwing above is something implementations do not wish to do, we
should change that to simply ignoring the argument if "get an
encoding" returns failure.


Received on Friday, 8 March 2013 10:02:15 UTC