Re: [FileAPI] createObjectURL isReusable proposal

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 UTC