Update web-platform-tests to revision b'7af9d6ec48ab04043a2bea85a3599904a1a19efa'

This commit is contained in:
WPT Sync Bot 2021-02-21 08:20:50 +00:00 committed by Josh Matthews
parent 8050c95e31
commit 87be1008de
2742 changed files with 142451 additions and 40667 deletions

View file

@ -7,8 +7,15 @@
<script src="/common/get-host-info.sub.js"></script>
<body>
<script>
const {
HTTP_NOTSAMESITE_ORIGIN,
HTTP_REMOTE_ORIGIN,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT
} = get_host_info();
function getUrl(origin1, origin2, withHeaders) {
const frameOrigin = host_info.HTTP_NOTSAMESITE_ORIGIN;
const frameOrigin = HTTP_NOTSAMESITE_ORIGIN;
return `${frameOrigin}/fetch/api/resources/keepalive-iframe.html?` +
`origin1=${origin1}&` +
`origin2=${origin2}&` +
@ -35,7 +42,7 @@ async function queryToken(token) {
// an async_test.
function checkToken(testName, token) {
async_test((test) => {
new Promise((resolve) => test.step_timeout(resolve, 1000)).then(() => {
new Promise((resolve) => test.step_timeout(resolve, 3000)).then(() => {
return queryToken(token);
}).then((result) => {
assert_equals(result, 'on');
@ -47,7 +54,6 @@ function checkToken(testName, token) {
}, testName);
}
const host_info = get_host_info();
promise_test(async (test) => {
const iframe = document.createElement('iframe');
iframe.src = getUrl('', '', false);
@ -62,8 +68,8 @@ promise_test(async (test) => {
promise_test(async (test) => {
const iframe = document.createElement('iframe');
iframe.src = getUrl(host_info.HTTP_REMOTE_ORIGIN,
host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, false);
iframe.src = getUrl(HTTP_REMOTE_ORIGIN,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, false);
document.body.appendChild(iframe);
const tokenPromise = getToken();
await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
@ -75,8 +81,8 @@ promise_test(async (test) => {
promise_test(async (test) => {
const iframe = document.createElement('iframe');
iframe.src = getUrl(host_info.HTTP_REMOTE_ORIGIN,
host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, true);
iframe.src = getUrl(HTTP_REMOTE_ORIGIN,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, true);
document.body.appendChild(iframe);
const tokenPromise = getToken();
await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
@ -86,6 +92,15 @@ promise_test(async (test) => {
checkToken('cross-origin redirect with preflight', token);
}, 'cross-origin redirect with preflight; setting up');
promise_test(async (test) => {
const w = window.open(
`${HTTP_NOTSAMESITE_ORIGIN}/fetch/api/resources/keepalive-window.html`);
const tokenPromise = getToken();
const token = await tokenPromise;
w.close();
checkToken('keepalive in onunload in nested frame in another window', token);
}, 'keepalive in onunload in nested frame in another window; setting up');
</script>
</body>
</html>

View file

@ -3,9 +3,11 @@
["accept", "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"],
["accept-language", "\u0001"],
["accept-language", "@"],
["authorization", "basics"],
["content-language", "\u0001"],
["content-language", "@"],
["content-type", "text/html"],
["content-type", "text/plain; long=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"],
["range", "bytes 0-"],
["test", "hi"]
]

View file

@ -1,11 +1,10 @@
// META: global=window,worker
// META: script=../resources/utils.js
function basicAuth(desc, user, pass, mode, status) {
promise_test(function(test) {
var headers = { "Authorization": "Basic " + btoa(user + ":" + pass)};
var requestInit = {"credentials": mode, "headers": headers};
return fetch(RESOURCES_DIR + "authentication.py?realm=test", requestInit).then(function(resp) {
return fetch("../resources/authentication.py?realm=test", requestInit).then(function(resp) {
assert_equals(resp.status, status, "HTTP status is " + status);
assert_equals(resp.type , "basic", "Response's type is basic");
});
@ -15,3 +14,4 @@ function basicAuth(desc, user, pass, mode, status) {
basicAuth("User-added Authorization header with include mode", "user", "password", "include", 200);
basicAuth("User-added Authorization header with same-origin mode", "user", "password", "same-origin", 200);
basicAuth("User-added Authorization header with omit mode", "user", "password", "omit", 200);
basicAuth("User-added bogus Authorization header with omit mode", "notuser", "notpassword", "omit", 401);

View file

@ -0,0 +1,34 @@
<!doctype html>
<html>
<meta charset="utf-8">
<script src="/common/utils.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script>
const TOKEN = token();
const {
HTTP_NOTSAMESITE_ORIGIN,
HTTP_REMOTE_ORIGIN,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT
} = get_host_info();
const REDIRECT_DESTINATION =
`${HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT}/fetch/api/resources/stash-put.py` +
`?key=${TOKEN}&value=on`;
const URL =
`${HTTP_REMOTE_ORIGIN}/fetch/api/resources/redirect.py?` +
`delay=500&` +
`allow_headers=foo&` +
`location=${encodeURIComponent(REDIRECT_DESTINATION)}`;
addEventListener('load', () => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.contentWindow.addEventListener('unload', () => {
iframe.contentWindow.fetch(URL, {keepalive: true, headers: {foo: 'bar'}});
});
window.opener.postMessage(TOKEN, '*');
// Do NOT remove `iframe` here. We want to check the case where the nested
// frame is implicitly closed by window closure.
});
</script>
</html>

View file

@ -1,12 +1,5 @@
var inWorker = false;
var RESOURCES_DIR = "../resources/";
try {
inWorker = !(self instanceof Window);
} catch (e) {
inWorker = true;
}
function dirname(path) {
return path.replace(/\/[^\/]*$/, '/')
}