blob: 19da2641bd187d4f892a96d6c1db6e725d30e3d1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<script src="resources/sri-utilities.js"></script>
</head>
<body>
<div id="log"></div>
<div id="container"></div>
<script>
// SRI is enabled by default, no need to set the setting explicitly.
test(function() {
var linkElement = document.createElement("link");
assert_true("integrity" in linkElement, "integrity", "The 'integrity' property is exposed on the link element.");
}, "Test that Subresource Integrity's 'integrity' property is exposed on the <link> element.");
test(function() {
var scriptElement = document.createElement("script");
assert_true("integrity" in scriptElement, "The 'integrity' property is exposed on the script element.");
}, "Test that Subresource Integrity's 'integrity' property is exposed on the <script> element.");
new SRIScriptTest(
false,
"Same-origin with incorrect hash, should block evaluation.",
"resources/non-matching-digest.js",
"sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead"
);
new SRIStyleTest(
false,
"Same-origin with incorrect hash, should block evaluation.",
{
href: "resources/style.css",
integrity: "sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead"
}
);
SRITests.execute();
</script>
</body>
</html>