Re: [FileAPI] createObjectURL isReusable proposal

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 UTC