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

Re: [FileAPI] createObjectURL isReusable proposal

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 30 Jan 2012 11:29:23 -0500
Message-ID: <4F26C563.1020201@mit.edu>
To: public-webapps@w3.org
On 1/30/12 11:15 AM, Bronislav Klučka wrote:
> In this case you got me... what sense does it make? If there is no
> reference to original blob or any other object using that URL, why is it
> kept?

Because given a string there is no way to tell whether someone has a 
"reference" it.

Consider this:

   window.myStash = URL.createObjectUrl(blob).split("");
   img.src = window.myStash.join("");

   // much later one
   otherImg.src = window.myStash.join("");

This is a simple case, of course.  The url could be stored in all sorts 
of other ways, because strings are very very mungable from JS.

On the other hand, if elements can be given blob objects directly then 
the ownership model is completely clear to both the UA and the developer.

> so just a line
> URL.createObjectUrl(blob)
> creates a memory leak? Heh?

For the lifetime of the document, yes.  Though I suspect that if you 
call it again on the same blob there is no more leak than before.

> Which brink me to my previous question, what happened to Blob.URL? Just
> brink it back and this whole conversation can go away...

The same blob should have different URLs in different documents, no?

-Boris
Received on Monday, 30 January 2012 16:30:14 GMT

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