W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: [FileAPI] createObjectURL isReusable proposal

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 15 Dec 2011 00:40:45 +0000 (UTC)
To: Adrian Bateman <adrianba@microsoft.com>
cc: "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>, Feras Moussa <ferasm@microsoft.com>
Message-ID: <Pine.LNX.4.64.1112150037120.26122@ps20323.dreamhostps.com>
On Wed, 14 Dec 2011, Adrian Bateman wrote:
>
> [...] the first dereference of the URL revokes it.
> 
> This means that you can do something like:
> 
> imgElement.src = URL.createObjectURL(blob,false)
> 
> and not worry about having to call URL.revokeObjectURL to release the 
> Blob.

I think it's dangerous to assume that the URL will only be dereferenced 
once. For example, it would mean that the above image would break if the 
user toggled images off and back on in a browser that discarded image data 
when the user toggles images off. It would mean that you couldn't clone 
the element and get the image data in the clone. It would mean that you 
couldn't read the image's .src URL and have anything useful.

I think the better solution is to have implementations make keeping object 
URLs defined be very cheap, so that nobody needs to ever release them.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 15 December 2011 00:43:29 GMT

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