summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/fetch')
-rw-r--r--testing/web-platform/tests/fetch/api/basic/request-headers.any.js1
-rw-r--r--testing/web-platform/tests/fetch/api/basic/request-upload.any.js4
-rw-r--r--testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js16
-rw-r--r--testing/web-platform/tests/fetch/api/request/request-bad-port.any.js2
-rw-r--r--testing/web-platform/tests/fetch/api/resources/huge-response.py22
-rw-r--r--testing/web-platform/tests/fetch/api/response/response-clone.any.js1
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cache.tentative.https.html27
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cookies.tentative.https.html27
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-storage.tentative.https.html27
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data.tentative.https.html54
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-decompression.tentative.https.html1
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html1
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html1
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/dictionary-registration.tentative.https.html1
-rw-r--r--testing/web-platform/tests/fetch/compression-dictionary/resources/compression-dictionary-util.js4
-rw-r--r--testing/web-platform/tests/fetch/metadata/WEB_FEATURES.yml3
-rw-r--r--testing/web-platform/tests/fetch/metadata/generated/appcache-manifest.https.sub.html341
-rw-r--r--testing/web-platform/tests/fetch/metadata/generated/worker-dedicated-constructor.sub.html120
-rw-r--r--testing/web-platform/tests/fetch/metadata/tools/fetch-metadata.conf.yml76
-rw-r--r--testing/web-platform/tests/fetch/metadata/tools/templates/appcache-manifest.sub.https.html63
20 files changed, 195 insertions, 597 deletions
diff --git a/testing/web-platform/tests/fetch/api/basic/request-headers.any.js b/testing/web-platform/tests/fetch/api/basic/request-headers.any.js
index ac54256e4c..8d2ad31e70 100644
--- a/testing/web-platform/tests/fetch/api/basic/request-headers.any.js
+++ b/testing/web-platform/tests/fetch/api/basic/request-headers.any.js
@@ -54,6 +54,7 @@ requestHeaders("Fetch with POST with Blob body", url, "POST", new Blob(["Test"])
requestHeaders("Fetch with POST with ArrayBuffer body", url, "POST", new ArrayBuffer(4), location.origin, "4");
requestHeaders("Fetch with POST with Uint8Array body", url, "POST", new Uint8Array(4), location.origin, "4");
requestHeaders("Fetch with POST with Int8Array body", url, "POST", new Int8Array(4), location.origin, "4");
+requestHeaders("Fetch with POST with Float16Array body", url, "POST", new Float16Array(1), location.origin, "2");
requestHeaders("Fetch with POST with Float32Array body", url, "POST", new Float32Array(1), location.origin, "4");
requestHeaders("Fetch with POST with Float64Array body", url, "POST", new Float64Array(1), location.origin, "8");
requestHeaders("Fetch with POST with DataView body", url, "POST", new DataView(new ArrayBuffer(8), 0, 4), location.origin, "4");
diff --git a/testing/web-platform/tests/fetch/api/basic/request-upload.any.js b/testing/web-platform/tests/fetch/api/basic/request-upload.any.js
index 9168aa1154..0c4813bb53 100644
--- a/testing/web-platform/tests/fetch/api/basic/request-upload.any.js
+++ b/testing/web-platform/tests/fetch/api/basic/request-upload.any.js
@@ -60,6 +60,10 @@ testUpload("Fetch with POST with Int8Array body", url,
"POST",
() => new Int8Array(4),
"\0\0\0\0");
+testUpload("Fetch with POST with Float16Array body", url,
+ "POST",
+ () => new Float16Array(2),
+ "\0\0\0\0");
testUpload("Fetch with POST with Float32Array body", url,
"POST",
() => new Float32Array(1),
diff --git a/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js b/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js
new file mode 100644
index 0000000000..1b09925d85
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/crashtests/huge-fetch.any.js
@@ -0,0 +1,16 @@
+// META: global=window,worker
+
+'use strict';
+
+promise_test(async t => {
+ const response = await fetch('../resources/huge-response.py');
+ const reader = response.body.getReader();
+ // Read one chunk just to show willing.
+ const { value, done } = await reader.read();
+ assert_false(done, 'there should be some data');
+ assert_greater_than(value.byteLength, 0, 'the chunk should be non-empty');
+ // Wait 2 seconds to give it a chance to crash.
+ await new Promise(resolve => t.step_timeout(resolve, 2000));
+ // If we get here without crashing we passed the test.
+ reader.cancel();
+}, 'fetching a huge cacheable file but not reading it should not crash');
diff --git a/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js b/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js
index 5c29823eaa..915063bab5 100644
--- a/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js
+++ b/testing/web-platform/tests/fetch/api/request/request-bad-port.any.js
@@ -89,6 +89,6 @@ var BLOCKED_PORTS_LIST = [
BLOCKED_PORTS_LIST.map(function(a){
promise_test(function(t){
- return promise_rejects_js(t, TypeError, fetch("http://example.com:" + a))
+ return promise_rejects_js(t, TypeError, fetch(`${location.origin}:${a}`))
}, 'Request on bad port ' + a + ' should throw TypeError.');
});
diff --git a/testing/web-platform/tests/fetch/api/resources/huge-response.py b/testing/web-platform/tests/fetch/api/resources/huge-response.py
new file mode 100644
index 0000000000..16a60078e5
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/resources/huge-response.py
@@ -0,0 +1,22 @@
+# A Python script that generates a huge response. Implemented as a script to
+# avoid needing to add a huge file to the repository.
+
+TOTAL_SIZE = 8 * 1024 * 1024 * 1024 # 8 GB
+CHUNK_SIZE = 1024 * 1024 # 1 MB
+
+assert TOTAL_SIZE % CHUNK_SIZE == 0
+
+
+def main(request, response):
+ response.headers.set(b"Content-type", b"text/plain")
+ response.headers.set(b"Content-Length", str(TOTAL_SIZE).encode())
+ response.headers.set(b"Cache-Control", b"max-age=86400")
+ response.write_status_headers()
+
+ chunk = bytes(CHUNK_SIZE)
+ total_sent = 0
+
+ while total_sent < TOTAL_SIZE:
+ if not response.writer.write(chunk):
+ break
+ total_sent += CHUNK_SIZE
diff --git a/testing/web-platform/tests/fetch/api/response/response-clone.any.js b/testing/web-platform/tests/fetch/api/response/response-clone.any.js
index f5cda75149..c0c844948d 100644
--- a/testing/web-platform/tests/fetch/api/response/response-clone.any.js
+++ b/testing/web-platform/tests/fetch/api/response/response-clone.any.js
@@ -135,6 +135,7 @@ testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array");
testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array");
testReadableStreamClone(typeof BigInt64Array === "function" ? new BigInt64Array(arrayBuffer) : undefined, "BigInt64Array");
testReadableStreamClone(typeof BigUint64Array === "function" ? new BigUint64Array(arrayBuffer) : undefined, "BigUint64Array");
+testReadableStreamClone(typeof Float16Array === "function" ? new Float16Array(arrayBuffer) : undefined, "Float16Array");
testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array");
testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array");
testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView");
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cache.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cache.tentative.https.html
new file mode 100644
index 0000000000..c8bcf7fdf1
--- /dev/null
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cache.tentative.https.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<meta name="timeout" content="long"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/compression-dictionary-util.js"></script>
+</head>
+<body>
+<script>
+
+compression_dictionary_promise_test(async (t) => {
+ const dict = await (await fetch(kRegisterDictionaryPath)).text();
+ // Wait until `available-dictionary` header is available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {}),
+ kDefaultDictionaryHashBase64);
+ // Clear site data.
+ assert_equals(await clearSiteData(/*directive=*/'cache'), 'OK');
+ // Check if `available-dictionary` header is not available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
+ '"available-dictionary" header is not available');
+}, 'Clear-Site-Data with "cache" directive must unregister dictionary');
+
+</script>
+</body>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cookies.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cookies.tentative.https.html
new file mode 100644
index 0000000000..aa1673e88c
--- /dev/null
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-cookies.tentative.https.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<meta name="timeout" content="long"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/compression-dictionary-util.js"></script>
+</head>
+<body>
+<script>
+
+compression_dictionary_promise_test(async (t) => {
+ const dict = await (await fetch(kRegisterDictionaryPath)).text();
+ // Wait until `available-dictionary` header is available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {}),
+ kDefaultDictionaryHashBase64);
+ // Clear site data.
+ assert_equals(await clearSiteData(/*directive=*/'cookies'), 'OK');
+ // Check if `available-dictionary` header is not available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
+ '"available-dictionary" header is not available');
+}, 'Clear-Site-Data with "cookies" directive must unregister dictionary');
+
+</script>
+</body>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-storage.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-storage.tentative.https.html
new file mode 100644
index 0000000000..22747eb656
--- /dev/null
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data-storage.tentative.https.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<meta name="timeout" content="long"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/compression-dictionary-util.js"></script>
+</head>
+<body>
+<script>
+
+compression_dictionary_promise_test(async (t) => {
+ const dict = await (await fetch(kRegisterDictionaryPath)).text();
+ // Wait until `available-dictionary` header is available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {}),
+ kDefaultDictionaryHashBase64);
+ // Clear site data.
+ assert_equals(await clearSiteData(/*directive=*/'storage'), 'OK');
+ // Check if `available-dictionary` header is not available.
+ assert_equals(
+ await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
+ kDefaultDictionaryHashBase64);
+}, 'Clear-Site-Data with "storage" directive must not unregister dictionary');
+
+</script>
+</body>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data.tentative.https.html
deleted file mode 100644
index b583834831..0000000000
--- a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-clear-site-data.tentative.https.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<head>
-<meta charset="utf-8">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="./resources/compression-dictionary-util.js"></script>
-</head>
-<body>
-<script>
-
-compression_dictionary_promise_test(async (t) => {
- const dict = await (await fetch(kRegisterDictionaryPath)).text();
- // Wait until `available-dictionary` header is available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {}),
- kDefaultDictionaryHashBase64);
- // Clear site data.
- assert_equals(await clearSiteData(/*directive=*/'cache'), 'OK');
- // Check if `available-dictionary` header is not available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
- '"available-dictionary" header is not available');
-}, 'Clear-Site-Data with "cache" directive must unregister dictionary');
-
-compression_dictionary_promise_test(async (t) => {
- const dict = await (await fetch(kRegisterDictionaryPath)).text();
- // Wait until `available-dictionary` header is available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {}),
- kDefaultDictionaryHashBase64);
- // Clear site data.
- assert_equals(await clearSiteData(/*directive=*/'cookies'), 'OK');
- // Check if `available-dictionary` header is not available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
- '"available-dictionary" header is not available');
-}, 'Clear-Site-Data with "cookies" directive must unregister dictionary');
-
-compression_dictionary_promise_test(async (t) => {
- const dict = await (await fetch(kRegisterDictionaryPath)).text();
- // Wait until `available-dictionary` header is available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {}),
- kDefaultDictionaryHashBase64);
- // Clear site data.
- assert_equals(await clearSiteData(/*directive=*/'storage'), 'OK');
- // Check if `available-dictionary` header is not available.
- assert_equals(
- await waitUntilAvailableDictionaryHeader(t, {max_retry: 0}),
- kDefaultDictionaryHashBase64);
-}, 'Clear-Site-Data with "storage" directive must not unregister dictionary');
-
-</script>
-</body>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-decompression.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-decompression.tentative.https.html
index cd20625816..c7b3b7c3a5 100644
--- a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-decompression.tentative.https.html
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-decompression.tentative.https.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
+<meta name="timeout" content="long"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html
index 71a9b1c050..23a271d481 100644
--- a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
+<meta name="timeout" content="long"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html
index a3ffd8ba74..6f6a792ade 100644
--- a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
+<meta name="timeout" content="long"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-registration.tentative.https.html b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-registration.tentative.https.html
index 7921b12946..f0782aff3b 100644
--- a/testing/web-platform/tests/fetch/compression-dictionary/dictionary-registration.tentative.https.html
+++ b/testing/web-platform/tests/fetch/compression-dictionary/dictionary-registration.tentative.https.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
+<meta name="timeout" content="long"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/compression-dictionary-util.js"></script>
diff --git a/testing/web-platform/tests/fetch/compression-dictionary/resources/compression-dictionary-util.js b/testing/web-platform/tests/fetch/compression-dictionary/resources/compression-dictionary-util.js
index 46d95041d8..7d86f594a8 100644
--- a/testing/web-platform/tests/fetch/compression-dictionary/resources/compression-dictionary-util.js
+++ b/testing/web-platform/tests/fetch/compression-dictionary/resources/compression-dictionary-util.js
@@ -6,8 +6,8 @@ const kRegisterDictionaryPath = './resources/register-dictionary.py';
const kCompressedDataPath = './resources/compressed-data.py';
const kExpectedCompressedData =
`This is compressed test data using a test dictionary`;
-const kCheckAvailableDictionaryHeaderMaxRetry = 5;
-const kCheckAvailableDictionaryHeaderRetryTimeout = 100;
+const kCheckAvailableDictionaryHeaderMaxRetry = 10;
+const kCheckAvailableDictionaryHeaderRetryTimeout = 200;
const kCheckPreviousRequestHeadersMaxRetry = 5;
const kCheckPreviousRequestHeadersRetryTimeout = 250;
diff --git a/testing/web-platform/tests/fetch/metadata/WEB_FEATURES.yml b/testing/web-platform/tests/fetch/metadata/WEB_FEATURES.yml
new file mode 100644
index 0000000000..fb48eaa311
--- /dev/null
+++ b/testing/web-platform/tests/fetch/metadata/WEB_FEATURES.yml
@@ -0,0 +1,3 @@
+features:
+- name: fetch-metadata
+ files: "**"
diff --git a/testing/web-platform/tests/fetch/metadata/generated/appcache-manifest.https.sub.html b/testing/web-platform/tests/fetch/metadata/generated/appcache-manifest.https.sub.html
deleted file mode 100644
index cf322fd34b..0000000000
--- a/testing/web-platform/tests/fetch/metadata/generated/appcache-manifest.https.sub.html
+++ /dev/null
@@ -1,341 +0,0 @@
-<!DOCTYPE html>
-<!--
-This test was procedurally generated. Please do not modify it directly.
-Sources:
-- fetch/metadata/tools/fetch-metadata.conf.yml
-- fetch/metadata/tools/templates/appcache-manifest.sub.https.html
--->
-<html lang="en">
- <meta charset="utf-8">
- <title>HTTP headers on request for Appcache manifest</title>
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <script src="/fetch/metadata/resources/helper.sub.js"></script>
- <body>
- <script>
- 'use strict';
-
- function induceRequest(url) {
- const iframe = document.createElement('iframe');
- iframe.src =
- '/fetch/metadata/resources/appcache-iframe.sub.html?manifest=' + encodeURIComponent(url);
-
- return new Promise((resolve) => {
- addEventListener('message', function onMessage(event) {
- if (event.source !== iframe.contentWindow) {
- return;
- }
- removeEventListener('message', onMessage);
- resolve(event.data);
- });
-
- document.body.appendChild(iframe);
- })
- .then((message) => {
- if (message !== 'okay') {
- throw message;
- }
- })
- .then(() => iframe.remove());
- }
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same origin');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsCrossSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Cross-site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsSameSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-site');
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - HTTPS downgrade (header not sent)');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpOrigin', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - HTTPS upgrade');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpOrigin', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - HTTPS downgrade-upgrade');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Origin -> Cross-Site -> Same-Origin redirect');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpsSameSite', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Origin -> Same-Site -> Same-Origin redirect');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsCrossSite', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Cross-Site -> Same Origin');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsCrossSite', 'httpsSameSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Cross-Site -> Same-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsCrossSite', 'httpsCrossSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Cross-Site -> Cross-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Origin -> Same Origin');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpsSameSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Origin -> Same-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Origin -> Cross-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsSameSite', 'httpsOrigin']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Site -> Same Origin');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsSameSite', 'httpsSameSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['same-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Site -> Same-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, ['httpsSameSite', 'httpsCrossSite']))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-site');
- assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-site - Same-Site -> Cross-Site');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, []))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-mode');
- assert_array_equals(headers['sec-fetch-mode'], ['no-cors']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-mode');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, []))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_own_property(headers, 'sec-fetch-dest');
- assert_array_equals(headers['sec-fetch-dest'], ['empty']);
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-dest');
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, []))
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-user');
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, 'sec-fetch-user');
- </script>
- </body>
-</html>
diff --git a/testing/web-platform/tests/fetch/metadata/generated/worker-dedicated-constructor.sub.html b/testing/web-platform/tests/fetch/metadata/generated/worker-dedicated-constructor.sub.html
index 69ac7682a5..65b1837c63 100644
--- a/testing/web-platform/tests/fetch/metadata/generated/worker-dedicated-constructor.sub.html
+++ b/testing/web-platform/tests/fetch/metadata/generated/worker-dedicated-constructor.sub.html
@@ -40,36 +40,6 @@ Sources:
const key = '{{uuid()}}';
const url = makeRequestURL(
key,
- ['httpSameSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-site');
- });
- }, 'sec-fetch-site - Not sent to non-trustworthy same-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
- ['httpCrossSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-site');
- });
- }, 'sec-fetch-site - Not sent to non-trustworthy cross-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
['httpOrigin'],
{ mime: 'application/javascript', body: 'postMessage("")' }
);
@@ -85,36 +55,6 @@ Sources:
const key = '{{uuid()}}';
const url = makeRequestURL(
key,
- ['httpSameSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-mode');
- });
- }, 'sec-fetch-mode - Not sent to non-trustworthy same-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
- ['httpCrossSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-mode');
- });
- }, 'sec-fetch-mode - Not sent to non-trustworthy cross-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
['httpOrigin'],
{ mime: 'application/javascript', body: 'postMessage("")' }
);
@@ -130,36 +70,6 @@ Sources:
const key = '{{uuid()}}';
const url = makeRequestURL(
key,
- ['httpSameSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-dest');
- });
- }, 'sec-fetch-dest - Not sent to non-trustworthy same-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
- ['httpCrossSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-dest');
- });
- }, 'sec-fetch-dest - Not sent to non-trustworthy cross-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
['httpOrigin'],
{ mime: 'application/javascript', body: 'postMessage("")' }
);
@@ -170,35 +80,5 @@ Sources:
assert_not_own_property(headers, 'sec-fetch-user');
});
}, 'sec-fetch-user - Not sent to non-trustworthy same-origin destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
- ['httpSameSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-user');
- });
- }, 'sec-fetch-user - Not sent to non-trustworthy same-site destination, no options');
-
- promise_test(() => {
- const key = '{{uuid()}}';
- const url = makeRequestURL(
- key,
- ['httpCrossSite'],
- { mime: 'application/javascript', body: 'postMessage("")' }
- );
-
- return induceRequest(url)
- .then(() => retrieve(key))
- .then((headers) => {
- assert_not_own_property(headers, 'sec-fetch-user');
- });
- }, 'sec-fetch-user - Not sent to non-trustworthy cross-site destination, no options');
</script>
</html>
diff --git a/testing/web-platform/tests/fetch/metadata/tools/fetch-metadata.conf.yml b/testing/web-platform/tests/fetch/metadata/tools/fetch-metadata.conf.yml
index b277bcb7b5..b96bd2fd7b 100644
--- a/testing/web-platform/tests/fetch/metadata/tools/fetch-metadata.conf.yml
+++ b/testing/web-platform/tests/fetch/metadata/tools/fetch-metadata.conf.yml
@@ -43,10 +43,8 @@ cases:
origins: [httpCrossSite]
description: Not sent to non-trustworthy cross-site destination
template_axes:
- # Unused
- appcache-manifest.sub.https.html: []
- # The `audioWorklet` interface is only available in secure contexts
- # https://webaudio.github.io/web-audio-api/#BaseAudioContext
+ # The `AudioWorklet` interface is only available in secure contexts
+ # https://webaudio.github.io/web-audio-api/#AudioWorklet
audioworklet.https.sub.html: []
# Service workers are only available in secure context
fetch-via-serviceworker.https.sub.html: []
@@ -91,6 +89,62 @@ cases:
svg-image.sub.html: [{}]
window-history.sub.html: [{}]
worker-dedicated-importscripts.sub.html: [{}]
+ # `new Worker()` only makes same-origin requests, therefore we split it
+ # out into the next block.
+ worker-dedicated-constructor.sub.html: []
+
+ - all_subtests:
+ expected: NULL
+ filename_flags: []
+ common_axis:
+ - headerName: sec-fetch-site
+ origins: [httpOrigin]
+ description: Not sent to non-trustworthy same-origin destination
+ - headerName: sec-fetch-mode
+ origins: [httpOrigin]
+ description: Not sent to non-trustworthy same-origin destination
+ - headerName: sec-fetch-dest
+ origins: [httpOrigin]
+ description: Not sent to non-trustworthy same-origin destination
+ - headerName: sec-fetch-user
+ origins: [httpOrigin]
+ description: Not sent to non-trustworthy same-origin destination
+ template_axes:
+ # All the templates in this block are unused with the exception of
+ # `worker-dedicated-constructor`
+ audioworklet.https.sub.html: []
+ fetch-via-serviceworker.https.sub.html: []
+ serviceworker.https.sub.html: []
+ css-images.sub.html: []
+ css-font-face.sub.html: []
+ element-a.sub.html: []
+ element-area.sub.html: []
+ element-audio.sub.html: []
+ element-embed.sub.html: []
+ element-frame.sub.html: []
+ element-iframe.sub.html: []
+ element-img.sub.html: []
+ element-img-environment-change.sub.html: []
+ element-input-image.sub.html: []
+ element-link-icon.sub.html: []
+ element-link-prefetch.optional.sub.html: []
+ element-meta-refresh.optional.sub.html: []
+ element-picture.sub.html: []
+ element-script.sub.html: []
+ element-video.sub.html: []
+ element-video-poster.sub.html: []
+ fetch.sub.html: []
+ form-submission.sub.html: []
+ header-link.sub.html: []
+ header-refresh.optional.sub.html: []
+ window-location.sub.html: []
+ script-module-import-dynamic.sub.html: []
+ script-module-import-static.sub.html: []
+ svg-image.sub.html: []
+ window-history.sub.html: []
+ worker-dedicated-importscripts.sub.html: []
+ # `new Worker()` only makes same-origin requests, so we populate its
+ # generated tests here.
worker-dedicated-constructor.sub.html: [{}]
# Sec-Fetch-Site - direct requests
@@ -117,7 +171,6 @@ cases:
# https://html.spec.whatwg.org/#fetch-a-single-module-script
worker-dedicated-constructor.sub.html: []
- appcache-manifest.sub.https.html: [{}]
audioworklet.https.sub.html: [{}]
css-images.sub.html:
- filename_flags: [tentative]
@@ -176,8 +229,8 @@ cases:
expected: cross-site
template_axes:
# Unused
- # The `audioWorklet` interface is only available in secure contexts
- # https://webaudio.github.io/web-audio-api/#BaseAudioContext
+ # The `AudioWorklet` interface is only available in secure contexts
+ # https://webaudio.github.io/web-audio-api/#AudioWorklet
audioworklet.https.sub.html: []
# Service workers are only available in secure context
fetch-via-serviceworker.https.sub.html: []
@@ -196,7 +249,6 @@ cases:
# https://html.spec.whatwg.org/#fetch-a-single-module-script
worker-dedicated-constructor.sub.html: []
- appcache-manifest.sub.https.html: [{}]
css-images.sub.html:
- filename_flags: [tentative]
css-font-face.sub.html:
@@ -289,7 +341,6 @@ cases:
# https://html.spec.whatwg.org/#fetch-a-single-module-script
worker-dedicated-constructor.sub.html: []
- appcache-manifest.sub.https.html: [{}]
audioworklet.https.sub.html: [{}]
css-images.sub.html:
- filename_flags: [tentative]
@@ -377,7 +428,6 @@ cases:
worker-dedicated-constructor.sub.html: []
worker-dedicated-importscripts.sub.html: []
# Avoid duplicate subtest for 'sec-fetch-site - HTTPS downgrade-upgrade'
- appcache-manifest.sub.https.html: []
css-images.sub.html:
- filename_flags: [tentative]
element-a.sub.html: [{}]
@@ -409,8 +459,6 @@ cases:
filename_flags: [https]
origins: []
template_axes:
- appcache-manifest.sub.https.html:
- - expected: no-cors
audioworklet.https.sub.html:
# https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
- expected: cors
@@ -586,8 +634,6 @@ cases:
filename_flags: [https]
origins: []
template_axes:
- appcache-manifest.sub.https.html:
- - expected: empty
audioworklet.https.sub.html:
# https://github.com/WebAudio/web-audio-api/issues/2203
- expected: audioworklet
@@ -709,8 +755,6 @@ cases:
filename_flags: [https]
origins: []
template_axes:
- appcache-manifest.sub.https.html:
- - expected: NULL
audioworklet.https.sub.html:
- expected: NULL
css-images.sub.html:
diff --git a/testing/web-platform/tests/fetch/metadata/tools/templates/appcache-manifest.sub.https.html b/testing/web-platform/tests/fetch/metadata/tools/templates/appcache-manifest.sub.https.html
deleted file mode 100644
index 0dfc084f2e..0000000000
--- a/testing/web-platform/tests/fetch/metadata/tools/templates/appcache-manifest.sub.https.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-<!--
-[%provenance%]
--->
-<html lang="en">
- <meta charset="utf-8">
- <title>HTTP headers on request for Appcache manifest</title>
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <script src="/fetch/metadata/resources/helper.sub.js"></script>
- <body>
- <script>
- 'use strict';
-
- function induceRequest(url) {
- const iframe = document.createElement('iframe');
- iframe.src =
- '/fetch/metadata/resources/appcache-iframe.sub.html?manifest=' + encodeURIComponent(url);
-
- return new Promise((resolve) => {
- addEventListener('message', function onMessage(event) {
- if (event.source !== iframe.contentWindow) {
- return;
- }
- removeEventListener('message', onMessage);
- resolve(event.data);
- });
-
- document.body.appendChild(iframe);
- })
- .then((message) => {
- if (message !== 'okay') {
- throw message;
- }
- })
- .then(() => iframe.remove());
- }
-
- {%- for subtest in subtests %}
-
- async_test((t) => {
- const key = '{{uuid()}}';
- assert_implements_optional(
- !!window.applicationCache, 'Application Cache supported.'
- );
-
- induceRequest(makeRequestURL(key, [% subtest.origins %]))
- .then(() => retrieve(key))
- .then((headers) => {
- {%- if subtest.expected == none %}
- assert_not_own_property(headers, '[%subtest.headerName%]');
- {%- else %}
- assert_own_property(headers, '[%subtest.headerName%]');
- assert_array_equals(headers['[%subtest.headerName%]'], ['[%subtest.expected%]']);
- {%- endif %}
- })
- .then(() => t.done(), t.step_func((error) => { throw error; }));
- }, '[%subtest.headerName%][%subtest.description | pad("start", " - ")%]');
-
- {%- endfor %}
- </script>
- </body>
-</html>