Skip to content

Commit 7070adb

Browse files
Uzlopakgithub-actions[bot]
authored andcommitted
chore: update WPT
1 parent 436e749 commit 7070adb

18 files changed

+183
-31
lines changed

test/fixtures/wpt/fetch/api/body/mime-type.any.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
[
8989
() => new Request("about:blank", { method: "POST", body: new Blob([""], { type: "Text/Plain" }), headers: [["Content-Type", "Text/Html"]] }),
90-
() => new Response(new Blob([""], { type: "Text/Plain" }, { headers: [["Content-Type", "Text/Html"]] }))
90+
() => new Response(new Blob([""], { type: "Text/Plain" }), { headers: [["Content-Type", "Text/Html"]] })
9191
].forEach(bodyContainerCreator => {
9292
const bodyContainer = bodyContainerCreator();
9393
const cloned = bodyContainer.clone();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function assertStashedTokenAsync(
117117
*
118118
* `unloadIframe` to unload the iframe before verifying stashed token to
119119
* simulate the situation that unloads after fetching. Note that this test is
120-
* different from `keepaliveRedirectInUnloadTest()` in that the the latter
120+
* different from `keepaliveRedirectInUnloadTest()` in that the latter
121121
* performs fetch() call directly in `unload` event handler, while this test
122122
* does it in `load`.
123123
*/

test/fixtures/wpt/fetch/http-cache/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ Possible members of a request object:
6262
- expected_response_headers - An array of `[header_name_string, header_value_string]` representing
6363
headers to check the response for. See also response_headers.
6464
- expected_response_text - A string to check the response body against. If not present, `response_body` will be checked if present and non-null; otherwise the response body will be checked for the test uuid (unless the status code disallows a body). Set to `null` to disable all response body checking.
65+
- url_params - A string of url parameters that will be appended to the end of the url, separated by "&" and without leading "&".
6566

6667
Some headers in `response_headers` are treated specially:
6768

6869
* For date-carrying headers, if the value is a number, it will be interpreted as a delta to the time of the first request at the server.
6970
* For URL-carrying headers, the value will be appended as a query parameter for `target`.
7071

7172
See the source for exact details.
72-

test/fixtures/wpt/fetch/http-cache/http-cache.js

+3
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ function makeTestUrl (uuid, config) {
255255
if ('query_arg' in config) {
256256
arg = `&target=${config.query_arg}`
257257
}
258+
if ('url_params' in config) {
259+
arg = `${arg}&${config.url_params}`
260+
}
258261
return `${base_url}resources/http-cache.py?dispatch=test&uuid=${uuid}${arg}`
259262
}
260263

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// META: global=window,worker
2+
// META: title=NoVarySearch HTTP Cache
3+
// META: timeout=long
4+
// META: script=/common/utils.js
5+
// META: script=/common/get-host-info.sub.js
6+
// META: script=http-cache.js
7+
/*
8+
NOTE for testing No-Vary-Search-Header:
9+
If `params` is set to true, `expect=("dispatch" "uuid")` must be specified.
10+
Otherwise:
11+
- The same HTTP Cache will be used by other tests, which are supposed
12+
to be distinguished by uuid.
13+
- The test utility cannot get the server's states because UA will use the HTTP
14+
Cache instead of sending a new request to server to ask for the latest state.
15+
*/
16+
var tests = [
17+
{
18+
name: "When params is set to true, URL differs only by their parameters (other than `dispatch` and `uuid`) should not be cached as different entries.",
19+
requests: [
20+
{
21+
url_params: "a=1&b=2",
22+
response_headers: [
23+
["Cache-Control", "max-age=10000"],
24+
["No-Vary-Search", "params, except=(\"dispatch\" \"uuid\")"],
25+
],
26+
},
27+
{
28+
expected_type: "cached"
29+
}
30+
]
31+
}
32+
];
33+
run_tests(tests);
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
`location.replace(\`${dangling_url}\`)`,
1212
];
1313

14-
function get_requests(worker, expected) {
15-
return new Promise(resolve => {
14+
function get_requests(test, worker, expected) {
15+
return new Promise((resolve, reject) => {
16+
let didTimeout = false;
17+
test.step_timeout(() => {
18+
didTimeout = true;
19+
reject("get_requests timed out");
20+
}, 1000);
1621
navigator.serviceWorker.addEventListener('message', function onMsg(evt) {
1722
if (evt.data.size >= expected) {
1823
navigator.serviceWorker.removeEventListener('message', onMsg);
1924
resolve(evt.data);
20-
} else {
25+
} else if (!didTimeout) {
2126
worker.postMessage("");
2227
}
2328
});
@@ -40,6 +45,7 @@
4045
});
4146

4247
const dangling_resource = "404?type=text/javascript&\n<"
48+
const dangling_resource_expected = "404?type=text/javascript&%3C"
4349
const api_calls = [
4450
[`const xhr = new XMLHttpRequest();
4551
xhr.open("GET", \`${"xhr" + dangling_resource}\`);
@@ -54,22 +60,30 @@
5460

5561
];
5662

57-
navigator.serviceWorker.register('service-worker.js');
58-
const iframe = document.createElement('iframe');
59-
iframe.src = "resources/empty.html";
60-
document.body.appendChild(iframe);
63+
let iframe, registration;
64+
promise_test(async t => {
65+
iframe = document.createElement('iframe');
66+
iframe.src = "resources/empty.html";
67+
document.body.appendChild(iframe);
68+
await new Promise(resolve => iframe.onload = resolve);
69+
registration = await navigator.serviceWorker.register('service-worker.js');
70+
if (!iframe.contentWindow.navigator.serviceWorker.controller)
71+
await new Promise(resolve => iframe.contentWindow.navigator.serviceWorker.oncontrollerchange = resolve);
72+
}, "Setup controlled frame");
73+
74+
let number_api_calls = 0;
6175
api_calls.forEach(call => {
62-
promise_test(t => {
63-
return new Promise(resolve => {
64-
navigator.serviceWorker.ready.then(t.step_func(registration => {
65-
iframe.contentWindow.eval(call[0]);
66-
get_requests(registration.active, 0).then(t.step_func(requests => {
67-
resolve(assert_true(requests.has(call[1] + dangling_resource)));
68-
}));
69-
}));
70-
});
76+
promise_test(async t => {
77+
iframe.contentWindow.eval(call[0]);
78+
const requests = await get_requests(t, registration.active, number_api_calls + 1);
79+
assert_equals(Array.from(requests)[number_api_calls], call[1] + dangling_resource_expected);
80+
number_api_calls++;
7181
}, `Does not block ${call[1]}`);
7282
});
83+
promise_test(async () => {
84+
iframe.remove();
85+
registration.unregister();
86+
}, "Clean up iframe");
7387

7488
async_test(t => {
7589
let url = new URL(location.origin + "/" + dangling_url);

test/fixtures/wpt/interfaces/dom.idl

+12-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Document includes NonElementParentNode;
110110
DocumentFragment includes NonElementParentNode;
111111

112112
interface mixin DocumentOrShadowRoot {
113+
readonly attribute CustomElementRegistry? customElementRegistry;
113114
};
114115
Document includes DocumentOrShadowRoot;
115116
ShadowRoot includes DocumentOrShadowRoot;
@@ -293,7 +294,7 @@ interface Document : Node {
293294
[NewObject] Comment createComment(DOMString data);
294295
[NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
295296

296-
[CEReactions, NewObject] Node importNode(Node node, optional boolean subtree = false);
297+
[CEReactions, NewObject] Node importNode(Node node, optional (boolean or ImportNodeOptions) options = false);
297298
[CEReactions] Node adoptNode(Node node);
298299

299300
[NewObject] Attr createAttribute(DOMString localName);
@@ -312,9 +313,15 @@ interface Document : Node {
312313
interface XMLDocument : Document {};
313314

314315
dictionary ElementCreationOptions {
316+
CustomElementRegistry customElementRegistry;
315317
DOMString is;
316318
};
317319

320+
dictionary ImportNodeOptions {
321+
CustomElementRegistry customElementRegistry;
322+
boolean selfOnly = false;
323+
};
324+
318325
[Exposed=Window]
319326
interface DOMImplementation {
320327
[NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
@@ -344,6 +351,7 @@ interface ShadowRoot : DocumentFragment {
344351
readonly attribute boolean clonable;
345352
readonly attribute boolean serializable;
346353
readonly attribute Element host;
354+
347355
attribute EventHandler onslotchange;
348356
};
349357

@@ -384,6 +392,8 @@ interface Element : Node {
384392
ShadowRoot attachShadow(ShadowRootInit init);
385393
readonly attribute ShadowRoot? shadowRoot;
386394

395+
readonly attribute CustomElementRegistry? customElementRegistry;
396+
387397
Element? closest(DOMString selectors);
388398
boolean matches(DOMString selectors);
389399
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
@@ -402,6 +412,7 @@ dictionary ShadowRootInit {
402412
SlotAssignmentMode slotAssignment = "named";
403413
boolean clonable = false;
404414
boolean serializable = false;
415+
CustomElementRegistry customElementRegistry;
405416
};
406417

407418
[Exposed=Window,

test/fixtures/wpt/interfaces/fedcm.idl

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ dictionary IdentityProviderBranding {
7474

7575
dictionary IdentityProviderAPIConfig {
7676
required USVString accounts_endpoint;
77-
required USVString client_metadata_endpoint;
77+
USVString client_metadata_endpoint;
7878
required USVString id_assertion_endpoint;
7979
required USVString login_url;
8080
USVString disconnect_endpoint;

test/fixtures/wpt/interfaces/html.idl

+4
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ interface HTMLTemplateElement : HTMLElement {
12611261
[CEReactions] attribute boolean shadowRootDelegatesFocus;
12621262
[CEReactions] attribute boolean shadowRootClonable;
12631263
[CEReactions] attribute boolean shadowRootSerializable;
1264+
[CEReactions] attribute DOMString shadowRootCustomElementRegistry;
12641265
};
12651266

12661267
[Exposed=Window]
@@ -1629,11 +1630,14 @@ OffscreenCanvasRenderingContext2D includes CanvasPath;
16291630

16301631
[Exposed=Window]
16311632
interface CustomElementRegistry {
1633+
constructor();
1634+
16321635
[CEReactions] undefined define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {});
16331636
(CustomElementConstructor or undefined) get(DOMString name);
16341637
DOMString? getName(CustomElementConstructor constructor);
16351638
Promise<CustomElementConstructor> whenDefined(DOMString name);
16361639
[CEReactions] undefined upgrade(Node root);
1640+
undefined initialize(Node root);
16371641
};
16381642

16391643
callback CustomElementConstructor = HTMLElement ();

test/fixtures/wpt/interfaces/secure-payment-confirmation.idl

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ dictionary SecurePaymentConfirmationRequest {
1616
boolean showOptOut;
1717
};
1818

19+
enum SecurePaymentConfirmationAvailability {
20+
"available",
21+
"unavailable-unknown-reason",
22+
"unavailable-feature-not-enabled",
23+
"unavailable-no-permission-policy",
24+
"unavailable-no-user-verifying-platform-authenticator",
25+
};
26+
1927
partial interface PaymentRequest {
20-
static Promise<boolean> isSecurePaymentConfirmationAvailable();
28+
static Promise<SecurePaymentConfirmationAvailability> securePaymentConfirmationAvailability();
2129
};
2230

2331
partial dictionary AuthenticationExtensionsClientInputs {

test/fixtures/wpt/interfaces/speech-api.idl

+21-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface SpeechRecognition : EventTarget {
1313
attribute boolean interimResults;
1414
attribute unsigned long maxAlternatives;
1515
attribute SpeechRecognitionMode mode;
16+
attribute SpeechRecognitionPhraseList phrases;
1617

1718
// methods to drive the speech interaction
1819
undefined start();
@@ -43,7 +44,8 @@ enum SpeechRecognitionErrorCode {
4344
"network",
4445
"not-allowed",
4546
"service-not-allowed",
46-
"language-not-supported"
47+
"language-not-supported",
48+
"phrases-not-supported"
4749
};
4850

4951
enum SpeechRecognitionMode {
@@ -106,6 +108,24 @@ dictionary SpeechRecognitionEventInit : EventInit {
106108
required SpeechRecognitionResultList results;
107109
};
108110

111+
// The object representing a phrase for contextual biasing.
112+
[Exposed=Window]
113+
interface SpeechRecognitionPhrase {
114+
constructor(DOMString phrase, optional float boost = 1.0);
115+
readonly attribute DOMString phrase;
116+
readonly attribute float boost;
117+
};
118+
119+
// The object representing a list of phrases for contextual biasing.
120+
[Exposed=Window]
121+
interface SpeechRecognitionPhraseList {
122+
constructor(sequence<SpeechRecognitionPhrase> phrases);
123+
readonly attribute unsigned long length;
124+
SpeechRecognitionPhrase item(unsigned long index);
125+
undefined addItem(SpeechRecognitionPhrase item);
126+
undefined removeItem(unsigned long index);
127+
};
128+
109129
[Exposed=Window]
110130
interface SpeechSynthesis : EventTarget {
111131
readonly attribute boolean pending;

test/fixtures/wpt/resources/chromium/webxr-test.js

+9
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,11 @@ class MockRuntime {
12071207

12081208
this.enabledFeatures_ = enabled_features;
12091209

1210+
let selectedDepthType;
1211+
if (sessionOptions.depthOptions && sessionOptions.depthOptions.depthTypeRequest.length != 0) {
1212+
selectedDepthType = sessionOptions.depthOptions.depthTypeRequest[0];
1213+
}
1214+
12101215
return Promise.resolve({
12111216
session: {
12121217
submitFrameSink: submit_frame_sink,
@@ -1219,9 +1224,12 @@ class MockRuntime {
12191224
depthConfiguration: enabled_features.includes(
12201225
xrSessionMojom.XRSessionFeature.DEPTH) ?
12211226
{
1227+
// TODO(https://crbug.com/409806803): Update support via
1228+
// a webxr-test-api method.
12221229
depthUsage: xrSessionMojom.XRDepthUsage.kCPUOptimized,
12231230
depthDataFormat:
12241231
xrSessionMojom.XRDepthDataFormat.kLuminanceAlpha,
1232+
depthType: selectedDepthType,
12251233
} :
12261234
null,
12271235
views: this._getDefaultViews(),
@@ -1251,6 +1259,7 @@ class MockRuntime {
12511259
switch (feature) {
12521260
case xrSessionMojom.XRSessionFeature.DEPTH:
12531261
// This matches what Chrome can currently support.
1262+
// TODO(https://crbug.com/409806803): Add a webxr-test-api for this.
12541263
return options.depthOptions &&
12551264
(options.depthOptions.usagePreferences.length == 0 ||
12561265
options.depthOptions.usagePreferences.includes(

0 commit comments

Comments
 (0)