Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>Request URL Modifiers: integrity() negative test for @font-face</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@font-face {
font-family: "TestFont";
src: url("http://{{hosts[][]}}:{{ports[http][1]}}/fonts/Ahem.ttf" cross-origin(anonymous) integrity("sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")) format("truetype");
}
.test { font-family: "TestFont" }
</style>
<div class="test">X</div>
<script>
promise_test(async t => {
await document.fonts.ready;
const loaded = document.fonts.check("16px TestFont");
assert_false(loaded, "Font with non-matching integrity should not load");
}, "integrity() with wrong hash blocks font loading");
</script>