<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src 'none'; style-src 'none'; script-src 'unsafe-inline'">
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}
</script>
</head>
<body>
<p>Tests that an inline stylesheet, in a user agent shadow tree, is allowed to load a SVG filter image when the page has CSP policy: <code>img-src 'none'</code>.</p>
<div id="shadow-host"></div>
<pre id="console"></pre>
<script>
function log(message)
{
    document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}

function runTest()
{
    if (!window.testRunner || !window.internals)
        return;

    var userAgentShadowRoot = internals.ensureUserAgentShadowRoot(document.getElementById("shadow-host"));

    var image = new Image;
    userAgentShadowRoot.appendChild(image);

    image.onload = function () {
        log("PASS SVG filter image did load.");
        testRunner.notifyDone();
    }
    image.onerror = function () {
        log("FAIL SVG filter image did not load.");
        testRunner.notifyDone();
    }

    image.style.webkitFilter = "url(resources/floodGreenFilter.svg#filter)";
    image.src = "../../resources/abe.png";
}

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