W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

RE: [FileAPI] createObjectURL isReusable proposal

From: Adrian Bateman <adrianba@microsoft.com>
Date: Wed, 14 Dec 2011 16:19:53 +0000
To: Simon Pieters <simonp@opera.com>, "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>
CC: Feras Moussa <ferasm@microsoft.com>
Message-ID: <6895C7B67488C14AA23F0E079F0D7E8F1990A6@TK5EX14MBXC284.redmond.corp.microsoft.com>
On Tuesday, December 13, 2011 10:41 PM, Simon Pieters wrote:
> On Wed, 14 Dec 2011 01:52:04 +0100, Adrian Bateman
> <adrianba@microsoft.com> wrote:
> > At TPAC [1,2] I described our proposal for adding an isReusable flag
> > to createObjectURL. A common pattern we have seen is the need for a
> > blob URL for a single use (for example, loading into an <img> element)
> > and then revoking the URL. This requires a fair amount of boilerplate
> > code to handle the load/error events.
> >
> > createObjectURL is modified as follows:
> >
> > static DOMString createObjectURL(Blob blob, [optional] bool
> > isReusable);
> >
> > The value of isReusable defaults to true if it is not supplied and
> > this results in the behaviour documented for File API today. However,
> > if you supply false for the flag then the first dereference of the URL
> > revokes it.
> 
> Could the argument have inverted semantics? Optional arguments that
> default to true are a bit confusing. Usually omitted boolean arguments
> default to false.

We could obviously reverse the check - the approach we chose was based on
feedback for what people felt was intuitive. It's a subjective decision,
of course. There are other places in the web platform with defaults to
true. I'm not wedded to one way or the other but for the code we've
written so far, which we could change.

Cheers,

Adrian.
Received on Wednesday, 14 December 2011 16:21:29 GMT

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