Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / svg-created-by-xhr-allowed-in-dashboard.html
blobf046a4308d5bb07b07e74de671c62373bf495fab
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test to ensure SVG is enabled in Dashboard compatibility mode</title>
5 <script>
6 var rq;
8 function loadSVG()
10 url = 'resources/svgtest.svg';
12 rq = false;
14 try {
15 if (window.XMLHttpRequest) {
16 rq = new XMLHttpRequest();
17 rq.overrideMimeType('text/svg+xml');
18 rq.onreadystatechange = processReqChange;
19 rq.open('GET', url, true);
20 rq.send();
22 } catch (ex) {
23 rq = false;
24 alert(ex);
28 function debug(str) {
29 var c = document.getElementById('console')
30 c.appendChild(document.createTextNode(str + '\n'));
33 function processReqChange()
35 if (rq.readyState == 4) {
36 try {
37 var svgDoc = rq.responseXML;
38 if (rq.status == 200) {
39 debug("Received doc of type: " + svgDoc);
40 // Import SVG element into tree.
41 var importedNode = null;
42 try {
43 importedNode = document.importNode(svgDoc.getElementById('svgCircle'), true);
44 } catch(e) {
47 if (importedNode) {
48 debug("PASS: Managed to insert SVG element into tree");
49 debug("Imported node of type: " + importedNode);
50 document.getElementById('targetDiv').appendChild(importedNode);
51 } else {
52 debug("FAIL: Could not insert SVG element into tree");
54 } else {
55 debug('FAIL: Unable to load SVG document: ' + rq.statusText);
57 } catch (e) {
59 if (window.testRunner)
60 testRunner.notifyDone();
63 </script>
64 </head>
66 <body onload="loadSVG()">
67 <p>Test to make sure we can use XHR to create usable SVG in dashboard compatibility mode. This cannot be tested manually.</p>
68 <div id="targetDiv"></div>
69 <pre id="console"></pre>
70 <script>
71 if (window.testRunner) {
72 testRunner.setUseDashboardCompatibilityMode(true);
73 testRunner.dumpAsText();
74 testRunner.waitUntilDone();
76 </script>
77 </body>
78 </html>