Skip to content

Commit 256347a

Browse files
Uzlopakgithub-actions[bot]
authored andcommitted
chore: update WPT
1 parent 69cfd97 commit 256347a

File tree

295 files changed

+17510
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+17510
-840
lines changed

test/fixtures/wpt/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/fixtures/wpt/common/dispatcher/dispatcher.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ function findLocation() {
1616
if (location.href == 'about:srcdoc') {
1717
return findLocationFromAncestors(window.parent);
1818
}
19+
if (location.protocol == 'blob:' || location.protocol == 'data:') {
20+
// Allows working around blob and data URLs.
21+
if (self.document && self.document.baseURI) {
22+
return self.document.baseURI;
23+
}
24+
}
1925
return location;
2026
}
2127

test/fixtures/wpt/common/security-features/tools/generate.py

100644100755
File mode changed.

test/fixtures/wpt/common/security-features/tools/spec_validator.py

100644100755
File mode changed.

test/fixtures/wpt/fetch/api/basic/keepalive.any.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const {
1818
* document event.
1919
*/
2020
function keepaliveSimpleRequestTest(method) {
21-
for (const evt of ['load', 'pagehide', 'unload']) {
21+
for (const evt of ['load', 'unload', 'pagehide']) {
2222
const desc =
2323
`[keepalive] simple ${method} request on '${evt}' [no payload]`;
2424
promise_test(async (test) => {
@@ -30,7 +30,6 @@ function keepaliveSimpleRequestTest(method) {
3030
if (evt != 'load') {
3131
iframe.remove();
3232
}
33-
assert_equals(await getTokenFromMessage(), token1);
3433

3534
assertStashedTokenAsync(desc, token1);
3635
}, `${desc}; setting up`);

test/fixtures/wpt/fetch/api/basic/request-headers.any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ requestHeaders("Fetch with POST with Blob body", url, "POST", new Blob(["Test"])
5454
requestHeaders("Fetch with POST with ArrayBuffer body", url, "POST", new ArrayBuffer(4), location.origin, "4");
5555
requestHeaders("Fetch with POST with Uint8Array body", url, "POST", new Uint8Array(4), location.origin, "4");
5656
requestHeaders("Fetch with POST with Int8Array body", url, "POST", new Int8Array(4), location.origin, "4");
57-
requestHeaders("Fetch with POST with Float16Array body", url, "POST", new Float16Array(1), location.origin, "2");
57+
requestHeaders("Fetch with POST with Float16Array body", url, "POST", () => new Float16Array(1), location.origin, "2");
5858
requestHeaders("Fetch with POST with Float32Array body", url, "POST", new Float32Array(1), location.origin, "4");
5959
requestHeaders("Fetch with POST with Float64Array body", url, "POST", new Float64Array(1), location.origin, "8");
6060
requestHeaders("Fetch with POST with DataView body", url, "POST", new DataView(new ArrayBuffer(8), 0, 4), location.origin, "4");

test/fixtures/wpt/fetch/api/resources/keepalive-helper.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,26 @@ function keepaliveRedirectInUnloadTest(desc, {
174174
desc, token, {expectTokenExist: expectFetchSucceed});
175175
}, `${desc}; setting up`);
176176
}
177+
178+
/**
179+
* utility to create pending keepalive fetch requests
180+
* The pending request state is achieved by ensuring the server (trickle.py) does not
181+
* immediately respond to the fetch requests.
182+
* The response delay is set as a url parameter.
183+
*/
184+
185+
function createPendingKeepAliveRequest(delay, remote = false) {
186+
// trickle.py is a script that can make a delayed response to the client request
187+
const trickleRemoteURL = get_host_info().HTTPS_REMOTE_ORIGIN + '/fetch/api/resources/trickle.py?count=1&ms=';
188+
const trickleLocalURL = get_host_info().HTTP_ORIGIN + '/fetch/api/resources/trickle.py?count=1&ms=';
189+
url = remote ? trickleRemoteURL : trickleLocalURL;
190+
191+
const body = '*'.repeat(10);
192+
return fetch(url + delay, { keepalive: true, body, method: 'POST' }).then(res => {
193+
return res.text();
194+
}).then(() => {
195+
return new Promise(resolve => step_timeout(resolve, 1));
196+
}).catch((error) => {
197+
return Promise.reject(error);;
198+
})
199+
}

test/fixtures/wpt/fetch/api/response/response-blob-realm.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// META: global=window
12
// META: title=realm of Response bytes()
23

34
"use strict";

test/fixtures/wpt/fetch/compression-dictionary/dictionary-decompression.tentative.https.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// Check if the data compressed using Brotli with the dictionary can be
2222
// decompressed.
23-
const data_url = `${kCompressedDataPath}?content_encoding=br-d`;
23+
const data_url = `${kCompressedDataPath}?content_encoding=dcb`;
2424
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
2525
}, 'Decompresion using Brotli with the dictionary works as expected');
2626

@@ -34,7 +34,7 @@
3434

3535
// Check if the data compressed using Zstandard with the dictionary can be
3636
// decompressed.
37-
const data_url = `${kCompressedDataPath}?content_encoding=zstd-d`;
37+
const data_url = `${kCompressedDataPath}?content_encoding=dcz`;
3838
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
3939
}, 'Decompresion using Zstandard with the dictionary works as expected');
4040

