mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision d3cf77a7b8c20c678b725238eaa8a72eca3787ae
This commit is contained in:
parent
880f3b8b7a
commit
efca990ffe
541 changed files with 8000 additions and 2276 deletions
|
@ -8,12 +8,10 @@
|
|||
// These tests reuse the `referrer-policy` infrastructure to load images that
|
||||
// encode their request headers in their pixels. Fun stuff!
|
||||
promise_test(() =>
|
||||
loadImageInWindow(
|
||||
"https://{{host}}:{{ports[https][0]}}/common/security-features/subresource/image.py",
|
||||
[],
|
||||
window)
|
||||
.then(img => {
|
||||
headers = decodeImageData(extractImageData(img)).headers;
|
||||
requestViaImage(
|
||||
"https://{{host}}:{{ports[https][0]}}/common/security-features/subresource/image.py")
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
|
@ -32,12 +30,10 @@
|
|||
"Same-origin image");
|
||||
|
||||
promise_test(() =>
|
||||
loadImageInWindow(
|
||||
"https://{{hosts[][www]}}:{{ports[https][0]}}/common/security-features/subresource/image.py",
|
||||
[],
|
||||
window)
|
||||
.then(img => {
|
||||
headers = decodeImageData(extractImageData(img)).headers;
|
||||
requestViaImage(
|
||||
"https://{{hosts[][www]}}:{{ports[https][0]}}/common/security-features/subresource/image.py")
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
|
@ -56,12 +52,10 @@
|
|||
"Same-site image");
|
||||
|
||||
promise_test(() =>
|
||||
loadImageInWindow(
|
||||
"https://{{hosts[alt][www]}}:{{ports[https][0]}}/common/security-features/subresource/image.py",
|
||||
[],
|
||||
window)
|
||||
.then(img => {
|
||||
headers = decodeImageData(extractImageData(img)).headers;
|
||||
requestViaImage(
|
||||
"https://{{hosts[alt][www]}}:{{ports[https][0]}}/common/security-features/subresource/image.py")
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
|
|
|
@ -16,18 +16,24 @@ https://github.com/whatwg/fetch/pull/853
|
|||
<script>
|
||||
|
||||
// Duplicating this resource to make service worker scoping simpler.
|
||||
async function setupRegistration(t, scope) {
|
||||
async function setupRegistrationAndWaitToBeControlled(t, scope) {
|
||||
const controlled = new Promise((resolve) => {
|
||||
navigator.serviceWorker.oncontrollerchange = () => { resolve(); };
|
||||
});
|
||||
const reg = await navigator.serviceWorker.register('sw-intercept.js');
|
||||
await wait_for_state(t, reg.installing, 'activated');
|
||||
await controlled;
|
||||
add_completion_callback(_ => reg.unregister());
|
||||
return reg;
|
||||
}
|
||||
|
||||
function wait25ms(test) {
|
||||
// Using 250ms polling interval to provide enough 'network calmness' to give
|
||||
// the background low priority revalidation request a chance to kick in.
|
||||
function wait250ms(test) {
|
||||
return new Promise(resolve => {
|
||||
test.step_timeout(() => {
|
||||
resolve();
|
||||
}, 25);
|
||||
}, 250);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -35,7 +41,7 @@ https://github.com/whatwg/fetch/pull/853
|
|||
var request_token = token();
|
||||
const uri = 'stale-script.py?token=' + request_token;
|
||||
|
||||
await setupRegistration(test, 'stale-script.py');
|
||||
await setupRegistrationAndWaitToBeControlled(test, 'stale-script.py');
|
||||
|
||||
var service_worker_count = 0;
|
||||
navigator.serviceWorker.addEventListener('message', function once(event) {
|
||||
|
@ -54,7 +60,7 @@ https://github.com/whatwg/fetch/pull/853
|
|||
assert_equals(service_worker_count, 2);
|
||||
break;
|
||||
}
|
||||
await wait25ms(test);
|
||||
await wait250ms(test);
|
||||
}
|
||||
}, 'Second fetch returns same response');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue