Re: File API: closed Blob objects

On Dec 12, 2013 11:47 AM, "Arun Ranganathan" <arun@mozilla.com> wrote:
>
> On Dec 12, 2013, at 2:01 PM, Jonas Sicking wrote:
>
>>
>> On Dec 12, 2013 9:55 AM, "Arun Ranganathan" <arun@mozilla.com>
wrote:Reading from a Blob that has been closed() is a developer error with
high degree of certainty. Nothing useful can come out of that.
>>
>> So I think we do the developer a benefit by treating it as such and
signaling an error through whatever mechanism is appropriate depending on
how the reading was done.
>>
>> We can certainly debate if throwing an exception or if asynchronously
reporting a network error is the right thing to do for things like
XHR.send(closedBlob) or FileReader.readAsX(closedBlob).
>
>
> So right now (in spec.) any Blob URL operations on a closed Blob must
result in a network error. FileReader.readAsX(closedBlob) operations are
equivalent to reading a Blob of size 0.

I think we should treat it as an error yeah.

Since blob reading by nature has to be asynchronous and thus asynchronously
produce an error, maybe the most consistent thing is to make XHR.send() and
FileReader.readAsX also asynchronously produce a read error.

This also has a lower risk of producing catastrophic problems.

/ Jonas

Received on Thursday, 12 December 2013 20:00:25 UTC