Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WPT #3634

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/fixtures/wpt/fetch/api/basic/keepalive.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -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");
15 changes: 15 additions & 0 deletions test/fixtures/wpt/fetch/api/resources/keepalive-worker.js
Original file line number Diff line number Diff line change
@@ -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();
10 changes: 3 additions & 7 deletions test/fixtures/wpt/interfaces/digital-credentials.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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<DigitalCredentialsProvider> providers;
sequence<DigitalCredentialsRequest> requests;
};

dictionary DigitalCredentialsProvider {
dictionary DigitalCredentialsRequest {
required DOMString protocol;
required object request;
required object data;
};

[Exposed=Window, SecureContext]
Expand Down
30 changes: 30 additions & 0 deletions test/fixtures/wpt/interfaces/mediaqueries-5.idl
Original file line number Diff line number Diff line change
@@ -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<DOMString> validValues;

undefined clearOverride();
Promise<undefined> requestOverride(DOMString? value);

attribute EventHandler onchange;
};
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/webauthn.idl
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ enum ClientCapability {
"signalUnknownCredential"
};

enum PublicKeyCredentialHints {
enum PublicKeyCredentialHint {
"security-key",
"client-device",
"hybrid",
Expand Down
10 changes: 5 additions & 5 deletions test/fixtures/wpt/interfaces/webhid.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -51,7 +51,7 @@ interface HIDDevice : EventTarget {
Promise<DataView> 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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/webnn.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/wpt/interfaces/webtransport.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebTransportCloseInfo> closed;
readonly attribute Promise<undefined> draining;
Expand Down Expand Up @@ -64,6 +65,7 @@ dictionary WebTransportOptions {
WebTransportCongestionControl congestionControl = "default";
[EnforceRange] unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams = null;
[EnforceRange] unsigned short? anticipatedConcurrentIncomingBidirectionalStreams = null;
sequence<DOMString> protocols = [];
};

enum WebTransportCongestionControl {
Expand Down
7 changes: 3 additions & 4 deletions test/fixtures/wpt/resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading