From fbdcdb5fd1ed69a0b8a3fb8444ff0e2ac9755e63 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:35:20 -0400 Subject: [PATCH] chore: update WPT (#3634) Co-authored-by: Uzlopak <5059100+Uzlopak@users.noreply.github.com> --- .../wpt/fetch/api/basic/keepalive.any.js | 36 +++++++++++++++++++ ...uest-constructor-init-body-override.any.js | 16 +++++++++ .../fetch/api/resources/keepalive-worker.js | 15 ++++++++ .../wpt/interfaces/digital-credentials.idl | 10 ++---- .../wpt/interfaces/mediaqueries-5.idl | 30 ++++++++++++++++ test/fixtures/wpt/interfaces/webauthn.idl | 2 +- test/fixtures/wpt/interfaces/webhid.idl | 10 +++--- test/fixtures/wpt/interfaces/webnn.idl | 2 +- test/fixtures/wpt/interfaces/webtransport.idl | 2 ++ test/fixtures/wpt/resources/testdriver.js | 7 ++-- 10 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 test/fixtures/wpt/fetch/api/resources/keepalive-worker.js create mode 100644 test/fixtures/wpt/interfaces/mediaqueries-5.idl diff --git a/test/fixtures/wpt/fetch/api/basic/keepalive.any.js b/test/fixtures/wpt/fetch/api/basic/keepalive.any.js index 55225e00aa0..d4e831b9631 100644 --- a/test/fixtures/wpt/fetch/api/basic/keepalive.any.js +++ b/test/fixtures/wpt/fetch/api/basic/keepalive.any.js @@ -39,3 +39,39 @@ function keepaliveSimpleRequestTest(method) { for (const method of ['GET', 'POST']) { keepaliveSimpleRequestTest(method); } + +// verifies fetch keepalive requests from a worker +function keepaliveSimpleWorkerTest() { + const desc = + `simple keepalive test for web workers`; + promise_test(async (test) => { + const TOKEN = token(); + const FRAME_ORIGIN = new URL(location.href).origin; + const TEST_URL = get_host_info().HTTP_ORIGIN + `/fetch/api/resources/stash-put.py?key=${TOKEN}&value=on` + + `&frame_origin=${FRAME_ORIGIN}`; + // start a worker which sends keepalive request and immediately terminates + const worker = new Worker(`/fetch/api/resources/keepalive-worker.js?param=${TEST_URL}`); + + const keepAliveWorkerPromise = new Promise((resolve, reject) => { + worker.onmessage = (event) => { + if (event.data === 'started') { + resolve(); + } else { + reject(new Error("Unexpected message received from worker")); + } + }; + worker.onerror = (error) => { + reject(error); + }; + }); + + // wait until the worker has been initialized (indicated by the "started" message) + await keepAliveWorkerPromise; + // verifies if the token sent in fetch request has been updated in the server + assertStashedTokenAsync(desc, TOKEN); + + }, `${desc};`); + +} + +keepaliveSimpleWorkerTest(); diff --git a/test/fixtures/wpt/fetch/api/request/request-constructor-init-body-override.any.js b/test/fixtures/wpt/fetch/api/request/request-constructor-init-body-override.any.js index 27bb991871a..c2bbf86f304 100644 --- a/test/fixtures/wpt/fetch/api/request/request-constructor-init-body-override.any.js +++ b/test/fixtures/wpt/fetch/api/request/request-constructor-init-body-override.any.js @@ -18,4 +18,20 @@ promise_test(async function () { "req2", "The body of the second request should be overridden to 'req2'." ); + }, "Check that the body of a new request can be overridden when created from an existing Request object"); + +promise_test(async function () { + const req1 = new Request("https://example.com/", { + body: "req1", + method: "POST", + }); + + const req2 = new Request("https://example.com/", req1); + const bodyText = await req2.text(); + assert_equals( + bodyText, + "req1", + "The body of the second request should be the same as the first." + ); +}, "Check that the body of a new request can be duplicated from an existing Request object"); diff --git a/test/fixtures/wpt/fetch/api/resources/keepalive-worker.js b/test/fixtures/wpt/fetch/api/resources/keepalive-worker.js new file mode 100644 index 00000000000..0808601d0d9 --- /dev/null +++ b/test/fixtures/wpt/fetch/api/resources/keepalive-worker.js @@ -0,0 +1,15 @@ +/** +* Script that sends keepalive +* fetch request and terminates immediately. +* The request URL is passed as a parameter to this worker +*/ +function sendFetchRequest() { + // Parse the query parameter from the worker's script URL + const urlString = self.location.search.replace("?param=", ""); + postMessage('started'); + fetch(`${urlString}`, { keepalive: true }); +} + +sendFetchRequest(); +// Terminate the worker +self.close(); diff --git a/test/fixtures/wpt/interfaces/digital-credentials.idl b/test/fixtures/wpt/interfaces/digital-credentials.idl index a12ce5a2ba2..2207b25dd57 100644 --- a/test/fixtures/wpt/interfaces/digital-credentials.idl +++ b/test/fixtures/wpt/interfaces/digital-credentials.idl @@ -3,21 +3,17 @@ // (https://github.com/w3c/webref) // Source: Digital Credentials (https://wicg.github.io/digital-credentials/) -partial interface Navigator { - [SecureContext, SameObject] readonly attribute CredentialsContainer identity; -}; - partial dictionary CredentialRequestOptions { DigitalCredentialRequestOptions digital; }; dictionary DigitalCredentialRequestOptions { - sequence providers; + sequence requests; }; -dictionary DigitalCredentialsProvider { +dictionary DigitalCredentialsRequest { required DOMString protocol; - required object request; + required object data; }; [Exposed=Window, SecureContext] diff --git a/test/fixtures/wpt/interfaces/mediaqueries-5.idl b/test/fixtures/wpt/interfaces/mediaqueries-5.idl new file mode 100644 index 00000000000..52154c96725 --- /dev/null +++ b/test/fixtures/wpt/interfaces/mediaqueries-5.idl @@ -0,0 +1,30 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Media Queries Level 5 (https://drafts.csswg.org/mediaqueries-5/) + +[Exposed=Window, SecureContext] +partial interface Navigator { + [SameObject] readonly attribute PreferenceManager preferences; +}; + +[Exposed=Window, SecureContext] +interface PreferenceManager { + readonly attribute PreferenceObject colorScheme; + readonly attribute PreferenceObject contrast; + readonly attribute PreferenceObject reducedMotion; + readonly attribute PreferenceObject reducedTransparency; + readonly attribute PreferenceObject reducedData; +}; + +[Exposed=Window, SecureContext] +interface PreferenceObject : EventTarget { + readonly attribute DOMString? override; + readonly attribute DOMString value; + readonly attribute FrozenArray validValues; + + undefined clearOverride(); + Promise requestOverride(DOMString? value); + + attribute EventHandler onchange; +}; diff --git a/test/fixtures/wpt/interfaces/webauthn.idl b/test/fixtures/wpt/interfaces/webauthn.idl index b4c0c2de603..2b855144650 100644 --- a/test/fixtures/wpt/interfaces/webauthn.idl +++ b/test/fixtures/wpt/interfaces/webauthn.idl @@ -302,7 +302,7 @@ enum ClientCapability { "signalUnknownCredential" }; -enum PublicKeyCredentialHints { +enum PublicKeyCredentialHint { "security-key", "client-device", "hybrid", diff --git a/test/fixtures/wpt/interfaces/webhid.idl b/test/fixtures/wpt/interfaces/webhid.idl index 03e72511d96..56e3161caed 100644 --- a/test/fixtures/wpt/interfaces/webhid.idl +++ b/test/fixtures/wpt/interfaces/webhid.idl @@ -7,12 +7,12 @@ [SameObject] readonly attribute HID hid; }; -[Exposed=ServiceWorker, SecureContext] +[Exposed=(DedicatedWorker,ServiceWorker), SecureContext] partial interface WorkerNavigator { [SameObject] readonly attribute HID hid; }; -[Exposed=(Window,ServiceWorker), SecureContext] +[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] interface HID : EventTarget { attribute EventHandler onconnect; attribute EventHandler ondisconnect; @@ -33,7 +33,7 @@ dictionary HIDDeviceFilter { unsigned short usage; }; -[Exposed=Window, SecureContext] +[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] interface HIDDevice : EventTarget { attribute EventHandler oninputreport; readonly attribute boolean opened; @@ -51,7 +51,7 @@ interface HIDDevice : EventTarget { Promise receiveFeatureReport([EnforceRange] octet reportId); }; -[Exposed=Window, SecureContext] +[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] interface HIDConnectionEvent : Event { constructor(DOMString type, HIDConnectionEventInit eventInitDict); [SameObject] readonly attribute HIDDevice device; @@ -61,7 +61,7 @@ dictionary HIDConnectionEventInit : EventInit { required HIDDevice device; }; -[Exposed=Window, SecureContext] +[Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] interface HIDInputReportEvent : Event { constructor(DOMString type, HIDInputReportEventInit eventInitDict); [SameObject] readonly attribute HIDDevice device; diff --git a/test/fixtures/wpt/interfaces/webnn.idl b/test/fixtures/wpt/interfaces/webnn.idl index f8db7b0d542..9a71f73954c 100644 --- a/test/fixtures/wpt/interfaces/webnn.idl +++ b/test/fixtures/wpt/interfaces/webnn.idl @@ -90,7 +90,7 @@ enum MLOperandDataType { dictionary MLOperandDescriptor { required MLOperandDataType dataType; - sequence<[EnforceRange] unsigned long> dimensions = []; + sequence<[EnforceRange] unsigned long> shape = []; }; [SecureContext, Exposed=(Window, DedicatedWorker)] diff --git a/test/fixtures/wpt/interfaces/webtransport.idl b/test/fixtures/wpt/interfaces/webtransport.idl index 2136cad41e3..6e9d1036736 100644 --- a/test/fixtures/wpt/interfaces/webtransport.idl +++ b/test/fixtures/wpt/interfaces/webtransport.idl @@ -25,6 +25,7 @@ interface WebTransport { readonly attribute WebTransportCongestionControl congestionControl; [EnforceRange] attribute unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams; [EnforceRange] attribute unsigned short? anticipatedConcurrentIncomingBidirectionalStreams; + readonly attribute DOMString protocol; readonly attribute Promise closed; readonly attribute Promise draining; @@ -64,6 +65,7 @@ dictionary WebTransportOptions { WebTransportCongestionControl congestionControl = "default"; [EnforceRange] unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams = null; [EnforceRange] unsigned short? anticipatedConcurrentIncomingBidirectionalStreams = null; + sequence protocols = []; }; enum WebTransportCongestionControl { diff --git a/test/fixtures/wpt/resources/testdriver.js b/test/fixtures/wpt/resources/testdriver.js index b873b5c616a..d05be1d7df9 100644 --- a/test/fixtures/wpt/resources/testdriver.js +++ b/test/fixtures/wpt/resources/testdriver.js @@ -176,11 +176,10 @@ }, /** - * Triggers a user-initiated click + * Triggers a user-initiated mouse click. * - * If ``element`` isn't inside the - * viewport, it will be scrolled into view before the click - * occurs. + * If ``element`` isn't inside the viewport, it will be + * scrolled into view before the click occurs. * * If ``element`` is from a different browsing context, the * command will be run in that context.