gecko-dev/testing/web-platform/tests/wasm/jsapi/idlharness.any.js
moz-wptsync-bot abe36a3570 Bug 1491890 [wpt PR 13032] - Improve the wasm idlharness test., a=testonly
Automatic update from web-platform-testsIdlHarness: Extract code that checks for interface objects on self.

--
IdlHarness: Support LegacyNamespace in interface object checks.

--
IdlHarness: Support LegacyNamespace in class string checks.

--
Fix some bugs in wasm/idlharness.any.js.

--
Move wasm/idlharness.any.js to the jsapi subdirectory.

It only tests the IDL from the jsapi specification.

--

wpt-commits: df681aeacb197d9690fff1160e8d6362fd872000, 10c3854cbb09b63f0af8a6624dd7e87edba031ff, e77d06135f5dc72398d0a562ce53da90ad6a0968, ebefd2d309525024a8a57f435aef5ee683846013, a69af5481cdd976c9696f97d9c6547ac87ba83d0
wpt-pr: 13032
2018-10-17 15:44:42 +01:00

40 lines
1.1 KiB
JavaScript

// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: script=../resources/load_wasm.js
'use strict';
// https://webassembly.github.io/spec/js-api/
promise_test(async () => {
const srcs = ['wasm-js-api'];
const [wasm] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(wasm, {
// Note the prose requirements in the specification.
except: ['CompileError', 'LinkError', 'RuntimeError']
});
// https://github.com/web-platform-tests/wpt/issues/12850
idl_array.add_untested_idls('[Exposed=(Window,Worker)] interface ArrayBuffer {};');
// Ignored errors are surfaced in idlharness.js's test_object below.
try {
self.memory = new WebAssembly.Memory({initial: 1024});
} catch (e) { }
try {
self.mod = await createWasmModule();
self.instance = new WebAssembly.Instance(self.mod);
} catch (e) { }
idl_array.add_objects({
Memory: ['memory'],
Module: ['mod'],
Instance: ['instance'],
});
idl_array.test();
}, 'wasm-js-api interfaces.');