Skip to content

Commit 55e55b4

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

15 files changed

+146
-30
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
*/
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(

test/fixtures/wpt/resources/testdriver.js

+51-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@
629629
/**
630630
* Minimizes the browser window.
631631
*
632-
* Matches the the behaviour of the `Minimize
632+
* Matches the behaviour of the `Minimize
633633
* <https://www.w3.org/TR/webdriver/#minimize-window>`_
634634
* WebDriver command
635635
*
@@ -1497,6 +1497,48 @@
14971497
*/
14981498
set_protected_audience_k_anonymity: function(owner, name, hashes, context = null) {
14991499
return window.test_driver_internal.set_protected_audience_k_anonymity(owner, name, hashes, context);
1500+
},
1501+
1502+
/**
1503+
* Overrides the display features provided by the hardware so the viewport segments
1504+
* can be emulated.
1505+
*
1506+
* Matches the `Set display features
1507+
* <https://drafts.csswg.org/css-viewport/#set-display-features>`_
1508+
* WebDriver command.
1509+
*
1510+
* @param {Array} features - An array of `DisplayFeatureOverride
1511+
* <https://drafts.csswg.org/css-viewport/#display-feature-override>`.
1512+
* @param {WindowProxy} [context=null] - Browsing context in which to
1513+
* run the call, or null for the
1514+
* current browsing context.
1515+
*
1516+
* @returns {Promise} Fulfilled when the display features are set.
1517+
* Rejected in case the WebDriver command errors out
1518+
* (including if the array is malformed).
1519+
*/
1520+
set_display_features: function(features, context=null) {
1521+
return window.test_driver_internal.set_display_features(features, context);
1522+
},
1523+
1524+
/**
1525+
* Removes display features override and returns the control
1526+
* back to hardware.
1527+
*
1528+
* Matches the `Clear display features
1529+
* <https://drafts.csswg.org/css-viewport/#clear-display-features>`_
1530+
* WebDriver command.
1531+
*
1532+
* @param {WindowProxy} [context=null] - Browsing context in which to
1533+
* run the call, or null for the
1534+
* current browsing context.
1535+
*
1536+
* @returns {Promise} Fulfilled after the display features override has
1537+
* been removed. Rejected in case the WebDriver
1538+
* command errors out.
1539+
*/
1540+
clear_display_features: function(context=null) {
1541+
return window.test_driver_internal.clear_display_features(context);
15001542
}
15011543
};
15021544

@@ -1758,6 +1800,14 @@
17581800

17591801
async set_protected_audience_k_anonymity(owner, name, hashes, context=null) {
17601802
throw new Error("set_protected_audience_k_anonymity() is not implemented by testdriver-vendor.js");
1803+
},
1804+
1805+
async set_display_features(features, context=null) {
1806+
throw new Error("set_display_features() is not implemented by testdriver-vendor.js");
1807+
},
1808+
1809+
async clear_display_features(context=null) {
1810+
throw new Error("clear_display_features() is not implemented by testdriver-vendor.js");
17611811
}
17621812
};
17631813
})();

test/fixtures/wpt/resources/testharness.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1011,13 +1011,13 @@
10111011
/**
10121012
* Stop listening for events
10131013
*/
1014-
function stop_watching() {
1014+
this.stop_watching = function() {
10151015
for (var i = 0; i < eventTypes.length; i++) {
10161016
watchedNode.removeEventListener(eventTypes[i], eventHandler, false);
10171017
}
10181018
};
10191019

1020-
test._add_cleanup(stop_watching);
1020+
test._add_cleanup(this.stop_watching);
10211021

10221022
return this;
10231023
}

test/fixtures/wpt/service-workers/service-worker/claim-using-registration.https.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
.then(function() {
9898
frame.remove();
9999
});
100-
}, 'Test for the waiting worker claims a client which is using the the ' +
100+
}, 'Test for the waiting worker claims a client which is using the ' +
101101
'same registration');
102102

103103
</script>

test/fixtures/wpt/service-workers/service-worker/resources/testharness-helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// 2.1 |a.p| is weakly equal to |b.p| for all own properties |p| of |a|.
1515
// 2.2 Every own property of |b| is an own property of |a|.
1616
//
17-
// This is a replacement for the the version of assert_object_equals() in
17+
// This is a replacement for the version of assert_object_equals() in
1818
// testharness.js. The latter doesn't handle own properties correctly. I.e. if
1919
// |a.p| is not an own property, it still requires that |b.p| be an own
2020
// property.

0 commit comments

Comments
 (0)