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

Re: [FileAPI] createObjectURL isReusable proposal

From: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Date: Mon, 30 Jan 2012 17:44:34 +0100
Message-ID: <4F26C8F2.8090202@bauglir.com>
To: public-webapps@w3.org


On 30.1.2012 17:29, Boris Zbarsky wrote:
> 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.
Both could be solved by Blob.URL, there is no strange string somehow 
connected to blob. Blob belongs to URL and URL belongs to blob... who 
cares how exactly is the string created (split -> join), it is string 
identification, not pointer reference...
>
>> 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?
All documents originated from the same application/session/same-origin? 
I'd prefer the same URL ( e.g. just passing string using 
window.postMessage) . What if I move image element from one document to 
another (from top window to iframe) should it have no identifiable 
underlying data? I don't like that
>
> -Boris
>

Brona
Received on Monday, 30 January 2012 16:45:11 GMT

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