mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision 9fc797e6e5fb7d244dfb5b5125886c01f8cedf2b
This commit is contained in:
parent
b7e9bab267
commit
6dda93c6e2
55 changed files with 646 additions and 128 deletions
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test for font-display-late-swap feature policy</title>
|
||||
<title>Test for font-display-late-swap feature policy behavior when set to reporting</title>
|
||||
<style>
|
||||
.ahem {
|
||||
font-family: 'Ahem';
|
|
@ -1,8 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Test for font-display-late-swap feature policy</title>
|
||||
<title>Test for font-display-late-swap feature policy behavior when set to reporting</title>
|
||||
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
|
||||
<link rel="match" href="font-display-feature-policy.tentative-ref.html">
|
||||
<link rel="match" href="font-display-feature-policy-01.tentative-ref.html">
|
||||
<style>
|
||||
</style>
|
||||
<p>Tests if font-display is set to optional for each option except for when it is set to fallback</p>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test for font-display-late-swap feature policy behavior when set to report-only</title>
|
||||
<style>
|
||||
.ahem {
|
||||
font-family: 'Ahem';
|
||||
}
|
||||
.arial {
|
||||
font-family: 'Arial';
|
||||
}
|
||||
</style>
|
||||
<p>None of the font-display values should be changed</p>
|
||||
<table id="container">
|
||||
<tr>
|
||||
<th>not-set</th>
|
||||
<th>auto</th>
|
||||
<th>block</th>
|
||||
<th>swap</th>
|
||||
<th>fallback</th>
|
||||
<th>optional</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ahem">a</td>
|
||||
<td class="ahem">a</td>
|
||||
<td class="ahem">a</td>
|
||||
<td class="ahem">a</td>
|
||||
<td class="ahem">a</td>
|
||||
<td class="arial">a</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Test for font-display-late-swap feature policy behavior when set to report-only</title>
|
||||
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
|
||||
<link rel="match" href="font-display-feature-policy-02.tentative-ref.html">
|
||||
<style>
|
||||
</style>
|
||||
<p>None of the font-display values should be changed</p>
|
||||
<table id="container">
|
||||
<tr>
|
||||
<th>not-set</th>
|
||||
<th>auto</th>
|
||||
<th>block</th>
|
||||
<th>swap</th>
|
||||
<th>fallback</th>
|
||||
<th>optional</th>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
|
||||
const table = document.getElementById('container');
|
||||
|
||||
function makeFontFaceDeclaration(family, display) {
|
||||
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
|
||||
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
let tr = document.createElement('tr');
|
||||
for (let display of fontDisplayValues) {
|
||||
const family = display + '-face';
|
||||
const rule = makeFontFaceDeclaration(family, display);
|
||||
document.styleSheets[0].insertRule(rule, 0);
|
||||
let td = document.createElement('td');
|
||||
td.textContent = 'a';
|
||||
td.style.fontFamily = family + ', Arial';
|
||||
tr.appendChild(td);
|
||||
}
|
||||
table.appendChild(tr);
|
||||
const timeoutMilliSec = 1500; // After the font is loaded
|
||||
setTimeout(() => {
|
||||
document.documentElement.classList.remove("reftest-wait");
|
||||
}, timeoutMilliSec);
|
||||
}
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Feature-Policy-Report-Only: font-display-late-swap 'none';
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for font-display-late-swap feature policy set to report-only</title>
|
||||
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#reporting">
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Tests if the correct number of violation reports are generated and each report corresponds to this feature.
|
||||
4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional').
|
||||
</p>
|
||||
<table id="container">
|
||||
<tr>
|
||||
<th>not-set</th>
|
||||
<th>auto</th>
|
||||
<th>block</th>
|
||||
<th>swap</th>
|
||||
<th>fallback</th>
|
||||
<th>optional</th>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
|
||||
const table = document.getElementById('container');
|
||||
|
||||
function makeFontFaceDeclaration(family, display) {
|
||||
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
|
||||
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
let tr = document.createElement('tr');
|
||||
for (let display of fontDisplayValues) {
|
||||
const family = display + '-face';
|
||||
const rule = makeFontFaceDeclaration(family, display);
|
||||
document.styleSheets[0].insertRule(rule, 0);
|
||||
let td = document.createElement('td');
|
||||
td.textContent = 'a';
|
||||
td.style.fontFamily = family + ', Arial';
|
||||
tr.appendChild(td);
|
||||
}
|
||||
table.appendChild(tr);
|
||||
}
|
||||
|
||||
let reportCounter = 4;
|
||||
let t = async_test('font-display-late-swap Report Format');
|
||||
|
||||
let check_report_format = (reports, observer) => {
|
||||
reportCounter -= reports.length;
|
||||
for (let report of reports) {
|
||||
assert_equals(report.type, 'feature-policy-violation');
|
||||
assert_equals(report.url, document.location.href, 'Report URL');
|
||||
assert_equals(report.body.featureId, 'font-display-late-swap');
|
||||
assert_equals(report.body.disposition, 'report');
|
||||
assert_true('sourceFile' in report.body);
|
||||
assert_true('lineNumber' in report.body);
|
||||
assert_true('columnNumber' in report.body);
|
||||
}
|
||||
// Test is done when we have exactly 4 reports for the following
|
||||
// font-display values: not set, 'auto', 'block', 'swap'
|
||||
if (reportCounter == 0) t.done();
|
||||
};
|
||||
|
||||
new ReportingObserver(t.step_func(check_report_format),
|
||||
{types: ['feature-policy-violation'], buffered: true}).observe();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Feature-Policy-Report-Only: font-display-late-swap 'none';
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for font-display-late-swap feature policy set to reporting</title>
|
||||
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#reporting">
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Tests if the correct number of violation reports are generated and each report corresponds to this feature.
|
||||
4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional').
|
||||
</p>
|
||||
<table id="container">
|
||||
<tr>
|
||||
<th>not-set</th>
|
||||
<th>auto</th>
|
||||
<th>block</th>
|
||||
<th>swap</th>
|
||||
<th>fallback</th>
|
||||
<th>optional</th>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
|
||||
const table = document.getElementById('container');
|
||||
|
||||
function makeFontFaceDeclaration(family, display) {
|
||||
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
|
||||
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
let tr = document.createElement('tr');
|
||||
for (let display of fontDisplayValues) {
|
||||
const family = display + '-face';
|
||||
const rule = makeFontFaceDeclaration(family, display);
|
||||
document.styleSheets[0].insertRule(rule, 0);
|
||||
let td = document.createElement('td');
|
||||
td.textContent = 'a';
|
||||
td.style.fontFamily = family + ', Arial';
|
||||
tr.appendChild(td);
|
||||
}
|
||||
table.appendChild(tr);
|
||||
}
|
||||
|
||||
let reportCounter = 4;
|
||||
let t = async_test('font-display-late-swap Report Format');
|
||||
|
||||
let check_report_format = (reports, observer) => {
|
||||
reportCounter -= reports.length;
|
||||
for (let report of reports) {
|
||||
assert_equals(report.type, 'feature-policy-violation');
|
||||
assert_equals(report.url, document.location.href, 'Report URL');
|
||||
assert_equals(report.body.featureId, 'font-display-late-swap');
|
||||
assert_equals(report.body.disposition, 'enforce');
|
||||
assert_true('sourceFile' in report.body);
|
||||
assert_true('lineNumber' in report.body);
|
||||
assert_true('columnNumber' in report.body);
|
||||
}
|
||||
// Test is done when we have exactly 4 reports for the following
|
||||
// font-display values: not set, 'auto', 'block', 'swap'
|
||||
if (reportCounter == 0) t.done();
|
||||
};
|
||||
|
||||
new ReportingObserver(t.step_func(check_report_format),
|
||||
{types: ['feature-policy-violation'], buffered: true}).observe();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Feature-Policy: font-display-late-swap 'none';
|
Loading…
Add table
Add a link
Reference in a new issue