blob: badfbd9de3e142308243f0e957efc4c605075470 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src 'none'; script-src 'unsafe-inline'">
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</head>
<body>
<p>Tests that a HTML image element, in a user agent shadow tree, is allowed to load 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 image did load.");
testRunner.notifyDone();
}
image.onerror = function () {
log("FAIL image did not load.");
testRunner.notifyDone();
}
image.src = "../../resources/abe.png";
}
runTest();
</script>
</body>
</html>