Skip to content

Commit

Permalink
chore: update WPT
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored and github-actions[bot] committed Dec 9, 2024
1 parent 503ad76 commit 08fa295
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 92 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/compute-pressure.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// (https://github.com/w3c/webref)
// Source: Compute Pressure Level 1 (https://w3c.github.io/compute-pressure/)

enum PressureSource { "thermals", "cpu" };
enum PressureSource { "cpu" };

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

Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/wpt/interfaces/fedcm.idl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ dictionary IdentityProviderRequestOptions : IdentityProviderConfig {
};

dictionary IdentityProviderWellKnown {
required sequence<USVString> provider_urls;
sequence<USVString> provider_urls;
USVString accounts_endpoint;
USVString login_url;
};

dictionary IdentityProviderIcon {
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/wpt/interfaces/gpc.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Global Privacy Control (GPC) (https://w3c.github.io/gpc/)

interface mixin GlobalPrivacyControl {
readonly attribute boolean globalPrivacyControl;
};
Navigator includes GlobalPrivacyControl;
WorkerNavigator includes GlobalPrivacyControl;
17 changes: 10 additions & 7 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,11 @@ interface MessageChannel {
readonly attribute MessagePort port2;
};

interface mixin MessageEventTarget {
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};

[Exposed=(Window,Worker,AudioWorklet), Transferable]
interface MessagePort : EventTarget {
undefined postMessage(any message, sequence<object> transfer);
Expand All @@ -2528,11 +2533,11 @@ interface MessagePort : EventTarget {
undefined close();

// event handlers
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
attribute EventHandler onclose;
};

MessagePort includes MessageEventTarget;

dictionary StructuredSerializeOptions {
sequence<object> transfer = [];
};
Expand Down Expand Up @@ -2571,11 +2576,10 @@ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
undefined postMessage(any message, optional StructuredSerializeOptions options = {});

undefined close();

attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};

DedicatedWorkerGlobalScope includes MessageEventTarget;

[Global=(Worker,SharedWorker),Exposed=SharedWorker]
interface SharedWorkerGlobalScope : WorkerGlobalScope {
[Replaceable] readonly attribute DOMString name;
Expand All @@ -2597,8 +2601,6 @@ interface Worker : EventTarget {

undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};

dictionary WorkerOptions {
Expand All @@ -2610,6 +2612,7 @@ dictionary WorkerOptions {
enum WorkerType { "classic", "module" };

Worker includes AbstractWorker;
Worker includes MessageEventTarget;

[Exposed=Window]
interface SharedWorker : EventTarget {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/wpt/interfaces/long-animation-frames.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface PerformanceLongAnimationFrameTiming : PerformanceEntry {
[Default] object toJSON();
};

PerformanceLongAnimationFrameTiming includes PaintTimingMixin;

enum ScriptInvokerType {
"classic-script",
"module-script",
Expand Down
16 changes: 16 additions & 0 deletions test/fixtures/wpt/interfaces/mediacapture-surface-control.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Captured Surface Control (https://w3c.github.io/mediacapture-surface-control/)

partial interface CaptureController {
sequence<long> getSupportedZoomLevels();
long getZoomLevel();
Promise<undefined> setZoomLevel(long zoomLevel);
attribute EventHandler oncapturedzoomlevelchange;
};

partial interface CaptureController {
constructor();
Promise<undefined> forwardWheel(HTMLElement element);
};
17 changes: 15 additions & 2 deletions test/fixtures/wpt/interfaces/sanitizer-api.idl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,22 @@ dictionary SetHTMLOptions {

[Exposed=(Window,Worker)]
interface Sanitizer {
constructor(optional SanitizerConfig config = {});
constructor(optional SanitizerConfig configuration = {});

// Query configuration:
SanitizerConfig get();
SanitizerConfig getUnsafe();

// Modify a Sanitizer’s lists and fields:
undefined allowElement(SanitizerElementWithAttributes element);
undefined removeElement(SanitizerElement element);
undefined replaceElementWithChildren(SanitizerElement element);
undefined allowAttribute(SanitizerAttribute attribute);
undefined removeAttribute(SanitizerAttribute attribute);
undefined setComments(boolean allow);
undefined setDataAttributes(boolean allow);

// Remove markup that executes script. May modify multiple lists:
undefined removeUnsafe();
};

dictionary SanitizerElementNamespace {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/vibration.idl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Vibration API (Second Edition) (https://w3c.github.io/vibration/)
// Source: Vibration API (https://w3c.github.io/vibration/)

typedef (unsigned long or sequence<unsigned long>) VibratePattern;

Expand Down
35 changes: 26 additions & 9 deletions test/fixtures/wpt/interfaces/webnn.idl
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ interface ML {
Promise<MLContext> createContext(GPUDevice gpuDevice);
};

typedef record<USVString, ArrayBufferView> MLNamedArrayBufferViews;

dictionary MLComputeResult {
MLNamedArrayBufferViews inputs;
MLNamedArrayBufferViews outputs;
};
typedef record<USVString, MLTensor> MLNamedTensors;

[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLContext {
Promise<MLComputeResult> compute(
MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);

Promise<MLTensor> createTensor(MLTensorDescriptor descriptor);

Promise<ArrayBuffer> readTensor(MLTensor tensor);
Promise<undefined> readTensor(MLTensor tensor, AllowSharedBufferSource outputData);

undefined writeTensor(MLTensor tensor, AllowSharedBufferSource inputData);

MLOpSupportLimits opSupportLimits();
};
Expand Down Expand Up @@ -105,6 +106,21 @@ dictionary MLOperatorOptions {

typedef (bigint or unrestricted double) MLNumber;

dictionary MLTensorDescriptor : MLOperandDescriptor {
boolean readable = false;
boolean writable = false;
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLTensor {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
readonly attribute boolean readable;
readonly attribute boolean writable;

undefined destroy();
};

typedef record<USVString, MLOperand> MLNamedOperands;

[SecureContext, Exposed=(Window, DedicatedWorker)]
Expand All @@ -116,7 +132,8 @@ interface MLGraphBuilder {
MLOperand input(USVString name, MLOperandDescriptor descriptor);

// Create an operand for a graph constant.
MLOperand constant(MLOperandDescriptor descriptor, ArrayBufferView bufferView);
MLOperand constant(MLOperandDescriptor descriptor,
AllowSharedBufferSource buffer);

// Create a scalar operand from the specified number of the specified type.
MLOperand constant(MLOperandDataType type, MLNumber value);
Expand Down
52 changes: 0 additions & 52 deletions test/fixtures/wpt/resources/idlharness-shadowrealm.js

This file was deleted.

19 changes: 16 additions & 3 deletions test/fixtures/wpt/resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ IdlArray.prototype.test = function()

Object.getOwnPropertyNames(this.members).forEach(function(memberName) {
var member = this.members[memberName];
if (!(member instanceof IdlInterface)) {
if (!(member instanceof IdlInterface || member instanceof IdlNamespace)) {
return;
}

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

IdlNamespace.prototype.test = function ()
{
// If the namespace object is not exposed, only test that. Members can't be
// tested either
if (!this.exposed) {
if (!this.untested) {
subsetTestByKey(this.name, test, function() {
assert_false(this.name in self, this.name + " namespace should not exist");
}.bind(this), this.name + " namespace: existence and properties of namespace object");
}
return;
}

if (!this.untested) {
this.test_self();
}
Expand Down Expand Up @@ -3498,7 +3509,7 @@ function idl_test(srcs, deps, idl_setup_func) {
"require-exposed"
];
return Promise.all(
srcs.concat(deps).map(fetch_spec))
srcs.concat(deps).map(globalThis.fetch_spec))
.then(function(results) {
const astArray = results.map(result =>
WebIDL2.parse(result.idl, { sourceName: result.spec })
Expand Down Expand Up @@ -3539,9 +3550,11 @@ function idl_test(srcs, deps, idl_setup_func) {
});
}, 'idl_test setup');
}
globalThis.idl_test = idl_test;

/**
* fetch_spec is a shorthand for a Promise that fetches the spec's content.
* Note: ShadowRealm-specific implementation in testharness-shadowrealm-inner.js
*/
function fetch_spec(spec) {
var url = '/interfaces/' + spec + '.idl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@
namespace baz {
DOMString LongStory(any hero, DOMString... details);
DOMString ShortStory(DOMString... details);
};`);
};
[Exposed=Worker]
namespace Absent {
undefined Lies();
};
`);
idlArray.test();
</script>
<script type="text/json" id="expected">
Expand Down Expand Up @@ -233,6 +238,12 @@
"status_string": "PASS",
"properties": {},
"message": null
},
{
"name": "Absent namespace: existence and properties of namespace object",
"status_string": "PASS",
"properties": {},
"message": null
}
],
"type": "complete"
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/wpt/resources/testharness-shadowrealm-inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ globalThis.setShadowRealmGlobalProperties = function (queryString, fetchAdaptor)
return new Promise(executor).then((s) => JSON.parse(s));
};

// Used only by idlharness.js
globalThis.fetch_spec = (spec) => {
const resource = `/interfaces/${spec}.idl`;
const executor = fetchAdaptor(resource);
return new Promise(executor).then(
idl => ({ spec, idl }),
() => {
throw new IdlHarnessError(`Error fetching ${resource}.`);
});
}

globalThis.location = { search: queryString };
};

Expand Down
Loading

0 comments on commit 08fa295

Please sign in to comment.