@@ -50,7 +50,7 @@
5050
// Check if the data compressed using Brotli with the dictionary can be
5151
// decompressed.
5252
const data_url =
53-
getRemoteHostUrl(`${kCompressedDataPath}?content_encoding=br-d`);
53+
getRemoteHostUrl(`${kCompressedDataPath}?content_encoding=dcb`);
5454
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
5555
}, 'Decompresion of a cross origin resource works as expected');
5656

test/fixtures/wpt/fetch/compression-dictionary/dictionary-fetch-with-link-element.tentative.https.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<body>
1212
<script>
1313

14-
function addLinkRelDictionaryElement(url, crossOrigin) {
14+
function addLinkRelCompressionDictionaryElement(url, crossOrigin) {
1515
const link = document.createElement('link');
16-
link.rel = 'dictionary';
16+
link.rel = 'compression-dictionary';
1717
link.href = url;
1818
if (crossOrigin) {
1919
link.crossOrigin = crossOrigin;
@@ -22,13 +22,14 @@
2222
}
2323

2424
test(t => {
25-
assert_true(document.createElement('link').relList.supports('dictionary'));
26-
}, "Browser supports link element with dictionary rel.");
25+
const link_element = document.createElement('link');
26+
assert_true(link_element.relList.supports('compression-dictionary'));
27+
}, "Browser supports link element with compression-dictionary rel.");
2728

2829
compression_dictionary_promise_test(async (t) => {
2930
const dict_token = token();
3031
const url = `${kRegisterDictionaryPath}?save_header=${dict_token}`;
31-
addLinkRelDictionaryElement(url);
32+
addLinkRelCompressionDictionaryElement(url);
3233
// Wait for a while to ensure that the dictionary is fetched.
3334
await new Promise(resolve => window.requestIdleCallback(resolve));
3435
const headers = await waitUntilPreviousRequestHeaders(t, dict_token);
@@ -40,15 +41,15 @@
4041
kDefaultDictionaryHashBase64);
4142
// Check if the data compressed using Brotli with the dictionary can be
4243
// decompressed.
43-
const data_url = `${kCompressedDataPath}?content_encoding=br-d`;
44+
const data_url = `${kCompressedDataPath}?content_encoding=dcb`;
4445
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
4546
}, 'Fetch same origin dictionary using link element');
4647

4748
compression_dictionary_promise_test(async (t) => {
4849
const dict_token = token();
4950
const url =
5051
getRemoteHostUrl(`${kRegisterDictionaryPath}?save_header=${dict_token}`);
51-
addLinkRelDictionaryElement(url, 'anonymous');
52+
addLinkRelCompressionDictionaryElement(url, 'anonymous');
5253
// Wait for a while to ensure that the dictionary is fetched.
5354
await new Promise(resolve => window.requestIdleCallback(resolve));
5455
const headers = await waitUntilPreviousRequestHeaders(
@@ -63,7 +64,7 @@
6364
// Check if the data compressed using Brotli with the dictionary can be
6465
// decompressed.
6566
const data_url =
66-
getRemoteHostUrl(`${kCompressedDataPath}?content_encoding=br-d`);
67+
getRemoteHostUrl(`${kCompressedDataPath}?content_encoding=dcb`);
6768
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
6869
}, 'Fetch cross origin dictionary using link element');
6970

test/fixtures/wpt/fetch/compression-dictionary/dictionary-fetch-with-link-header.tentative.https.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
<body>
1212
<script>
1313

14-
async function addIframeWithLinkRelDictionaryHeader(dict_url) {
14+
async function addIframeWithLinkRelCompressionDictionaryHeader(dict_url) {
1515
return new Promise((resolve) => {
1616
const base_page_url = './resources/empty.html';
1717
const page_url =
18-
base_page_url + `?pipe=header(link,<${dict_url}>; rel="dictionary")`;
18+
base_page_url +
19+
`?pipe=header(link,<${dict_url}>; rel="compression-dictionary")`;
1920
const iframe = document.createElement('iframe');
2021
iframe.src = page_url;
2122
iframe.addEventListener('load', () => {
@@ -29,7 +30,8 @@
2930
const dict_token = token();
3031
const url = new URL(
3132
`${kRegisterDictionaryPath}?save_header=${dict_token}`, location.href);
32-
const iframe = await addIframeWithLinkRelDictionaryHeader(url.href);
33+
const iframe =
34+
await addIframeWithLinkRelCompressionDictionaryHeader(url.href);
3335
t.add_cleanup(() => {
3436
iframe.remove();
3537
});
@@ -44,7 +46,7 @@
4446
kDefaultDictionaryHashBase64);
4547
// Check if the data compressed using Brotli with the dictionary can be
4648
// decompressed.
47-
const data_url = `${kCompressedDataPath}?content_encoding=br-d`;
49+
const data_url = `${kCompressedDataPath}?content_encoding=dcb`;
4850
assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
4951
}, 'Fetch same origin dictionary using link header');
5052

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
def main(request, response):
22
response.headers.set(b"Access-Control-Allow-Origin", b"*")
33
response.headers.set(b"Content-Type", b"text/plain")
4-
response.headers.set(
5-
b"Content-Dictionary",
6-
b":U5abz16WDg7b8KS93msLPpOB4Vbef1uRzoORYkJw9BY=:")
74

8-
# `br_d_data` and `zstd_d_data` are generated using the following commands:
5+
# `dcb_data` and `dcz_data` are generated using the following commands:
96
#
107
# $ echo "This is a test dictionary." > /tmp/dict
118
# $ echo -n "This is compressed test data using a test dictionary" \
129
# > /tmp/data
13-
# $ brotli -o /tmp/out.brd -D /tmp/dict /tmp/data
14-
# $ xxd -p /tmp/out.brd | tr -d '\n' | sed 's/\(..\)/\\x\1/g'
15-
br_d_data = b"\xa1\x98\x01\x80\x62\xa4\x4c\x1d\xdf\x12\x84\x8c\xae\xc2\xca\x60\x22\x07\x6e\x81\x05\x14\xc9\xb7\xc3\x44\x8e\xbc\x16\xe0\x15\x0e\xec\xc1\xee\x34\x33\x3e\x0d"
16-
# $ zstd -o /tmp/out.zstdd -D /tmp/dict /tmp/data
17-
# $ xxd -p /tmp/out.zstdd | tr -d '\n' | sed 's/\(..\)/\\x\1/g'
18-
zstd_d_data = b"\x28\xb5\x2f\xfd\x24\x34\xf5\x00\x00\x98\x63\x6f\x6d\x70\x72\x65\x73\x73\x65\x64\x61\x74\x61\x20\x75\x73\x69\x6e\x67\x03\x00\x59\xf9\x73\x54\x46\x27\x26\x10\x9e\x99\xf2\xbc"
10+
#
11+
# $ echo -en '\xffDCB' > /tmp/out.dcb
12+
# $ openssl dgst -sha256 -binary /tmp/dict >> /tmp/out.dcb
13+
# $ brotli --stdout -D /tmp/dict /tmp/data >> /tmp/out.dcb
14+
# $ xxd -p /tmp/out.dcb | tr -d '\n' | sed 's/\(..\)/\\x\1/g'
15+
dcb_data = b"\xff\x44\x43\x42\x53\x96\x9b\xcf\x5e\x96\x0e\x0e\xdb\xf0\xa4\xbd\xde\x6b\x0b\x3e\x93\x81\xe1\x56\xde\x7f\x5b\x91\xce\x83\x91\x62\x42\x70\xf4\x16\xa1\x98\x01\x80\x62\xa4\x4c\x1d\xdf\x12\x84\x8c\xae\xc2\xca\x60\x22\x07\x6e\x81\x05\x14\xc9\xb7\xc3\x44\x8e\xbc\x16\xe0\x15\x0e\xec\xc1\xee\x34\x33\x3e\x0d"
16+
# $ echo -en '\x5e\x2a\x4d\x18\x20\x00\x00\x00' > /tmp/out.dcz
17+
# $ openssl dgst -sha256 -binary /tmp/dict >> /tmp/out.dcz
18+
# $ zstd -D /tmp/dict -f -o /tmp/tmp.zstd /tmp/data
19+
# $ cat /tmp/tmp.zstd >> /tmp/out.dcz
20+
# $ xxd -p /tmp/out.dcz | tr -d '\n' | sed 's/\(..\)/\\x\1/g'
21+
dcz_data = b"\x5e\x2a\x4d\x18\x20\x00\x00\x00\x53\x96\x9b\xcf\x5e\x96\x0e\x0e\xdb\xf0\xa4\xbd\xde\x6b\x0b\x3e\x93\x81\xe1\x56\xde\x7f\x5b\x91\xce\x83\x91\x62\x42\x70\xf4\x16\x28\xb5\x2f\xfd\x24\x34\xf5\x00\x00\x98\x63\x6f\x6d\x70\x72\x65\x73\x73\x65\x64\x61\x74\x61\x20\x75\x73\x69\x6e\x67\x03\x00\x59\xf9\x73\x54\x46\x27\x26\x10\x9e\x99\xf2\xbc"
1922

2023
if b'content_encoding' in request.GET:
2124
content_encoding = request.GET.first(b"content_encoding")
2225
response.headers.set(b"Content-Encoding", content_encoding)
23-
if content_encoding == b"br-d":
26+
if content_encoding == b"dcb":
2427
# Send the pre compressed file
25-
response.content = br_d_data
26-
if content_encoding == b"zstd-d":
28+
response.content = dcb_data
29+
if content_encoding == b"dcz":
2730
# Send the pre compressed file
28-
response.content = zstd_d_data
31+
response.content = dcz_data
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# FetchLater Tests
22

3-
These tests cover [FetchLater method](https://whatpr.org/fetch/1647/094ea69...152d725.html#fetch-later-method) related behaviors.
3+
These tests cover [FetchLater method](https://whatpr.org/fetch/1647.html#dom-window-fetchlater) related behaviors.

test/fixtures/wpt/fetch/fetch-later/iframe.tentative.https.window.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,5 @@ parallelPromiseTest(async t => {
5151
await expectBeacon(uuid, {count: 1});
5252
}, 'A same-origin iframe can trigger fetchLater.');
5353

54-
parallelPromiseTest(async t => {
55-
const uuid = token();
56-
const url = generateSetBeaconURL(uuid);
57-
58-
// Loads a same-origin iframe that fires a fetchLater request.
59-
await loadFetchLaterIframe(HTTPS_NOTSAMESITE_ORIGIN, url);
60-
61-
// The iframe should have sent the request.
62-
await expectBeacon(uuid, {count: 1});
63-
}, 'A cross-origin iframe can trigger fetchLater.');
54+
// The test to load a cross-origin iframe that fires a fetchLater request is in
55+
// /fetch/fetch-later/permissions-policy/deferred-fetch-default-permissions-policy.tentative.https.window.js
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Permissions Policy: "deferred-fetch" Tests
2+
3+
This folder contains tests to cover the permissions policy "deferred-fetch",
4+
which is used to gate the `fetchLater()` API.
5+
6+
The tests follow the patterns from
7+
permissions-policy/README.md to cover all use cases of permissions policy for a
8+
new feature.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// META: title=Permissions Policy "deferred-fetch" is allowed to redirect by allow attribute
2+
// META: script=/permissions-policy/resources/permissions-policy.js
3+
// META: script=/common/utils.js
4+
// META: script=/common/get-host-info.sub.js
5+
// META: script=/fetch/fetch-later/resources/fetch-later-helper.js
6+
// META: script=/fetch/fetch-later/permissions-policy/resources/helper.js
7+
// META: timeout=long
8+
'use strict';
9+
10+
const {
11+
HTTPS_ORIGIN,
12+
HTTPS_NOTSAMESITE_ORIGIN,
13+
} = get_host_info();
14+
15+
const baseUrl = '/permissions-policy/resources/redirect-on-load.html#';
16+
const description = 'Permissions policy allow="deferred-fetch"';
17+
18+
async_test(t => {
19+
test_feature_availability(
20+
'fetchLater()', t,
21+
getDeferredFetchPolicyInIframeHelperUrl(`${baseUrl}${HTTPS_ORIGIN}`),
22+
expect_feature_available_default, /*feature_name=*/ 'deferred-fetch');
23+
}, `${description} allows same-origin navigation in an iframe.`);
24+
25+
async_test(t => {
26+
test_feature_availability(
27+
'fetchLater()', t,
28+
getDeferredFetchPolicyInIframeHelperUrl(
29+
`${baseUrl}${HTTPS_NOTSAMESITE_ORIGIN}`),
30+
expect_feature_unavailable_default, /*feature_name=*/ 'deferred-fetch');
31+
}, `${description} disallows cross-origin navigation in an iframe.`);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// META: title=Permissions Policy "deferred-fetch" is allowed by allow attribute
2+
// META: script=/permissions-policy/resources/permissions-policy.js
3+
// META: script=/common/utils.js
4+
// META: script=/common/get-host-info.sub.js
5+
// META: script=/fetch/fetch-later/resources/fetch-later-helper.js
6+
// META: script=/fetch/fetch-later/permissions-policy/resources/helper.js
7+
// META: timeout=long
8+
'use strict';
9+
10+
const {
11+
HTTPS_ORIGIN,
12+
HTTPS_NOTSAMESITE_ORIGIN,
13+
} = get_host_info();
14+
15+
const description = 'Permissions policy "deferred-fetch"';
16+
const attribute = 'allow="deferred-fetch" attribute';
17+
18+
async_test(
19+
t => {
20+
test_feature_availability(
21+
'fetchLater()', t,
22+
getDeferredFetchPolicyInIframeHelperUrl(HTTPS_ORIGIN),
23+
expect_feature_available_default, /*feature_name=*/ 'deferred-fetch');
24+
},
25+
`${description} can be enabled in the same-origin iframe using ${
26+
attribute}.`);
27+
28+
async_test(
29+
t => {
30+
test_feature_availability(
31+
'fetchLater()', t,
32+
getDeferredFetchPolicyInIframeHelperUrl(HTTPS_NOTSAMESITE_ORIGIN),
33+
expect_feature_available_default, /*feature_name=*/ 'deferred-fetch');
34+
},
35+
`${description} can be enabled in the cross-origin iframe using ${
36+
attribute}.`);

0 commit comments

Comments
 (0)