whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.17k stars 2.69k forks source link

Active document check in "update the image data" doesn't entirely make sense #3211

Open bzbarsky opened 7 years ago

bzbarsky commented 7 years ago

Consider something like this:

<img src="foo.svg">

where foo.svg has an <html:img src="data:...."> inside. Per https://html.spec.whatwg.org/multipage/images.html#update-the-image-data step 1, this should never load, because there is no browsing context involved in that SVG, so the node document of the html:img is not "the active document", etc. But I would think UAs actually do that image load.

// cc @annevk @domenic

bzbarsky commented 7 years ago

For what it's worth, in Gecko the corresponding check on the document is:

bool ShouldLoadImages() const
{
  // We check IsBeingUsedAsImage() so that SVG documents loaded as
  // images can themselves have data: URL image references.
  return IsCurrentActiveDocument() || IsBeingUsedAsImage();
}
annevk commented 7 years ago

Is there a processing model yet for SVG as image? I think this is why Fetch has https://fetch.spec.whatwg.org/#local-urls-only-flag in part, but I'm pretty sure I added that speculatively and "IsBeingUsedAsImage()" has no standards equivalent.

bzbarsky commented 7 years ago

Is there a processing model yet for SVG as image?

I don't know. Maybe @dholbert does?

dholbert commented 7 years ago

The processing model that we use for SVG-as-an-image is specced here, under heading "Secure animated mode": https://svgwg.org/specs/integration/#secure-animated-mode

annevk commented 7 years ago

Thanks, I filed https://github.com/w3c/svgwg/issues/358 since I cannot really use as a primitive.