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: Fri, 30 Mar 2012 08:21:09 -0500
Message-ID: <CABirCh84ue83WUmRLQ-3CnM185_MhzKM4jrAd6mS9myz6tmTmQ@mail.gmail.com>
To: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Cc: public-webapps@w3.org
2012/3/29 Bronislav Klučka <Bronislav.Klucka@bauglir.com>

> If I understand you, you find it problematic that by using weak ref, URL
> would for some time reference actual Blob and other time it would not?
>

The problem is that the following code might or might not work, depending
on the behavior of the browser's GC:

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

If the timer executes before GC collects the blob, this works, because the
URL is still valid.  Otherwise, it fails, because--since the Blob no longer
exists--the URL is no longer valid.

-- 
Glenn Maynard
Received on Friday, 30 March 2012 13:21:59 GMT

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