<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src 'none'; script-src 'unsafe-inline'">
<script>
if (window.testRunner)
    testRunner.dumpAsText();
</script>
</head>
<body>
<p>Tests that a SVG Use element, in a user agent shadow tree, is allowed to load an external SVG document when the page has CSP policy: <code>img-src 'none'</code>. This test PASSED if there are no console warning messages.</p>
<div id="shadow-host"></div>
<script>
function runTest()
{
    if (!window.testRunner || !window.internals)
        return;

    var userAgentShadowRoot = internals.ensureUserAgentShadowRoot(document.getElementById("shadow-host"));
    var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    userAgentShadowRoot.appendChild(svgElement);
    var useElement = document.createElementNS("http://www.w3.org/2000/svg", "use");
    svgElement.appendChild(useElement);

    useElement.setAttributeNS("http://www.w3.org/1999/xlink", "href", "resources/allow-svg-use-element.svg#blue-square");
}

runTest();
</script>
</body>
</html>
