Bug 1932087: Check for WebAssembly.Function in memory64 test. r=yury

This is tied to the type reflections proposal and therefore shouldn't be
used unless available.

Differential Revision: https://phabricator.services.mozilla.com/D229491
This commit is contained in:
Ben Visness 2024-11-19 16:54:51 +00:00
parent a994ab4d81
commit 0e8410b888

View File

@ -1771,17 +1771,19 @@ if (getBuildConfiguration("pointer-byte-size") == 8) {
// get / set
const table64Tests = [
{
elem: "funcref",
jsval: new WebAssembly.Function({ parameters: ["i32"], results: [] }, () => {}),
wasmval: `(ref.func 0)`,
},
{
elem: "anyref",
jsval: "haha you cannot represent me",
wasmval: `(struct.new_default $s)`,
},
];
if (WebAssembly.Function) {
table64Tests.push({
elem: "funcref",
jsval: new WebAssembly.Function({ parameters: ["i32"], results: [] }, () => {}),
wasmval: `(ref.func 0)`,
});
}
for (const test of table64Tests) {
const externalTable = new WebAssembly.Table({ address: "i64", element: test.elem, initial: 2n });
externalTable.set(0n, test.jsval);