blob: e980971046722da6c666fe8ed3fca568c050d354 [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Make sure embedded SVG is turned off in dashboard</title>
</head>
<script>
function debug(str) {
var c = document.getElementById('console')
c.appendChild(document.createTextNode(str + '\n'));
}
if (window.layoutTestController) {
layoutTestController.setUseDashboardCompatibilityMode(true);
layoutTestController.dumpAsText();
}
</script>
<body>
<p>This test makes sure we can't add manually parsed SVG to the document when in dashboard compatibility mode. It can not be tested manually.</p>
<div id="targetDiv"></div>
<pre id="console"></pre>
<script>
var documentString = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">' +
'<circle cx="50" cy="50" r="50" fill="red"/></svg>';
// Use DOMParser interface to create a SVGDocument datastructure from SVG content string
var parser = new DOMParser();
var svgDocument = parser.parseFromString(documentString, "image/svg+xml");
debug("Parsing of the document isn't prevented and produces a " + svgDocument);
// Import SVG element into tree.
var importedNode = null;
try {
importedNode = document.importNode(svgDocument.firstChild, true);
} catch(e) {
}
if (importedNode) {
debug("FAIL: Managed to insert SVG element into tree");
document.getElementById('targetDiv').appendChild(importedNode);
} else {
debug("PASS: Could not insert SVG element into tree");
}
</script>
</body>
</html>