W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [XHR2] Blobs, names and FormData

From: Michael Nordman <michaeln@google.com>
Date: Mon, 22 Aug 2011 13:40:29 -0700
Message-ID: <CAHpoE=i2M7+wvGp9QLhvUwNgZMzuonQ2T-32tud0VsHQ9w1k6w@mail.gmail.com>
To: Anne van Kesteren <annevk@opera.com>
Cc: Charles Pritchard <chuck@jumis.com>, Adrian Bateman <adrianba@microsoft.com>, Julian Reschke <julian.reschke@gmx.de>, Alfonso Martínez de Lizarrondo <amla70@gmail.com>, Webapps WG <public-webapps@w3.org>, Jonas Sicking <jonas@sicking.cc>
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 Monday, 22 August 2011 20:41:04 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT