Skip to content

Commit fbdcdb5

Browse files
chore: update WPT (#3634)
Co-authored-by: Uzlopak <[email protected]>
1 parent 29473db commit fbdcdb5

File tree

10 files changed

+112
-18
lines changed

10 files changed

+112
-18
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,39 @@ function keepaliveSimpleRequestTest(method) {
3939
for (const method of ['GET', 'POST']) {
4040
keepaliveSimpleRequestTest(method);
4141
}
42+
43+
// verifies fetch keepalive requests from a worker
44+
function keepaliveSimpleWorkerTest() {
45+
const desc =
46+
`simple keepalive test for web workers`;
47+
promise_test(async (test) => {
48+
const TOKEN = token();
49+
const FRAME_ORIGIN = new URL(location.href).origin;
50+
const TEST_URL = get_host_info().HTTP_ORIGIN + `/fetch/api/resources/stash-put.py?key=${TOKEN}&value=on`
51+
+ `&frame_origin=${FRAME_ORIGIN}`;
52+
// start a worker which sends keepalive request and immediately terminates
53+
const worker = new Worker(`/fetch/api/resources/keepalive-worker.js?param=${TEST_URL}`);
54+
55+
const keepAliveWorkerPromise = new Promise((resolve, reject) => {
56+
worker.onmessage = (event) => {
57+
if (event.data === 'started') {
58+
resolve();
59+
} else {
60+
reject(new Error("Unexpected message received from worker"));
61+
}
62+
};
63+
worker.onerror = (error) => {
64+
reject(error);
65+
};
66+
});
67+
68+
// wait until the worker has been initialized (indicated by the "started" message)
69+
await keepAliveWorkerPromise;
70+
// verifies if the token sent in fetch request has been updated in the server
71+
assertStashedTokenAsync(desc, TOKEN);
72+
73+
}, `${desc};`);
74+
75+
}
76+
77+
keepaliveSimpleWorkerTest();

test/fixtures/wpt/fetch/api/request/request-constructor-init-body-override.any.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,20 @@ promise_test(async function () {
1818
"req2",
1919
"The body of the second request should be overridden to 'req2'."
2020
);
21+
2122
}, "Check that the body of a new request can be overridden when created from an existing Request object");
23+
24+
promise_test(async function () {
25+
const req1 = new Request("https://example.com/", {
26+
body: "req1",
27+
method: "POST",
28+
});
29+
30+
const req2 = new Request("https://example.com/", req1);
31+
const bodyText = await req2.text();
32+
assert_equals(
33+
bodyText,
34+
"req1",
35+
"The body of the second request should be the same as the first."
36+
);
37+
}, "Check that the body of a new request can be duplicated from an existing Request object");
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Script that sends keepalive
3+
* fetch request and terminates immediately.
4+
* The request URL is passed as a parameter to this worker
5+
*/
6+
function sendFetchRequest() {
7+
// Parse the query parameter from the worker's script URL
8+
const urlString = self.location.search.replace("?param=", "");
9+
postMessage('started');
10+
fetch(`${urlString}`, { keepalive: true });
11+
}
12+
13+
sendFetchRequest();
14+
// Terminate the worker
15+
self.close();

test/fixtures/wpt/interfaces/digital-credentials.idl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
// (https://github.com/w3c/webref)
44
// Source: Digital Credentials (https://wicg.github.io/digital-credentials/)
55

6-
partial interface Navigator {
7-
[SecureContext, SameObject] readonly attribute CredentialsContainer identity;
8-
};
9-
106
partial dictionary CredentialRequestOptions {
117
DigitalCredentialRequestOptions digital;
128
};
139

1410
dictionary DigitalCredentialRequestOptions {
15-
sequence<DigitalCredentialsProvider> providers;
11+
sequence<DigitalCredentialsRequest> requests;
1612
};
1713

18-
dictionary DigitalCredentialsProvider {
14+
dictionary DigitalCredentialsRequest {
1915
required DOMString protocol;
20-
required object request;
16+
required object data;
2117
};
2218

2319
[Exposed=Window, SecureContext]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// GENERATED CONTENT - DO NOT EDIT
2+
// Content was automatically extracted by Reffy into webref
3+
// (https://github.com/w3c/webref)
4+
// Source: Media Queries Level 5 (https://drafts.csswg.org/mediaqueries-5/)
5+
6+
[Exposed=Window, SecureContext]
7+
partial interface Navigator {
8+
[SameObject] readonly attribute PreferenceManager preferences;
9+
};
10+
11+
[Exposed=Window, SecureContext]
12+
interface PreferenceManager {
13+
readonly attribute PreferenceObject colorScheme;
14+
readonly attribute PreferenceObject contrast;
15+
readonly attribute PreferenceObject reducedMotion;
16+
readonly attribute PreferenceObject reducedTransparency;
17+
readonly attribute PreferenceObject reducedData;
18+
};
19+
20+
[Exposed=Window, SecureContext]
21+
interface PreferenceObject : EventTarget {
22+
readonly attribute DOMString? override;
23+
readonly attribute DOMString value;
24+
readonly attribute FrozenArray<DOMString> validValues;
25+
26+
undefined clearOverride();
27+
Promise<undefined> requestOverride(DOMString? value);
28+
29+
attribute EventHandler onchange;
30+
};

test/fixtures/wpt/interfaces/webauthn.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ enum ClientCapability {
302302
"signalUnknownCredential"
303303
};
304304

305-
enum PublicKeyCredentialHints {
305+
enum PublicKeyCredentialHint {
306306
"security-key",
307307
"client-device",
308308
"hybrid",

test/fixtures/wpt/interfaces/webhid.idl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
[SameObject] readonly attribute HID hid;
88
};
99

10-
[Exposed=ServiceWorker, SecureContext]
10+
[Exposed=(DedicatedWorker,ServiceWorker), SecureContext]
1111
partial interface WorkerNavigator {
1212
[SameObject] readonly attribute HID hid;
1313
};
1414

15-
[Exposed=(Window,ServiceWorker), SecureContext]
15+
[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext]
1616
interface HID : EventTarget {
1717
attribute EventHandler onconnect;
1818
attribute EventHandler ondisconnect;
@@ -33,7 +33,7 @@ dictionary HIDDeviceFilter {
3333
unsigned short usage;
3434
};
3535

36-
[Exposed=Window, SecureContext]
36+
[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext]
3737
interface HIDDevice : EventTarget {
3838
attribute EventHandler oninputreport;
3939
readonly attribute boolean opened;
@@ -51,7 +51,7 @@ interface HIDDevice : EventTarget {
5151
Promise<DataView> receiveFeatureReport([EnforceRange] octet reportId);
5252
};
5353

54-
[Exposed=Window, SecureContext]
54+
[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext]
5555
interface HIDConnectionEvent : Event {
5656
constructor(DOMString type, HIDConnectionEventInit eventInitDict);
5757
[SameObject] readonly attribute HIDDevice device;
@@ -61,7 +61,7 @@ dictionary HIDConnectionEventInit : EventInit {
6161
required HIDDevice device;
6262
};
6363

64-
[Exposed=Window, SecureContext]
64+
[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext]
6565
interface HIDInputReportEvent : Event {
6666
constructor(DOMString type, HIDInputReportEventInit eventInitDict);
6767
[SameObject] readonly attribute HIDDevice device;

test/fixtures/wpt/interfaces/webnn.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum MLOperandDataType {
9090

9191
dictionary MLOperandDescriptor {
9292
required MLOperandDataType dataType;
93-
sequence<[EnforceRange] unsigned long> dimensions = [];
93+
sequence<[EnforceRange] unsigned long> shape = [];
9494
};
9595

9696
[SecureContext, Exposed=(Window, DedicatedWorker)]

test/fixtures/wpt/interfaces/webtransport.idl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface WebTransport {
2525
readonly attribute WebTransportCongestionControl congestionControl;
2626
[EnforceRange] attribute unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams;
2727
[EnforceRange] attribute unsigned short? anticipatedConcurrentIncomingBidirectionalStreams;
28+
readonly attribute DOMString protocol;
2829

2930
readonly attribute Promise<WebTransportCloseInfo> closed;
3031
readonly attribute Promise<undefined> draining;
@@ -64,6 +65,7 @@ dictionary WebTransportOptions {
6465
WebTransportCongestionControl congestionControl = "default";
6566
[EnforceRange] unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams = null;
6667
[EnforceRange] unsigned short? anticipatedConcurrentIncomingBidirectionalStreams = null;
68+
sequence<DOMString> protocols = [];
6769
};
6870

6971
enum WebTransportCongestionControl {

test/fixtures/wpt/resources/testdriver.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,10 @@
176176
},
177177

178178
/**
179-
* Triggers a user-initiated click
179+
* Triggers a user-initiated mouse click.
180180
*
181-
* If ``element`` isn't inside the
182-
* viewport, it will be scrolled into view before the click
183-
* occurs.
181+
* If ``element`` isn't inside the viewport, it will be
182+
* scrolled into view before the click occurs.
184183
*
185184
* If ``element`` is from a different browsing context, the
186185
* command will be run in that context.

0 commit comments

Comments
 (0)