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

Re: Lifetime of Blob URL

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 30 Aug 2010 16:35:23 -0700
Message-ID: <AANLkTikS1RB6RLNs2zEENq6mxg5m+imqWJg8Q3gkt372@mail.gmail.com>
To: Darin Fisher <darin@chromium.org>
Cc: arun@mozilla.com, Jian Li <jianli@chromium.org>, Eric Uhrhane <ericu@google.com>, Dmitry Titov <dimich@chromium.org>, Michael Nordman <michaeln@google.com>, David Levin <levin@google.com>, Adrian Bateman <adrianba@microsoft.com>, Web Applications Working Group WG <public-webapps@w3.org>
On Mon, Aug 30, 2010 at 4:22 PM, Darin Fisher <darin@chromium.org> wrote:
> On Mon, Aug 30, 2010 at 1:08 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> On Mon, Aug 30, 2010 at 9:59 AM, Arun Ranganathan <arun@mozilla.com>
>> wrote:
>> >> In addition, BlobError and BlobException sound better because these
>> >> names
>> >> are consistent with current "Blob" naming scheme in File API. So we're
>> >> also
>> >> going to adopt these new names in the WebKit implementation when we
>> >> rename
>> >> FileReader to BlobReader per the spec.
>> >
>> > *sigh.  Naming continues to be hard.  Not everyone's thrilled with the
>> > proliferation of Blob in the API [1] including other major implementors
>> > (my
>> > co-editor included ;-))  but I changed it mainly due to Darin/Jian/other
>> > objections.  I suppose you folks are pretty adamant on the Blob* name?
>>
>> I feel pretty strongly that we should name this back to FileReader,
>> for several reasons:
>>
>> 1. Most people that I talk to dislike the name Blob, much less having
>> it spread to things like BlobReader.
>> 2. My understanding is that the writer counterpart is going to be
>> called FileWriter (is this correct?)
>
> Yes, that is what we are currently implementing in WebKit.
>
>>
>> 3. While it's certainly possible to read Blobs with this, it seems to
>> me like the far most common case will be to read a "real" file, or
>> part of a file (i.e. the result from myfile.slice()).
>>
>> 4. There is one shipping implementation of FileReader
>>
>
> It just seems odd to use an interface named FileReader to read blobs, which
> may not correspond to files.  Consider BlobBuilder, which can be used to
> construct a Blob from a string.

I somewhat agree. But it seems equally strange to use BlobReader to
read files, and I suspect that it will be vastly more common to read
files than blobs-that-aren't-files.

Yes, the File interface inherits Blob, so technically when you're
reading a file you're also reading a blob, but I doubt that is the
mental model most people will have.

Like so many other things, there is no perfect solution here.

> Another idea (possibly a crazy one) would be to eliminate Blob, and just use
> File for everything.  We could rename BlobBuilder to FileBuilder and have it
> return a File instead of a Blob.  Same goes for Blob.slice().  Of course,
> the File would not necessarily correspond to a real physical file on disk
> for performance reasons.

I've been thinking about this too. I can't say I feel strongly either
way. It feels somewhat strange, but I can't come up with any solid
technical reasons against it.

/ Jonas
Received on Monday, 30 August 2010 23:36:17 GMT

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