Bug 1808494 [wpt PR 37227] - Fixed CI failure of idlharness.js for unexposed overloaded functions., a=testonly

Automatic update from web-platform-tests
Fixed CI failure of idlharness.js for unexposed overloaded functions. (#37227)

--

wpt-commits: 26372edb32920988006a28ef5149349fcb467c9c
wpt-pr: 37227
This commit is contained in:
BruceDai 2023-01-04 17:19:02 +00:00 коммит произвёл moz-wptsync-bot
Родитель d765e41e4c
Коммит 0242b5ce51
3 изменённых файлов: 45 добавлений и 33 удалений

Просмотреть файл

@ -27,8 +27,13 @@ dictionary MLContextOptions {
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface ML {
MLContext createContext(optional MLContextOptions options = {});
MLContext createContext(GPUDevice gpuDevice);
Promise<MLContext> createContext(optional MLContextOptions options = {});
Promise<MLContext> createContext(GPUDevice gpuDevice);
[Exposed=(DedicatedWorker)]
MLContext createContextSync(optional MLContextOptions options = {});
[Exposed=(DedicatedWorker)]
MLContext createContextSync(GPUDevice gpuDevice);
};
typedef record<DOMString, ArrayBufferView> MLNamedArrayBufferViews;
@ -38,12 +43,12 @@ interface MLContext {};
partial interface MLContext {
[Exposed=(DedicatedWorker)]
undefined compute(
undefined computeSync(
MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
};
partial interface MLContext {
Promise<undefined> computeAsync(
Promise<undefined> compute(
MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
};
@ -103,12 +108,12 @@ interface MLGraphBuilder {
// Create a single-value operand from the specified number of the specified type.
MLOperand constant(double value, optional MLOperandType type = "float32");
// Compile the graph up to the specified output operands asynchronously.
Promise<MLGraph> build(MLNamedOperands outputs);
// Compile the graph up to the specified output operands synchronously.
[Exposed=(DedicatedWorker)]
MLGraph build(MLNamedOperands outputs);
// Compile the graph up to the specified output operands asynchronously.
Promise<MLGraph> buildAsync(MLNamedOperands outputs);
MLGraph buildSync(MLNamedOperands outputs);
};
dictionary MLBatchNormalizationOptions {

Просмотреть файл

@ -2668,6 +2668,7 @@ IdlInterface.prototype.test_member_stringifier = function(member)
IdlInterface.prototype.test_members = function()
{
var unexposed_members = new Set();
for (var i = 0; i < this.members.length; i++)
{
var member = this.members[i];
@ -2676,15 +2677,18 @@ IdlInterface.prototype.test_members = function()
}
if (!exposed_in(exposure_set(member, this.exposureSet))) {
subsetTestByKey(this.name, test, function() {
// It's not exposed, so we shouldn't find it anywhere.
assert_false(member.name in this.get_interface_object(),
"The interface object must not have a property " +
format_value(member.name));
assert_false(member.name in this.get_interface_object().prototype,
"The prototype object must not have a property " +
format_value(member.name));
}.bind(this), this.name + " interface: member " + member.name);
if (!unexposed_members.has(member.name)) {
unexposed_members.add(member.name);
subsetTestByKey(this.name, test, function() {
// It's not exposed, so we shouldn't find it anywhere.
assert_false(member.name in this.get_interface_object(),
"The interface object must not have a property " +
format_value(member.name));
assert_false(member.name in this.get_interface_object().prototype,
"The prototype object must not have a property " +
format_value(member.name));
}.bind(this), this.name + " interface: member " + member.name);
}
continue;
}
@ -2855,17 +2859,23 @@ IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect
return;
}
var unexposed_properties = new Set();
for (var i = 0; i < this.members.length; i++)
{
var member = this.members[i];
if (member.untested) {
continue;
}
if (!exposed_in(exposure_set(member, this.exposureSet))) {
subsetTestByKey(this.name, test, function() {
assert_equals(exception, null, "Unexpected exception when evaluating object");
assert_false(member.name in obj);
}.bind(this), this.name + " interface: " + desc + ' must not have property "' + member.name + '"');
if (!exposed_in(exposure_set(member, this.exposureSet)))
{
if (!unexposed_properties.has(member.name))
{
unexposed_properties.add(member.name);
subsetTestByKey(this.name, test, function() {
assert_equals(exception, null, "Unexpected exception when evaluating object");
assert_false(member.name in obj);
}.bind(this), this.name + " interface: " + desc + ' must not have property "' + member.name + '"');
}
continue;
}
if (member.type == "attribute" && member.isUnforgeable)

Просмотреть файл

@ -35,25 +35,22 @@ idl_test(
}
for (const deviceType of DeviceTypeArray) {
const context = navigator.ml.createContext({deviceType});
// Per spec navigator.ml.createContext should return a MLContext, but
// in Chromium it returns a Promise<MLContext>. Fail the setup if this
// happens, since the tests wouldn't make sense.
if (context instanceof Promise) {
context.catch(() => {});
assert_unreached('navigator.ml.createContext returned a Promise');
if (isSync) {
self.context = navigator.ml.createContextSync({deviceType});
} else {
self.context = await navigator.ml.createContext({deviceType});
}
self.context = context;
self.builder = new MLGraphBuilder(context);
self.builder = new MLGraphBuilder(self.context);
self.input = builder.input('input', {type: 'float32', dimensions: [1, 1, 5, 5]});
self.filter = builder.constant({type: 'float32', dimensions: [1, 1, 3, 3]}, new Float32Array(9).fill(1));
self.relu = builder.relu();
self.output = builder.conv2d(input, filter, {activation: relu, inputLayout: "nchw"});
if (isSync) {
self.graph = builder.build({output});
self.graph = builder.buildSync({output});
} else {
self.graph = await builder.buildAsync({output});
self.graph = await builder.build({output});
}
}
}