Re: [XHR2] Blobs, names and FormData

Given that this seems to be the way people prefer to do it, I'm fine
with doing that for Gecko too. But we definitely would need to get
FormData.append changed so that it supports the use case.

/ Jonas

On Mon, Aug 22, 2011 at 1:40 PM, Michael Nordman <michaeln@google.com> wrote:
> A few of us on the chrome team just discussed this. We see this as a
> deficiency in the FormData interface and intend to address it by providing a
> variant of FormData.append(...) that allows the caller to provide a
> 'filename' when appending a blob. We don't intend to implement
> BlobBuilder.getFile().
> Anne, would you be willing to massage the XHR2 spec to allow for the
> additional param in the case of a blob?
>
> On Mon, Jul 18, 2011 at 3:00 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> 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 Tuesday, 23 August 2011 00:26:36 UTC