Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /wasm/jsapi/function/call.tentative.any.js - WPT Dashboard Interop Dashboard
- /wasm/jsapi/function/call.tentative.any.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/function/call.tentative.any.shadowrealm.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/function/call.tentative.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js
function addxy(x, y) {
return x + y
}
test(() => {
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_equals(fun(1, 2), 3)
}, "test calling function")
test(() => {
var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
assert_throws_js(TypeError, () => new fun(1, 2));
}, "test constructing function");