Bug 43561 - getSVGDocument doesn't work with an object containing a text/xml document
Summary: getSVGDocument doesn't work with an object containing a text/xml document
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL: http://www.linuxrising.org/wedding/in...
Depends on:
Reported: 2010-08-05 07:41 PDT by Christian Schaller
Modified: 2010-08-06 06:21 PDT (History)
5 users (show)

See Also:

test case (2.75 KB, patch)
2010-08-05 14:03 PDT, Gustavo Noronha (kov)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schaller 2010-08-05 07:41:25 PDT
I made a page for my wedding with a countdown graphic done in SVG and Javascript. It works fine in Opera and Firefox, but in 
Chrome and Epiphany nothing happens. Page with graphic is here:

The ?? in the 'Days left' graphic should get replaced by a number, but instead nothing happens.
Comment 1 Gustavo Noronha (kov) 2010-08-05 07:46:45 PDT
I did a small investigation on this with the web inspector. The SVG renders fine, but the getSVGDocument() call returns undefined. It doesn't seem to be a problem in the SVG file, since downloading the file, and adding it to an <object> tag in a simple test html file has that call working, from the inspector. I was unable to reduce it up to now.
Comment 2 Gustavo Noronha (kov) 2010-08-05 07:58:11 PDT
The problem seems to only happen if the server gives text/xml as the Content-Type in its response (as the server in question does). If the server says the file is image/svg+xml, then it works.

We need to either sniff the svg from the content (I'm afraid this needs an update to the content sniffing standard), or use the explicitely given type attribute in the object tag here.
Comment 3 Christian Schaller 2010-08-05 08:20:22 PDT
I updated the web server to give the proper document type for SVG and now it works.
Comment 4 Gustavo Noronha (kov) 2010-08-05 14:03:26 PDT
Created attachment 63632 [details]
test case

Here's a layout test for this issue, with a passing expected result. You can test it works with image/svg+xml by changing svg-as-xml.php to send that as the Content-Type. Now we just need to figure out how to fix it ;)
Comment 5 Alexey Proskuryakov 2010-08-06 06:21:12 PDT
I'm not sure if forcing a different MIME in loader is the right fix. Although getSVGDocument isn't defined in HTML5, it seems like it should work regardless of MIME type, and possibly even for text/html documents.