24 lines
869 B
HTML
24 lines
869 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Security-Policy" content="img-src 'none';">
|
|
<script src='/resources/testharness.js'></script>
|
|
<script src='/resources/testharnessreport.js'></script>
|
|
</head>
|
|
<body>
|
|
<p>Check that img-src sets correct target</p>
|
|
<script>
|
|
var t = async_test("Test that image does not load");
|
|
var t_spv = async_test("Test that spv event is fired");
|
|
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
|
|
assert_equals(e.violatedDirective, 'img-src');
|
|
assert_equals(e.target, document);
|
|
assert_true(e.blockedURI.endsWith('/support/fail.png'));
|
|
}));
|
|
</script>
|
|
<img src='/content-security-policy/support/fail.png'
|
|
onload='t.step(function() { assert_unreached("Image should not have loaded"); t.done(); });'
|
|
onerror='t.done();'>
|
|
</body>
|
|
|
|
</html>
|