Index: test/mjsunit/wasm/js-api.js |
diff --git a/test/mjsunit/wasm/js-api.js b/test/mjsunit/wasm/js-api.js |
index 60ed7474211db3d64f60d42f472f064616811bc0..259754018b828ed00d81cd73df1e2188510eed9d 100644 |
--- a/test/mjsunit/wasm/js-api.js |
+++ b/test/mjsunit/wasm/js-api.js |
@@ -41,6 +41,13 @@ let importingModuleBinary = (() => { |
return new Int8Array(builder.toBuffer()); |
})(); |
+let moduleBinaryImporting2Memories = (() => { |
+ var builder = new WasmModuleBuilder(); |
+ builder.addImportedMemory("", "memory1"); |
+ builder.addImportedMemory("", "memory2"); |
+ return new Int8Array(builder.toBuffer()); |
+})(); |
+ |
// 'WebAssembly' data property on global object |
let wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly'); |
assertEq(typeof wasmDesc.value, "object"); |
@@ -478,6 +485,13 @@ assertEq(tbl.length, 2); |
assertErrorMessage(() => tbl.grow(1), Error, /failed to grow table/); |
} |
+// 'WebAssembly.validate' function |
+assertErrorMessage(() => WebAssembly.validate(), TypeError); |
+assertErrorMessage(() => WebAssembly.validate("hi"), TypeError); |
+assertEq(WebAssembly.validate(emptyModuleBinary), true); |
+// TODO: other ways for validate to return false. |
+assertEq(WebAssembly.validate(moduleBinaryImporting2Memories), false); |
+ |
// 'WebAssembly.compile' data property |
let compileDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'compile'); |
assertEq(typeof compileDesc.value, "function"); |