Re: File API: auto-revoking blob URLs

On Tue, Apr 16, 2013 at 2:48 AM, Glenn Maynard <glenn@zewt.org> wrote:
> The solution I propose is the same as it's always been.  Have a synchronous
> algorithm, eg. "parse and capture the URL", which is invoked at the time
> (eg.) .src is set.  This 1: invokes the URL spec's parser; 2: if the result
> is a blob URL, grabs the associated blob data and puts a reference to it in
> the resulting parsed URL; then 3: returns the result.  Assigning .src would
> then synchronously invoke this, so the blob is always captured immediately,
> even if the fetch isn't.  This way, we can synchronously resolve all this
> stuff, even if the fetch won't happen for a while.

As Ian pointed out (see WHATWG IRC reference above) you don't always
want to parse synchronously as the base URL might change at a later
stage. This also does not work for CSS where when parsing happens is
even less defined (which might benefit projects such as Servo).


> This would also fix https://www.w3.org/Bugs/Public/show_bug.cgi?id=21058,
> because URLs would be resolved against <base href> synchronously.

That would make <img> behave differently from e.g. <a download>.
Pretty sure <a> needs to resolve at the point it is actually clicked.


--
http://annevankesteren.nl/

Received on Tuesday, 16 April 2013 09:58:15 UTC