Skip to content

Commit

Permalink
Merge branch 'main' into less-flaky-fast-timers-test
Browse files Browse the repository at this point in the history
  • Loading branch information
metcoder95 authored Oct 1, 2024
2 parents e442d54 + 2d524cf commit ca3ea8d
Show file tree
Hide file tree
Showing 16 changed files with 292 additions and 63 deletions.
4 changes: 4 additions & 0 deletions lib/mock/mock-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ function matchKey (mockDispatch, { path, method, body, headers }) {
function getResponseData (data) {
if (Buffer.isBuffer(data)) {
return data
} else if (data instanceof Uint8Array) {
return data
} else if (data instanceof ArrayBuffer) {
return data
} else if (typeof data === 'object') {
return JSON.stringify(data)
} else {
Expand Down
46 changes: 32 additions & 14 deletions test/fixtures/ca.pem
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
-----BEGIN CERTIFICATE-----
MIIChDCCAe2gAwIBAgIJAMsVOuISYJ/GMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV
BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu
dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB
FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjBaGA8yMjkyMDgzMDE4
NDIyMFowejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP
MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTEx
IDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3DQEB
AQUAA4GNADCBiQKBgQDrNdKjVKhbxKbrDRLdy45u9vsU3IH8C3qFcLF5wqf+g7OC
vMOOrFDM6mL5iYwuYaLRvAtsC0mtGPzBGyFflxGhiBYaOhi7nCKEsUkFuNYlCzX+
FflT04JYT3qWPLL7rT32GXpABND/8DEn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V5
QTbRgaKiDW4SmqTu4++VOeHKp3pjm9UyFHB1jrPxJbm+P2lLn41n7LUU7Q35ce8D
xBoDu3SIeoaF/e54+o4Pn0WDjs0zTV4YDMI2Zkt/QK5fLPx0VQBrxDl4MkcN7DnC
1UV2bT78VPpeGn8=
-----END CERTIFICATE-----
47 changes: 31 additions & 16 deletions test/fixtures/cert.pem
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIC2DCCAkGgAwIBAgIJAOzJuFYnDamoMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV
BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu
dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB
FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4
NDIyMVowfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP
MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQDDAZhZ2Vu
dDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3
DQEBAQUAA4GNADCBiQKBgQDvVEBwFjfiirsDjlZB+CjYNMNCqdJe27hqK/b72AnL
jgN6mLcXCOABJC5N61TGFkiF9Zndh6IyFXRZVb4gQX4zxNDRuAydo95BmiYHGV0v
t1ZXsLv7XrfQu6USLRtpZMe1cNULjsAB7raN+1hEN1CPMSmSjWc7MKPgv09QYJ5j
cQIDAQABo2EwXzBdBggrBgEFBQcBAQRRME8wIwYIKwYBBQUHMAGGF2h0dHA6Ly9v
Y3NwLm5vZGVqcy5vcmcvMCgGCCsGAQUFBzAChhxodHRwOi8vY2Eubm9kZWpzLm9y
Zy9jYS5jZXJ0MA0GCSqGSIb3DQE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THWo1XrzKhTNB4tLPSXa6AcRYLEHpU0kbZyTC2La9zwyHVCnPMbn
-----END CERTIFICATE-----
67 changes: 52 additions & 15 deletions test/fixtures/key.pem
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDvVEBwFjfiirsDjlZB+CjYNMNCqdJe27hqK/b72AnLjgN6mLcX
COABJC5N61TGFkiF9Zndh6IyFXRZVb4gQX4zxNDRuAydo95BmiYHGV0vt1ZXsLv7
XrfQu6USLRtpZMe1cNULjsAB7raN+1hEN1CPMSmSjWc7MKPgv09QYJ5jcQIDAQAB
AoGAbqk3TlyHpKFfDarf6Yr0X9wtuQJK+n+ACt+fSR3AkbVtmF9KsUTyRrTTEEZT
IXCmQgKpDYysi5nt/WyvB70gu6xGYbT6PzZaf1RmcpWd1pLcdyBOppY6y7nTMZA3
BVFfmIPSmAvtCuzZwQFFnNoKH3d6cqna+ZQJ0zvCLCSLcw0CQQD6tswNlhCIfguh
tvhw7hJB5vZPWWEzyTQl8nVdY6SbxAT8FTx0UjxsKgOiJFzAGAVoCi40oRKIHhrw
pKwHsEqTAkEA9GABbi2xqAmhPn66e0AiU8t2uv69PISBSt2tXbUAburJFj+4rYZW
71QIbSKEYceveb7wm0NP+adgZqJlxn7oawJBAOjfK4+fCIJPWWx+8Cqs5yZxae1w
HrokNBzfJSZ2bCoGm36uFvYQgHETYUaUsdX3OeZWNm7KAdWO6QUGX4fQtqMCQGXv
OgmEY+utAKZ55D2PFgKQB1me8r6wouHgr/U7kA+0Peba86TmOZMhIVaspD3JNqf4
/pI1NMH1kF+fdAalXzsCQQCelwr9I3FWhx336CWrfAY20xbiMOWMyAhrjVrexgUD
53Y6AhSaRC725pZTgO2PQ4AjkGLIP61sZKgTrXS85KmJ
-----END RSA PRIVATE KEY-----
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCwNx4WYcYywr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alive.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
Loading

0 comments on commit ca3ea8d

Please sign in to comment.