Skip to content

Commit

Permalink
chore: update WPT (#3838)
Browse files Browse the repository at this point in the history
Co-authored-by: Uzlopak <5059100+Uzlopak@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and Uzlopak authored Nov 25, 2024
1 parent 55ad16f commit 6ef1763
Show file tree
Hide file tree
Showing 17 changed files with 417 additions and 82 deletions.
1 change: 1 addition & 0 deletions test/fixtures/wpt/eventsource/META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ suggested_reviewers:
- odinho
- Yaffle
- annevk
- rexxars
52 changes: 29 additions & 23 deletions test/fixtures/wpt/fetch/fetch-later/quota.tentative.https.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

'use strict';

const kQuotaPerOrigin = 64 * 1024; // 64 kilobytes per spec.
const QUOTA_PER_ORIGIN = 64 * 1024; // 64 kilobytes per spec.
const {ORIGIN, HTTPS_NOTSAMESITE_ORIGIN} = get_host_info();
const TEST_ENDPOINT = '/fetch-later';

// Runs a test case that cover a single fetchLater() call with `body` in its
// request payload. The call is not expected to throw any errors.
function fetchLaterPostTest(body, description) {
test(() => {
const controller = new AbortController();
const result = fetchLater(
'/fetch-later',
{method: 'POST', signal: controller.signal, body: body});
TEST_ENDPOINT, {method: 'POST', signal: controller.signal, body: body});
assert_false(result.activated);
// Release quota taken by the pending request for subsequent tests.
controller.abort();
Expand All @@ -30,19 +30,25 @@ for (const [dataType, skipCharset] of Object.entries(
}

// Test various size of payloads for the same origin.
for (const dataType in BeaconDataType) {
if (dataType !== BeaconDataType.FormData &&
dataType !== BeaconDataType.URLSearchParams) {
// Skips FormData & URLSearchParams, as browser adds extra bytes to them
// in addition to the user-provided content. It is difficult to test a
// request right at the quota limit.
fetchLaterPostTest(
// Generates data that is exactly 64 kilobytes.
makeBeaconData(generatePayload(kQuotaPerOrigin), dataType),
`A single fetchLater() call takes up the per-origin quota for its ` +
`body of ${dataType}.`);
}
}

// Test max possible size of payload.
// Length of absolute URL to the endpoint.
const POST_TEST_REQUEST_URL_SIZE = (ORIGIN + TEST_ENDPOINT).length;
// Total size of the request header.
const POST_TEST_REQUEST_HEADER_SIZE = 36;
// Runs this test only for String type beacon, as browser adds extra bytes to
// body for some other types (FormData & URLSearchParams), and the request
// header sizes varies for every other types. It is difficult to test a request
// right at the quota limit.
fetchLaterPostTest(
// Generates data that is exactly 64 kilobytes.
makeBeaconData(
generatePayload(
QUOTA_PER_ORIGIN - POST_TEST_REQUEST_URL_SIZE -
POST_TEST_REQUEST_HEADER_SIZE),
BeaconDataType.String),
`A single fetchLater() call takes up the per-origin quota for its ` +
`body of String.`);

// Test empty payload.
for (const dataType in BeaconDataType) {
Expand All @@ -64,8 +70,8 @@ for (const dataType in BeaconDataType) {
() => fetchLater('/fetch-later', {
method: 'POST',
// Generates data that exceeds 64 kilobytes.
body:
makeBeaconData(generatePayload(kQuotaPerOrigin + 1), dataType)
body: makeBeaconData(
generatePayload(QUOTA_PER_ORIGIN + 1), dataType)
}));
},
`A single fetchLater() call is not allowed to exceed per-origin quota ` +
Expand All @@ -81,7 +87,7 @@ for (const dataType in BeaconDataType) {
fetchLater('/fetch-later', {
method: 'POST',
signal: controller.signal,
body: makeBeaconData(generatePayload(kQuotaPerOrigin / 2), dataType)
body: makeBeaconData(generatePayload(QUOTA_PER_ORIGIN / 2), dataType)
});

// Makes the 2nd call that sends half+1 of allowed quota.
Expand All @@ -90,7 +96,7 @@ for (const dataType in BeaconDataType) {
method: 'POST',
signal: controller.signal,
body: makeBeaconData(
generatePayload(kQuotaPerOrigin / 2 + 1), dataType)
generatePayload(QUOTA_PER_ORIGIN / 2 + 1), dataType)
});
});
// Release quota taken by the pending requests for subsequent tests.
Expand All @@ -109,16 +115,16 @@ for (const dataType in BeaconDataType) {
fetchLater('/fetch-later', {
method: 'POST',
signal: controller.signal,
body: makeBeaconData(generatePayload(kQuotaPerOrigin / 2), dataType)
body: makeBeaconData(generatePayload(QUOTA_PER_ORIGIN / 2), dataType)
});

// Makes the 2nd call that sends half+1 of allowed quota, but to a
// different origin.
fetchLater(`${HTTPS_NOTSAMESITE_ORIGIN}/fetch-later`, {
method: 'POST',
signal: controller.signal,
body:
makeBeaconData(generatePayload(kQuotaPerOrigin / 2 + 1), dataType)
body: makeBeaconData(
generatePayload(QUOTA_PER_ORIGIN / 2 + 1), dataType)
});
// Release quota taken by the pending requests for subsequent tests.
controller.abort();
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/wpt/interfaces/attribution-reporting-api.idl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface mixin HTMLAttributionSrcElementUtils {
};

HTMLAnchorElement includes HTMLAttributionSrcElementUtils;
HTMLAreaElement includes HTMLAttributionSrcElementUtils;
HTMLImageElement includes HTMLAttributionSrcElementUtils;
HTMLScriptElement includes HTMLAttributionSrcElementUtils;

Expand Down
16 changes: 14 additions & 2 deletions test/fixtures/wpt/interfaces/fedcm.idl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ enum IdentityCredentialRequestOptionsContext {
"continue"
};

enum IdentityCredentialRequestOptionsMode {
"active",
"passive"
};

dictionary IdentityCredentialRequestOptions {
required sequence<IdentityProviderRequestOptions> providers;
IdentityCredentialRequestOptionsContext context = "signin";
IdentityCredentialRequestOptionsMode mode = "passive";
};

dictionary IdentityProviderConfig {
Expand Down Expand Up @@ -85,8 +91,9 @@ dictionary IdentityProviderAccountList {
sequence<IdentityProviderAccount> accounts;
};

dictionary IdentityProviderToken {
required USVString token;
dictionary IdentityAssertionResponse {
USVString token;
USVString continue_on;
};

dictionary IdentityProviderClientMetadata {
Expand All @@ -101,7 +108,12 @@ dictionary IdentityUserInfo {
USVString picture;
};

dictionary IdentityResolveOptions {
USVString accountId;
};

[Exposed=Window, SecureContext] interface IdentityProvider {
static undefined close();
static undefined resolve(DOMString token, optional IdentityResolveOptions options = {});
static Promise<sequence<IdentityUserInfo>> getUserInfo(IdentityProviderConfig config);
};
1 change: 1 addition & 0 deletions test/fixtures/wpt/interfaces/fenced-frame.idl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ interface Fence {
undefined reportEvent(optional ReportEventType event = {});
undefined setReportEventDataForAutomaticBeacons(optional FenceEvent event = {});
sequence<FencedFrameConfig> getNestedConfigs();
Promise<undefined> disableUntrustedNetwork();
undefined notifyEvent(Event event);
};

Expand Down
12 changes: 10 additions & 2 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,20 @@ interface HTMLElement : Element {
ElementInternals attachInternals();

// The popover API
undefined showPopover();
undefined showPopover(optional ShowPopoverOptions options = {});
undefined hidePopover();
boolean togglePopover(optional boolean force);
boolean togglePopover(optional (TogglePopoverOptions or boolean) options = {});
[CEReactions] attribute DOMString? popover;
};

dictionary ShowPopoverOptions {
HTMLElement source;
};

dictionary TogglePopoverOptions : ShowPopoverOptions {
boolean force;
};

HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/wpt/interfaces/paint-timing.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
// (https://github.com/w3c/webref)
// Source: Paint Timing (https://w3c.github.io/paint-timing/)

[Exposed=Window]
interface mixin PaintTimingMixin {
readonly attribute DOMHighResTimeStamp paintTime;
readonly attribute DOMHighResTimeStamp? presentationTime;
};

[Exposed=Window]
interface PerformancePaintTiming : PerformanceEntry {};
PerformancePaintTiming includes PaintTimingMixin;
6 changes: 3 additions & 3 deletions test/fixtures/wpt/interfaces/shared-storage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

typedef (USVString or FencedFrameConfig) SharedStorageResponse;

enum SharedStorageDataOrigin { "context-origin", "script-origin" };

[Exposed=(Window)]
interface SharedStorageWorklet : Worklet {
Promise<SharedStorageResponse> selectURL(DOMString name,
Expand All @@ -25,6 +23,8 @@ interface SharedStorageWorkletGlobalScope : WorkletGlobalScope {

readonly attribute SharedStorage sharedStorage;
readonly attribute PrivateAggregation privateAggregation;

Promise<sequence<StorageInterestGroup>> interestGroups();
};

dictionary SharedStorageUrlWithMetadata {
Expand Down Expand Up @@ -93,7 +93,7 @@ dictionary SharedStorageRunOperationMethodOptions {
};

dictionary SharedStorageWorkletOptions : WorkletOptions {
SharedStorageDataOrigin dataOrigin = "context-origin";
USVString dataOrigin = "context-origin";
};

interface mixin HTMLSharedStorageWritableElementUtils {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/web-animations-2.idl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial interface AnimationTimeline {
partial interface Animation {
attribute CSSNumberish? startTime;
attribute CSSNumberish? currentTime;
readonly attribute double? progress;
readonly attribute double? overallProgress;
};

[Exposed=Window]
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/wpt/interfaces/webauthn.idl
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ partial dictionary AuthenticationExtensionsClientInputs {

dictionary CredentialPropertiesOutput {
boolean rk;
DOMString authenticatorDisplayName;
};

partial dictionary AuthenticationExtensionsClientOutputs {
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/wpt/interfaces/webgpu.idl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ interface GPU {
};

dictionary GPURequestAdapterOptions {
DOMString featureLevel;
DOMString featureLevel = "core";
GPUPowerPreference powerPreference;
boolean forceFallbackAdapter = false;
boolean xrCompatible = false;
};

enum GPUPowerPreference {
Expand Down Expand Up @@ -128,6 +129,7 @@ enum GPUFeatureName {
interface GPUDevice : EventTarget {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
[SameObject] readonly attribute GPUAdapterInfo adapterInfo;

[SameObject] readonly attribute GPUQueue queue;

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/wpt/interfaces/webrtc-stats.idl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats {
unsigned long long retransmittedBytesReceived;
unsigned long rtxSsrc;
unsigned long fecSsrc;
double totalCorruptionProbability;
double totalSquaredCorruptionProbability;
unsigned long long corruptionMeasurements;
};

dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats {
Expand Down
47 changes: 19 additions & 28 deletions test/fixtures/wpt/resources/idlharness-shadowrealm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* global shadowRealmEvalAsync */

// requires /resources/idlharness-shadowrealm-outer.js

// TODO: it would be nice to support `idl_array.add_objects`
function fetch_text(url) {
return fetch(url).then(function (r) {
Expand All @@ -23,38 +27,25 @@ function fetch_text(url) {
function idl_test_shadowrealm(srcs, deps) {
promise_setup(async t => {
const realm = new ShadowRealm();
// https://github.com/web-platform-tests/wpt/issues/31996
realm.evaluate("globalThis.self = globalThis; undefined;");

realm.evaluate(`
globalThis.self.GLOBAL = {
isWindow: function() { return false; },
isWorker: function() { return false; },
isShadowRealm: function() { return true; },
}; undefined;
`);
const specs = await Promise.all(srcs.concat(deps).map(spec => {
return fetch_text("/interfaces/" + spec + ".idl");
}));
const idls = JSON.stringify(specs);
await new Promise(
realm.evaluate(`(resolve,reject) => {
(async () => {
await import("/resources/testharness.js");
await import("/resources/WebIDLParser.js");
await import("/resources/idlharness.js");
const idls = ${idls};
const idl_array = new IdlArray();
for (let i = 0; i < ${srcs.length}; i++) {
idl_array.add_idls(idls[i]);
}
for (let i = ${srcs.length}; i < ${srcs.length + deps.length}; i++) {
idl_array.add_dependency_idls(idls[i]);
}
idl_array.test();
})().then(resolve, (e) => reject(e.toString()));
}`)
);
await shadowRealmEvalAsync(realm, `
await import("/resources/testharness-shadowrealm-inner.js");
await import("/resources/testharness.js");
await import("/resources/WebIDLParser.js");
await import("/resources/idlharness.js");
const idls = ${idls};
const idl_array = new IdlArray();
for (let i = 0; i < ${srcs.length}; i++) {
idl_array.add_idls(idls[i]);
}
for (let i = ${srcs.length}; i < ${srcs.length + deps.length}; i++) {
idl_array.add_dependency_idls(idls[i]);
}
idl_array.test();
`);
await fetch_tests_from_shadow_realm(realm);
});
}
Expand Down
Loading

0 comments on commit 6ef1763

Please sign in to comment.