mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision 14cfa4d648cc1c853b4153268df672d21425f8c1
This commit is contained in:
parent
1b73cf3352
commit
75736751d9
1213 changed files with 19434 additions and 12344 deletions
31
tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html
Normal file
31
tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>Fetch API: keepalive handling</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
const host_info = get_host_info();
|
||||
promise_test(async (test) => {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = host_info.HTTP_REMOTE_ORIGIN +
|
||||
'/fetch/api/resources/keepalive-iframe.html';
|
||||
document.body.appendChild(iframe);
|
||||
const uuid_promise = new Promise((resolve) => {
|
||||
window.addEventListener('message', (event) => {
|
||||
resolve(event.data);
|
||||
});
|
||||
});
|
||||
await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
|
||||
const uuid = await uuid_promise;
|
||||
iframe.remove();
|
||||
await (new Promise((resolve) => test.step_timeout(resolve, 1000)));
|
||||
const response = await fetch(`../resources/stash-take.py?key=${uuid}`);
|
||||
const json = await response.json();
|
||||
assert_equals(json, 'on');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Request keepalive</title>
|
||||
<meta name="help" href="https://fetch.spec.whatwg.org/#request">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(new Request('/').keepalive, 'default');
|
||||
assert_true(new Request('/', {keepalive: true}).keepalive, 'true');
|
||||
assert_false(new Request('/', {keepalive: false}).keepalive, 'false');
|
||||
assert_true(new Request('/', {keepalive: 1}).keepalive, 'truish');
|
||||
assert_false(new Request('/', {keepalive: 0}).keepalive, 'falsy');
|
||||
}, 'keepalive flag');
|
||||
|
||||
test(() => {
|
||||
const init = {method: 'POST', keepalive: true, body: new ReadableStream()};
|
||||
assert_throws('TypeError', () => {new Request('/', init)});
|
||||
}, 'keepalive flag with stream body');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
const uuid = token();
|
||||
const URL =
|
||||
`../resources/redirect.py?` +
|
||||
`delay=100&` +
|
||||
`location=../resources/stash-put.py?key=${uuid}%26value=on`;
|
||||
|
||||
addEventListener('load', () => {
|
||||
let p = fetch(URL, {keepalive: true});
|
||||
window.parent.postMessage(uuid, '*');
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -1,5 +1,6 @@
|
|||
from urllib import urlencode
|
||||
from urlparse import urlparse
|
||||
import time
|
||||
|
||||
def main(request, response):
|
||||
stashed_data = {'count': 0, 'preflight': "0"}
|
||||
|
@ -48,6 +49,9 @@ def main(request, response):
|
|||
if "redirect_referrerpolicy" in request.GET:
|
||||
headers.append(("Referrer-Policy", request.GET['redirect_referrerpolicy']))
|
||||
|
||||
if "delay" in request.GET:
|
||||
time.sleep(float(request.GET.first("delay", 0)) / 1E3)
|
||||
|
||||
if token:
|
||||
request.server.stash.put(request.GET.first("token"), stashed_data)
|
||||
if "max_count" in request.GET:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue