Skip to content

Commit 19ea02d

Browse files
Uzlopakgithub-actions[bot]
authored andcommitted
chore: update WPT
1 parent ee752e7 commit 19ea02d

File tree

10 files changed

+103
-66
lines changed

10 files changed

+103
-66
lines changed

test/fixtures/wpt/interfaces/compute-pressure.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// (https://github.com/w3c/webref)
44
// Source: Compute Pressure Level 1 (https://w3c.github.io/compute-pressure/)
55

6-
enum PressureSource { "thermals", "cpu" };
6+
enum PressureSource { "cpu" };
77

88
enum PressureState { "nominal", "fair", "serious", "critical" };
99

test/fixtures/wpt/interfaces/fedcm.idl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ dictionary IdentityProviderRequestOptions : IdentityProviderConfig {
5353
};
5454

5555
dictionary IdentityProviderWellKnown {
56-
required sequence<USVString> provider_urls;
56+
sequence<USVString> provider_urls;
57+
USVString accounts_endpoint;
58+
USVString login_url;
5759
};
5860

5961
dictionary IdentityProviderIcon {

test/fixtures/wpt/interfaces/html.idl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,6 +2520,11 @@ interface MessageChannel {
25202520
readonly attribute MessagePort port2;
25212521
};
25222522

2523+
interface mixin MessageEventTarget {
2524+
attribute EventHandler onmessage;
2525+
attribute EventHandler onmessageerror;
2526+
};
2527+
25232528
[Exposed=(Window,Worker,AudioWorklet), Transferable]
25242529
interface MessagePort : EventTarget {
25252530
undefined postMessage(any message, sequence<object> transfer);
@@ -2528,11 +2533,11 @@ interface MessagePort : EventTarget {
25282533
undefined close();
25292534

25302535
// event handlers
2531-
attribute EventHandler onmessage;
2532-
attribute EventHandler onmessageerror;
25332536
attribute EventHandler onclose;
25342537
};
25352538

2539+
MessagePort includes MessageEventTarget;
2540+
25362541
dictionary StructuredSerializeOptions {
25372542
sequence<object> transfer = [];
25382543
};
@@ -2571,11 +2576,10 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
25712576
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
25722577

25732578
undefined close();
2574-
2575-
attribute EventHandler onmessage;
2576-
attribute EventHandler onmessageerror;
25772579
};
25782580

2581+
DedicatedWorkerGlobalScope includes MessageEventTarget;
2582+
25792583
[Global=(Worker,SharedWorker),Exposed=SharedWorker]
25802584
interface SharedWorkerGlobalScope : WorkerGlobalScope {
25812585
[Replaceable] readonly attribute DOMString name;
@@ -2597,8 +2601,6 @@ interface Worker : EventTarget {
25972601

25982602
undefined postMessage(any message, sequence<object> transfer);
25992603
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
2600-
attribute EventHandler onmessage;
2601-
attribute EventHandler onmessageerror;
26022604
};
26032605

26042606
dictionary WorkerOptions {
@@ -2610,6 +2612,7 @@ dictionary WorkerOptions {
26102612
enum WorkerType { "classic", "module" };
26112613

26122614
Worker includes AbstractWorker;
2615+
Worker includes MessageEventTarget;
26132616

26142617
[Exposed=Window]
26152618
interface SharedWorker : EventTarget {

test/fixtures/wpt/interfaces/long-animation-frames.idl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ interface PerformanceLongAnimationFrameTiming : PerformanceEntry {
1919
[Default] object toJSON();
2020
};
2121

22+
PerformanceLongAnimationFrameTiming includes PaintTimingMixin;
23+
2224
enum ScriptInvokerType {
2325
"classic-script",
2426
"module-script",

test/fixtures/wpt/interfaces/webnn.idl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface ML {
3333
};
3434

3535
typedef record<USVString, ArrayBufferView> MLNamedArrayBufferViews;
36+
typedef record<USVString, MLTensor> MLNamedTensors;
3637

3738
dictionary MLComputeResult {
3839
MLNamedArrayBufferViews inputs;
@@ -41,8 +42,17 @@ dictionary MLComputeResult {
4142

4243
[SecureContext, Exposed=(Window, DedicatedWorker)]
4344
interface MLContext {
45+
// ISSUE(791): compute() will soon be removed in favor of dispatch().
4446
Promise<MLComputeResult> compute(
4547
MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
48+
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);
49+
50+
Promise<MLTensor> createTensor(MLTensorDescriptor descriptor);
51+
52+
Promise<ArrayBuffer> readTensor(MLTensor tensor);
53+
Promise<undefined> readTensor(MLTensor tensor, AllowSharedBufferSource outputData);
54+
55+
undefined writeTensor(MLTensor tensor, AllowSharedBufferSource inputData);
4656

4757
MLOpSupportLimits opSupportLimits();
4858
};
@@ -105,6 +115,21 @@ dictionary MLOperatorOptions {
105115

106116
typedef (bigint or unrestricted double) MLNumber;
107117

118+
dictionary MLTensorDescriptor : MLOperandDescriptor {
119+
boolean readable = false;
120+
boolean writable = false;
121+
};
122+
123+
[SecureContext, Exposed=(Window, DedicatedWorker)]
124+
interface MLTensor {
125+
readonly attribute MLOperandDataType dataType;
126+
readonly attribute FrozenArray<unsigned long> shape;
127+
readonly attribute boolean readable;
128+
readonly attribute boolean writable;
129+
130+
undefined destroy();
131+
};
132+
108133
typedef record<USVString, MLOperand> MLNamedOperands;
109134

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

test/fixtures/wpt/resources/idlharness-shadowrealm.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

test/fixtures/wpt/resources/idlharness.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ IdlArray.prototype.test = function()
734734

735735
Object.getOwnPropertyNames(this.members).forEach(function(memberName) {
736736
var member = this.members[memberName];
737-
if (!(member instanceof IdlInterface)) {
737+
if (!(member instanceof IdlInterface || member instanceof IdlNamespace)) {
738738
return;
739739
}
740740

@@ -1421,7 +1421,7 @@ IdlInterface.prototype.test = function()
14211421
if (!this.untested)
14221422
{
14231423
subsetTestByKey(this.name, test, function() {
1424-
assert_false(this.name in self);
1424+
assert_false(this.name in self, this.name + " interface should not exist");
14251425
}.bind(this), this.name + " interface: existence and properties of interface object");
14261426
}
14271427
return;
@@ -3451,6 +3451,17 @@ IdlNamespace.prototype.test_self = function ()
34513451

34523452
IdlNamespace.prototype.test = function ()
34533453
{
3454+
// If the namespace object is not exposed, only test that. Members can't be
3455+
// tested either
3456+
if (!this.exposed) {
3457+
if (!this.untested) {
3458+
subsetTestByKey(this.name, test, function() {
3459+
assert_false(this.name in self, this.name + " namespace should not exist");
3460+
}.bind(this), this.name + " namespace: existence and properties of namespace object");
3461+
}
3462+
return;
3463+
}
3464+
34543465
if (!this.untested) {
34553466
this.test_self();
34563467
}
@@ -3498,7 +3509,7 @@ function idl_test(srcs, deps, idl_setup_func) {
34983509
"require-exposed"
34993510
];
35003511
return Promise.all(
3501-
srcs.concat(deps).map(fetch_spec))
3512+
srcs.concat(deps).map(globalThis.fetch_spec))
35023513
.then(function(results) {
35033514
const astArray = results.map(result =>
35043515
WebIDL2.parse(result.idl, { sourceName: result.spec })
@@ -3539,9 +3550,11 @@ function idl_test(srcs, deps, idl_setup_func) {
35393550
});
35403551
}, 'idl_test setup');
35413552
}
3553+
globalThis.idl_test = idl_test;
35423554

35433555
/**
35443556
* fetch_spec is a shorthand for a Promise that fetches the spec's content.
3557+
* Note: ShadowRealm-specific implementation in testharness-shadowrealm-inner.js
35453558
*/
35463559
function fetch_spec(spec) {
35473560
var url = '/interfaces/' + spec + '.idl';

test/fixtures/wpt/resources/test/tests/functional/idlharness/IdlNamespace/test_operation.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@
6767
namespace baz {
6868
DOMString LongStory(any hero, DOMString... details);
6969
DOMString ShortStory(DOMString... details);
70-
};`);
70+
};
71+
[Exposed=Worker]
72+
namespace Absent {
73+
undefined Lies();
74+
};
75+
`);
7176
idlArray.test();
7277
</script>
7378
<script type="text/json" id="expected">
@@ -233,6 +238,12 @@
233238
"status_string": "PASS",
234239
"properties": {},
235240
"message": null
241+
},
242+
{
243+
"name": "Absent namespace: existence and properties of namespace object",
244+
"status_string": "PASS",
245+
"properties": {},
246+
"message": null
236247
}
237248
],
238249
"type": "complete"

test/fixtures/wpt/resources/testharness-shadowrealm-inner.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ globalThis.setShadowRealmGlobalProperties = function (queryString, fetchAdaptor)
1717
return new Promise(executor).then((s) => JSON.parse(s));
1818
};
1919

20+
// Used only by idlharness.js
21+
globalThis.fetch_spec = (spec) => {
22+
const resource = `/interfaces/${spec}.idl`;
23+
const executor = fetchAdaptor(resource);
24+
return new Promise(executor).then(
25+
idl => ({ spec, idl }),
26+
() => {
27+
throw new IdlHarnessError(`Error fetching ${resource}.`);
28+
});
29+
}
30+
2031
globalThis.location = { search: queryString };
2132
};
2233

test/fixtures/wpt/resources/testharness-shadowrealm-outer.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* Convenience function for evaluating some async code in the ShadowRealm and
66
* waiting for the result.
77
*
8+
* In case of error, this function intentionally exposes the stack trace (if it
9+
* is available) to the hosting realm, for debugging purposes.
10+
*
811
* @param {ShadowRealm} realm - the ShadowRealm to evaluate the code in
912
* @param {string} asyncBody - the code to evaluate; will be put in the body of
1013
* an async function, and must return a value explicitly if a value is to be
@@ -15,7 +18,7 @@ globalThis.shadowRealmEvalAsync = function (realm, asyncBody) {
1518
(resolve, reject) => {
1619
(async () => {
1720
${asyncBody}
18-
})().then(resolve, (e) => reject(e.toString()));
21+
})().then(resolve, (e) => reject(e.toString() + "\\n" + (e.stack || "")));
1922
}
2023
`));
2124
};
@@ -125,3 +128,22 @@ globalThis.setupFakeFetchOverMessagePort = function (port) {
125128
});
126129
port.start();
127130
}
131+
132+
/**
133+
* Returns a message suitable for posting with postMessage() that will signal to
134+
* the test harness that the tests are finished and there was an error in the
135+
* setup code.
136+
*
137+
* @param {message} string - error message
138+
*/
139+
globalThis.createSetupErrorResult = function (message) {
140+
return {
141+
type: "complete",
142+
tests: [],
143+
asserts: [],
144+
status: {
145+
status: 1, // TestsStatus.ERROR,
146+
message,
147+
},
148+
};
149+
};

0 commit comments

Comments
 (0)