SVGs containing PNGs in data URIs sometimes don't display
Reported by
l...@boxclever.ca,
Jun 14 2016
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36 Example URL: http://liamhennessy.com/files/svg-png.html Steps to reproduce the problem: 1. Open http://liamhennessy.com/files/svg-png.html 2. Image A displays as normal. This is an external SVG file which contains a PNG in a data URI. The mime type in the URI is "image/png" 3. Image B does NOT display. This is the same as the previous image except that the mime type in the data URI is "img/png" 4. Image C is the same as image B, except that the <svg> is contained inline in the HTML file. This is does NOT display because it is commented out. 5. Use the dev tools to uncomment image C. It displays, and B also displays at this point. What is the expected behavior? The mime type "img/png" is either allowed consistently or not. When image C is displayed, it should not influence image B. What went wrong? When image C is displayed, image B is also displayed. Therefore it is not clear if image B was a valid file or not. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 51.0.2704.84 Channel: stable OS Version: OS X 10.10.5 Flash Version: Shockwave Flash 21.0 r0 See screencast here http://liamhennessy.com/files/SVG-PNG-bug.mov
,
Jun 15 2016
That's... interesting.
,
Jun 15 2016
,
Aug 17 2016
,
Aug 17 2016
So what happens here is that we have one callsite (ResourceFetcher::resourceForStaticData) that calls Platform::parseDataURL - which rejects/fails data URLs with an "unknown" MIME-type. Because of the isolation of SVGs embedded as images the load will be deferred, so no "regular" load will be attempted. When loading the same thing outside of "<img> context" (like for the 'C' case in the test) Platform::parseDataURL will fail for the same reason - however a "regular" load will be initiated and succeed... because loading unrecognized MIME-type data is apparently not a problem if done asynchronously. Putting this on the Loading Team table.
,
Aug 20 2016
What's the desired behavior here? Should we be accepting the invalid mime types or rejecting them? +Yoav, who is working on making data uris load asynchronously. No clue if that would affect logic here though.
,
Aug 20 2016
> Should we be accepting the invalid mime types or rejecting them? Yes =P. More seriously though, Gecko appears to "accept" it. (Could be worth checking other browsers too.) On the ImageResource/ImageDecoder-side we essentially ignore the MIME type (w/ exception for image/svg+xml) and always look at the image signature anyway. > ...making data uris load asynchronously. ... if that would affect logic here though. Well, data URLs w/ unrecognized MIME-types apparently always load async already =). For the "<img> context" we can't load data URLs async (which is part of the reason this fails), because of a number of assumptions higher in the stack about when an image is complete. That being said though, I don't think that would affect the logic here. (I.e if all data URL loads are async, this bug would be fixed.) Maybe that'd mean we wouldn't need to parse the data URL three times before delivering the data though =).
,
Aug 29 2016
(triager notes) Waiting for feedback from yoav@
,
Aug 29 2016
Seems like Safari is also displaying B, so seems like we should display it for compat reasons. I'll take a look if the async data URI change makes any difference here and report back.
,
Aug 30 2016
It doesn't seem like async data URI loading is solving this issue. B still doesn't display with the patch applied.
,
Oct 27 2016
,
Apr 12 2017
triager assigning this to yoav@
,
Nov 16 2017
Issue 786031 has been merged into this issue.
,
Nov 16 2017
,
Nov 16 2017
Hey, coming in from Issue 786031 here: FWIW, it seems like some older versions of Illustrator and Photoshop would export SVG files with the bad mime type. I spoke with the designer who provided a bad SVG file to me (which caused me to open the issue in the first place), and after re-exporting the file with the latest version of AI, that it correctly had the "image/png" instead of "img/png" mime type. The designer's previous exports (generated about 2 months ago) had the faulty mime type, which might explain why its cropping up all the sudden.
,
Nov 16 2017
Sorry about the broken links in the issue description, the hosting provider went out of business 😧 Well at least the attachments are there.
,
Dec 25 2017
Issue 797551 has been merged into this issue.
,
Feb 11 2018
Issue 811097 has been merged into this issue.
,
Feb 20 2018
Issue 813732 has been merged into this issue. |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by haraken@chromium.org
, Jun 15 2016