Re: File API: closed Blob objects

On Dec 12, 2013 12:08 PM, "Jonas Sicking" <jonas@sicking.cc> wrote:
>
>
> On Dec 12, 2013 11:06 AM, "Boris Zbarsky" <bzbarsky@mit.edu> wrote:
> >
> > On 12/12/13 2:01 PM, Jonas Sicking wrote:
> >>
> >> 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).
> >
> >
> > Or form submission after fileInput.files[0].close() ?
>
> Actually this is a matter of definition.
>
> Does fileInput.files expose the actual Files that are being submitted, or
does it expose clones of those files.
>
> Clones are not affected when what they were cloned from is closed.
>
> The simplest solution feels to me like it is to define that
fileInput.files exposes clones. So your code example would then not affect
submission.

Hmm... maybe not actually. That would make things complicated once we start
allowing things like input.files.push(blob).

That would force the implementation to keep a reference to both the blob
and a clone of the blob. And the timing of when blob.close() was called on
a newly added blob would affect if we'd had time to clone it.

This does seem like an argument to create a asynchronous error rather than
throwing an exception though, since for form submission there would be no
place to throw an exception from.

/ Jonas

Received on Thursday, 12 December 2013 20:15:08 UTC