Skip to content

Commit ba8c073

Browse files
chore: update WPT (#3488)
Co-authored-by: Uzlopak <[email protected]>
1 parent ee45443 commit ba8c073

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

0 commit comments

Comments
 (0)