mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision ea14651f262003177d0ba5819bd2806a1327b12a
This commit is contained in:
parent
847115ba04
commit
816185f094
272 changed files with 5766 additions and 2855 deletions
|
@ -1,36 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Headers idl interface</title>
|
||||
<meta name="help" href="https://fetch.spec.whatwg.org/#response">
|
||||
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script id="headers-idl" type="text/plain">
|
||||
typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit;
|
||||
|
||||
[Constructor(optional HeadersInit init),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Headers {
|
||||
void append(ByteString name, ByteString value);
|
||||
void delete(ByteString name);
|
||||
ByteString? get(ByteString name);
|
||||
boolean has(ByteString name);
|
||||
void set(ByteString name, ByteString value);
|
||||
iterable<ByteString, ByteString>;
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var idlsArray = new IdlArray();
|
||||
var idl = document.getElementById("headers-idl").textContent
|
||||
idlsArray.add_idls(idl);
|
||||
idlsArray.add_objects({ Headers: ['new Headers()'] });
|
||||
idlsArray.test();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
18
tests/wpt/web-platform-tests/fetch/api/idl.any.js
Normal file
18
tests/wpt/web-platform-tests/fetch/api/idl.any.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
// META: global=window,worker
|
||||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
promise_test(async() => {
|
||||
const text = await (await fetch("/interfaces/fetch.idl")).text();
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(text);
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface AbortSignal {};");
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ReadableStream {};");
|
||||
idl_array.add_untested_idls("enum ReferrerPolicy {};");
|
||||
idl_array.add_objects({
|
||||
Headers: ["new Headers()"],
|
||||
Request: ["new Request('about:blank')"],
|
||||
Response: ["new Response()"],
|
||||
});
|
||||
idl_array.test();
|
||||
}, "Fetch Standard IDL");
|
|
@ -425,4 +425,18 @@ promise_test(async t => {
|
|||
});
|
||||
}, 'HTMLLinkElement with rel=preload and as=manifest fetches with a "manifest" Request.destination');
|
||||
|
||||
// HTMLLinkElement with rel=prefetch - empty string destination
|
||||
promise_test(async t => {
|
||||
await new Promise((resolve, reject) => {
|
||||
let node = frame.contentWindow.document.createElement("link");
|
||||
node.rel = "prefetch";
|
||||
node.onload = resolve;
|
||||
node.onerror = reject;
|
||||
node.href = "dummy?dest=";
|
||||
frame.contentWindow.document.body.appendChild(node);
|
||||
}).catch(() => {
|
||||
assert_unreached("Fetch errored.");
|
||||
});
|
||||
}, 'HTMLLinkElement with rel=prefetch fetches with an empty string Request.destination');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Request idl interface</title>
|
||||
<meta name="help" href="https://fetch.spec.whatwg.org/#response">
|
||||
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script id="body-idl" type="text/plain">
|
||||
typedef any JSON;
|
||||
typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit;
|
||||
|
||||
interface mixin Body {
|
||||
readonly attribute ReadableStream? body;
|
||||
readonly attribute boolean bodyUsed;
|
||||
[NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
[NewObject] Promise<Blob> blob();
|
||||
[NewObject] Promise<FormData> formData();
|
||||
[NewObject] Promise<JSON> json();
|
||||
[NewObject] Promise<USVString> text();
|
||||
};
|
||||
</script>
|
||||
<script id="request-idl" type="text/plain">
|
||||
typedef (Request or USVString) RequestInfo;
|
||||
|
||||
[Constructor(RequestInfo input, optional RequestInit init),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Request {
|
||||
readonly attribute ByteString method;
|
||||
readonly attribute USVString url;
|
||||
[SameObject] readonly attribute Headers headers;
|
||||
|
||||
readonly attribute RequestDestination destination;
|
||||
readonly attribute USVString referrer;
|
||||
readonly attribute ReferrerPolicy referrerPolicy;
|
||||
readonly attribute RequestMode mode;
|
||||
readonly attribute RequestCredentials credentials;
|
||||
readonly attribute RequestCache cache;
|
||||
readonly attribute RequestRedirect redirect;
|
||||
readonly attribute DOMString integrity;
|
||||
|
||||
[NewObject] Request clone();
|
||||
};
|
||||
Request includes Body;
|
||||
|
||||
dictionary RequestInit {
|
||||
ByteString method;
|
||||
HeadersInit headers;
|
||||
BodyInit? body;
|
||||
USVString referrer;
|
||||
ReferrerPolicy referrerPolicy;
|
||||
RequestMode mode;
|
||||
RequestCredentials credentials;
|
||||
RequestCache cache;
|
||||
RequestRedirect redirect;
|
||||
DOMString integrity;
|
||||
any window; // can only be set to null
|
||||
};
|
||||
|
||||
enum RequestType { "", "audio", "font", "image", "script", "style", "track", "video" };
|
||||
enum RequestDestination { "", "document", "sharedworker", "subresource", "unknown", "worker" };
|
||||
enum RequestMode { "navigate", "same-origin", "no-cors", "cors" };
|
||||
enum RequestCredentials { "omit", "same-origin", "include" };
|
||||
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
|
||||
enum RequestRedirect { "follow", "error", "manual" };
|
||||
enum ReferrerPolicy {
|
||||
"", "no-referrer", "no-referrer-when-downgrade", "origin",
|
||||
"origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin",
|
||||
"strict-origin-when-cross-origin"
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var idlsArray = new IdlArray();
|
||||
var idl = document.getElementById("body-idl").textContent
|
||||
idl += document.getElementById("request-idl").textContent
|
||||
|
||||
idlsArray.add_idls(idl);
|
||||
idlsArray.add_untested_idls("interface Headers {};");
|
||||
idlsArray.add_objects({ Request: ['new Request("")'] });
|
||||
idlsArray.test();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
const worker = 'resources/request-reset-attributes-worker.js';
|
||||
|
||||
promise_test(async (t) => {
|
||||
const scope = 'resources/hello.txt?name=isReloadNavigation';
|
||||
let frame;
|
||||
let reg;
|
||||
|
||||
try {
|
||||
reg = await service_worker_unregister_and_register(t, worker, scope);
|
||||
await wait_for_state(t, reg.installing, 'activated');
|
||||
frame = await with_iframe(scope);
|
||||
assert_equals(frame.contentDocument.body.textContent,
|
||||
'old: false, new: false');
|
||||
await new Promise((resolve) => {
|
||||
frame.onload = resolve;
|
||||
frame.contentWindow.location.reload();
|
||||
});
|
||||
assert_equals(frame.contentDocument.body.textContent,
|
||||
'old: true, new: false');
|
||||
} finally {
|
||||
if (frame) {
|
||||
frame.remove();
|
||||
}
|
||||
if (reg) {
|
||||
await reg.unregister();
|
||||
}
|
||||
}
|
||||
}, 'Request.isReloadNavigation is reset with non-empty RequestInit');
|
||||
</script>
|
|
@ -99,6 +99,11 @@
|
|||
newValue = true;
|
||||
break;
|
||||
|
||||
case "isReloadNavigation":
|
||||
defaultValue = false;
|
||||
newValue = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
hello
|
|
@ -0,0 +1,19 @@
|
|||
self.addEventListener('fetch', (event) => {
|
||||
const params = new URL(event.request.url).searchParams;
|
||||
if (params.has('ignore')) {
|
||||
return;
|
||||
}
|
||||
if (!params.has('name')) {
|
||||
event.respondWith(Promise.reject(TypeError('No name is provided.')));
|
||||
return;
|
||||
}
|
||||
|
||||
const name = params.get('name');
|
||||
const old_attribute = event.request[name];
|
||||
// If any of |init|'s member is present...
|
||||
const init = {cache: 'no-store'}
|
||||
const new_attribute = (new Request(event.request, init))[name];
|
||||
|
||||
event.respondWith(
|
||||
new Response(`old: ${old_attribute}, new: ${new_attribute}`));
|
||||
});
|
|
@ -1,68 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Response idl interface</title>
|
||||
<meta name="help" href="https://fetch.spec.whatwg.org/#response">
|
||||
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script id="body-idl" type="text/plain">
|
||||
typedef any JSON;
|
||||
typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit;
|
||||
|
||||
interface mixin Body {
|
||||
readonly attribute ReadableStream? body;
|
||||
readonly attribute boolean bodyUsed;
|
||||
[NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
[NewObject] Promise<Blob> blob();
|
||||
[NewObject] Promise<FormData> formData();
|
||||
[NewObject] Promise<JSON> json();
|
||||
[NewObject] Promise<USVString> text();
|
||||
};
|
||||
</script>
|
||||
<script id="response-idl" type="text/plain">
|
||||
[Constructor(optional BodyInit body, optional ResponseInit init),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Response {
|
||||
[NewObject] static Response error();
|
||||
[NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
|
||||
|
||||
readonly attribute ResponseType type;
|
||||
|
||||
readonly attribute USVString url;
|
||||
readonly attribute unsigned short status;
|
||||
readonly attribute boolean ok;
|
||||
readonly attribute ByteString statusText;
|
||||
[SameObject] readonly attribute Headers headers;
|
||||
readonly attribute Promise<Headers> trailer;
|
||||
|
||||
[NewObject] Response clone();
|
||||
};
|
||||
Response includes Body;
|
||||
|
||||
dictionary ResponseInit {
|
||||
unsigned short status = 200;
|
||||
ByteString statusText = "OK";
|
||||
HeadersInit headers;
|
||||
};
|
||||
|
||||
enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };
|
||||
</script>
|
||||
<script>
|
||||
var idlsArray = new IdlArray();
|
||||
var idl = document.getElementById("body-idl").textContent
|
||||
idl += document.getElementById("response-idl").textContent
|
||||
|
||||
idlsArray.add_idls(idl);
|
||||
idlsArray.add_untested_idls("interface Headers {};");
|
||||
idlsArray.add_untested_idls("interface ReadableStream {};");
|
||||
idlsArray.add_objects({ Response: ['new Response()'] });
|
||||
idlsArray.test();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue