blob: f046a4308d5bb07b07e74de671c62373bf495fab [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>Test to ensure SVG is enabled in Dashboard compatibility mode</title>
<script>
var rq;
function loadSVG()
{
url = 'resources/svgtest.svg';
rq = false;
try {
if (window.XMLHttpRequest) {
rq = new XMLHttpRequest();
rq.overrideMimeType('text/svg+xml');
rq.onreadystatechange = processReqChange;
rq.open('GET', url, true);
rq.send();
}
} catch (ex) {
rq = false;
alert(ex);
}
}
function debug(str) {
var c = document.getElementById('console')
c.appendChild(document.createTextNode(str + '\n'));
}
function processReqChange()
{
if (rq.readyState == 4) {
try {
var svgDoc = rq.responseXML;
if (rq.status == 200) {
debug("Received doc of type: " + svgDoc);
// Import SVG element into tree.
var importedNode = null;
try {
importedNode = document.importNode(svgDoc.getElementById('svgCircle'), true);
} catch(e) {
}
if (importedNode) {
debug("PASS: Managed to insert SVG element into tree");
debug("Imported node of type: " + importedNode);
document.getElementById('targetDiv').appendChild(importedNode);
} else {
debug("FAIL: Could not insert SVG element into tree");
}
} else {
debug('FAIL: Unable to load SVG document: ' + rq.statusText);
}
} catch (e) {
}
if (window.testRunner)
testRunner.notifyDone();
}
}
</script>
</head>
<body onload="loadSVG()">
<p>Test to make sure we can use XHR to create usable SVG in dashboard compatibility mode. This cannot be tested manually.</p>
<div id="targetDiv"></div>
<pre id="console"></pre>
<script>
if (window.testRunner) {
testRunner.setUseDashboardCompatibilityMode(true);
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</body>
</html>