Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -1,6 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>csp font-src: blacklisted</title>
<link href="fonts.css" rel="stylesheet" type="text/css">
         
<p>The test passes if the line above are boxes in the test and glyphs in the reference.</p>

View file

@ -1,9 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'none'">
<title>csp font-src: blacklisted</title>
<link rel="mismatch" href="font-blacklisted-ref.html">
<link rel="help" href="https://www.w3.org/TR/CSP2/#directive-font-src">
<link href="fonts.css" rel="stylesheet" type="text/css">
         
<p>The test passes if the line above are boxes in the test and glyphs in the reference.</p>

View file

@ -0,0 +1,23 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src {{domains[www1]}}:{{ports[http][0]}}">
<head>
<title>Test font loads if it matches font-src.</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id="log"/>
<script>
async_test(function(t) {
document.addEventListener("securitypolicyviolation", t.unreached_func("Loading allowed fonts should not trigger a violation."));
var link = document.createElement('link');
link.rel="preload";
link.as="font";
link.href="http://{{domains[www1]}}:{{ports[http][0]}}/content-security-policy/support/Ahem.ttf";
link.onload = t.step_func_done();
link.onerror = t.unreached_func("Should have loaded the font.");
document.getElementsByTagName('head')[0].appendChild(link);
}, "Test font loads if it matches font-src.");
</script>
</body>

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src {{domains[www1]}}:{{ports[http][0]}}">
<head>
<title>Test font does not load if it does not match font-src.</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id="log"/>
<script>
async_test(function(t) {
var link = document.createElement('link');
link.rel="preload";
link.as="font";
link.href="http://{{domains[www2]}}:{{ports[http][0]}}/content-security-policy/support/Ahem.ttf";
link.onload = t.unreached_func("Should not have loaded the font.");
link.onerror = t.step_func_done();
document.getElementsByTagName('head')[0].appendChild(link);
}, "Test font does not load if it does not match font-src.");
</script>
</body>

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'none'">
<head>
<title>Test font does not load if it does not match font-src.</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id="log"/>
<script>
async_test(function(t) {
var link = document.createElement('link');
link.rel="preload";
link.as="font";
link.href="http://{{domains[www]}}:{{ports[http][0]}}/content-security-policy/support/Ahem.ttf";
link.onload = t.unreached_func("Should not have loaded the font.");
link.onerror = t.step_func_done();
document.getElementsByTagName('head')[0].appendChild(link);
}, "Test font does not load if it does not match font-src.");
</script>
</body>

View file

@ -0,0 +1,23 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'self'">
<head>
<title>Test font loads if it matches font-src.</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id="log"/>
<script>
async_test(function(t) {
document.addEventListener("securitypolicyviolation", t.unreached_func("Loading allowed fonts should not trigger a violation."));
var link = document.createElement('link');
link.rel="preload";
link.as="font";
link.href="/content-security-policy/support/Ahem.ttf";
link.onload = t.step_func_done();
link.onerror = t.unreached_func("Should have loaded the font.");
document.getElementsByTagName('head')[0].appendChild(link);
}, "Test font loads if it matches font-src.");
</script>
</body>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'none'">
<head>
<title>Test font does not load if it does not match font-src.</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id="log"/>
<script>
async_test(function(t) {
var link = document.createElement('link');
link.rel="stylesheet";
link.type="text/css";
link.href="/content-security-policy/support/fonts.css";
// The stylesheet should stil load, even though the font contained does not
link.onerror = t.unreached_func("Should have loaded the stylesheet.");
document.addEventListener("securitypolicyviolation", t.step_func_done(function(e) {
assert_equals(e.violatedDirective, "font-src");
}));
document.getElementsByTagName('head')[0].appendChild(link);
}, "Test font does not load if it does not match font-src.");
</script>
</body>

View file

@ -1,6 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>csp font-src: whitelisted</title>
<link href="fonts.css" rel="stylesheet" type="text/css">
         
<p>The test passes if the line above shows the same glyphs in the reference.</p>

View file

@ -1,9 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<meta http-equiv="Content-Security-Policy" content="font-src 'self'">
<title>csp font-src: whitelisted</title>
<link rel="match" href="font-whitelisted-ref.html">
<link rel="help" href="https://www.w3.org/TR/CSP2/#directive-font-src">
<link href="fonts.css" rel="stylesheet" type="text/css">
         
<p>The test passes if the line above shows the same glyphs in the reference.</p>

View file

@ -1,8 +0,0 @@
@font-face {
font-family: 'Halflings';
src: url('/tools/runner/fonts/glyphicons-halflings-regular.woff') format('woff');
}
body {
font-family: 'Halflings', Fallback, sans-serif;
}