Re: [XHR2] Blobs, names and FormData

On Mon, Jul 18, 2011 at 2:52 PM, Charles Pritchard <chuck@jumis.com> wrote:
> On 7/18/2011 2:42 PM, Jonas Sicking wrote:
>>>
>>> >  If there is an API that replies on File to
>>> >  work correctly we think we should fix it to work with Blob. For
>>> > example, FileReader is
>>> >  really BlobReader and works fine with Blobs. To me, getFile() should
>>> > be unnecessary and
>>> >  the best fix for FormData is to just modify append for this situation.
>>
>> While File and Blob are indeed very similar, they are also not the
>> same thing. I think being able to create files is an easy addition for
>> implementations, while it means not restricting getting Files from the
>> users file system. So if you have code that expects to read a File
>> from IndexedDB, the page can either populate that from the users
>> filesystem, or by generating the data manually and using
>> BlobBuilder.getFile.
>
> I'm very interested in this use case; I've been told that there may be
> issues
> with IndexedDB transaction constraints and FileReader/writer.
>
> Afaik, filewriter doesn't apply to blobs in this case. I don't know the
> consequences of
> callbacks to reader functions in the event loop, and whether that would end
> up "blocking"
> idb events. I'd imagine the blob is simply reset, and the stale reference
> remains until it can
> be cleaned up.

Note that File objects are immutable just like Blobs are, so none of
this applies here.

The issues that you're talking about come up once we start talking
about FileEntries, but that's an entirely different beast which are
unrelated to this thread. No-one has suggested being able to create a
FileEntry using BlobBuilder, nor that FileEntries are required to
submit named content using FormData.

Hope that helps.

/ Jonas

Received on Monday, 18 July 2011 22:01:44 UTC