W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: File API "oneTimeOnly" is too poorly defined

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 29 Mar 2012 17:19:31 -0500
Message-ID: <CABirCh_wh8mWjqCB7Uj=LDDLL1otNzhDEcA9Nh0fxX4+eD40ww@mail.gmail.com>
To: Darin Fisher <darin@chromium.org>
Cc: Jonas Sicking <jonas@sicking.cc>, public-webapps WG <public-webapps@w3.org>
On Thu, Mar 29, 2012 at 2:29 AM, Darin Fisher <darin@chromium.org> wrote:

> I've never been terribly happy with createObjectURL and the requirement for
> folks to remember to call revokeObjectURL.  I really like that we're
> talking
> about ways to minimize this pain :-)
> I noticed the WeakRefs proposal:
> http://wiki.ecmascript.org/doku.php?id=strawman:weak_refs

This exposes GC behavior, though.  They try to reduce that by making it
only collectable during the event loop, but it's still observable.  For

blob = createObjectURL();
blob = null;
setTimeout(function() { img.src = blob; }, 0);

might or might not succeed.

(IIRC, WeakMaps avoid GC exposure by being non-enumerable.  That seems to
make them not very useful, since it's hardly different from simply
assigning properties to the object.)

On Thu, Mar 29, 2012 at 6:08 AM, Robert O'Callahan <robert@ocallahan.org>wrote:

> It might be a bit better to revoke the URL at the next stable state.
> Microtask checkpoints can happen during synchronous script execution.

I'm confused.  I'd never seen microtasks actually defined (only suggested),
but I see it's just not defined in the page I was viewing.  It looks like
Google's returning out of date spec links (
 This is the second time I've been bit recently by landing on a weird,
out-of-date spec URL (ignoring the /TR/ trap, which I know to watch out

So, "microtask" isn't what we need here (and not what IndexedDB needs,
either).  Stable state might be correct.  I think that has another effect,
which you don't get by waiting for the event loop: blob URLs would also be
freed between <script> execution.  That is, in

<script>url = URL.createObjectURL(blob); ...</script><script>...</script>

the blob is released before the second <script> is run.  That seems like a

getObjectURL(blob, {auto: true}) would simply do:

N+1. Return the generated url, and then continue running this algorithm
N+2. Await a stable state.
N+3. Revoke url.

which doesn't require any new concepts.

I'd suggest "auto" as the option name; it's short, since it'd probably be
used a lot.

On Thu, Mar 29, 2012 at 3:03 AM, Charles Pritchard <chuck@jumis.com> wrote:

> Any feedback on what exists in modern implementations? MS seems to have
> the most hard-line stance when talking about this API.

As far as I could tell, MS implemented something behind closed doors,
presented it whole, and then more or less refused to change anything,
despite the serious issues pointed out in it.  Web API development can't
work that way in 2012.

Glenn Maynard
Received on Thursday, 29 March 2012 22:20:01 GMT

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