mirror of
https://github.com/servo/servo.git
synced 2025-10-04 10:39:16 +01:00
20 lines
728 B
JavaScript
20 lines
728 B
JavaScript
// META: global=window,worker
|
|
// META: script=/wasm/jsapi/wasm-constants.js
|
|
// META: script=/wasm/jsapi/wasm-module-builder.js
|
|
// META: script=/wasm/jsapi/assertions.js
|
|
// META: script=/wasm/jsapi/instanceTestFactory.js
|
|
|
|
let emptyModuleBinary;
|
|
setup(() => {
|
|
emptyModuleBinary = new WasmModuleBuilder().toBuffer();
|
|
});
|
|
|
|
for (const [name, fn] of instanceTestFactory) {
|
|
promise_test(async () => {
|
|
const { buffer, args, exports, verify } = fn();
|
|
const response = new Response(buffer, { "headers": { "Content-Type": "application/wasm" } });
|
|
const result = await WebAssembly.instantiateStreaming(response, ...args);
|
|
assert_WebAssemblyInstantiatedSource(result, exports);
|
|
verify(result.instance);
|
|
}, name);
|
|
}
|