Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-values/urls/cross-origin/url-font-cross-origin-anonymous-negative.sub.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Request URL Modifiers: cross-origin(anonymous) negative test for @font-face</title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#typedef-request-url-modifier-cross-origin-modifier">
<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?pipe=header(Access-Control-Allow-Origin,)" cross-origin(anonymous)) 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, "Cross-origin font without CORS headers should not load with cross-origin(anonymous)");
}, "cross-origin(anonymous) blocks cross-origin font loading without CORS headers");
</script>