blob: a4dcd6fae79287c98962210cd100caee9ec36702 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Style element has error on bad style nonce</title>
<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline'">
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<script>
function styleError() {
var color = window.getComputedStyle(document.querySelector('p')).color;
assert_equals(color, "rgb(0, 128, 0)", "The color of the paragraph is green.");
done();
}
function styleLoad() {
assert_unreached("Style sheet should not load.");
}
</script>
<style>p { color: green; }</style>
</head>
<p>A test paragraph</p>
<link rel="stylesheet" onload="styleLoad();" onerror="styleError();" href="http://localhost:8000/security/contentSecurityPolicy/resources/style-set-red.css"></link>
</html>