New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 620054 link

Starred by 11 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug


Show other hotlists

Hotlists containing this issue:
Hotlist-1


Sign in to add a comment

SVGs containing PNGs in data URIs sometimes don't display

Reported by l...@boxclever.ca, Jun 14 2016

Issue description

UserAgent: 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
 
wiki-image-png.svg
27.0 KB Download
wiki-img-png.svg
27.0 KB Download
svg-png.html
27.6 KB View Download
Components: -Blink Blink>SVG

Comment 2 by f...@opera.com, Jun 15 2016

Labels: -OS-Mac OS-All
Status: Available (was: Unconfirmed)
That's... interesting.

Comment 3 by f...@opera.com, Jun 15 2016

Components: Blink>Image Blink>Loader

Comment 4 by f...@opera.com, Aug 17 2016

Cc: nyerramilli@chromium.org
 Issue 630877  has been merged into this issue.

Comment 5 by f...@opera.com, Aug 17 2016

Components: -Blink>SVG -Blink>Image
Status: Untriaged (was: Available)
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.
Cc: y...@yoav.ws
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.

Comment 7 by f...@opera.com, 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 =).
Labels: Needs-Feedback
(triager notes)
Waiting for feedback from yoav@

Comment 9 by y...@yoav.ws, 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.
 

Comment 10 by y...@yoav.ws, 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.

Comment 11 by f...@opera.com, Oct 27 2016

Cc: ajha@chromium.org
 Issue 450894  has been merged into this issue.
Owner: y...@yoav.ws
Status: Assigned (was: Untriaged)
triager assigning this to yoav@

Comment 13 by f...@opera.com, Nov 16 2017

 Issue 786031  has been merged into this issue.

Comment 14 by f...@opera.com, Nov 16 2017

Labels: Hotlist-Interop
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.

Comment 16 by l...@boxclever.ca, 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.

Comment 17 by f...@opera.com, Dec 25 2017

 Issue 797551  has been merged into this issue.

Comment 18 by f...@opera.com, Feb 11 2018

 Issue 811097  has been merged into this issue.

Comment 19 by f...@opera.com, Feb 20 2018

 Issue 813732  has been merged into this issue.

Sign in to add a comment