diff options
Diffstat (limited to 'js/src/jit-test/tests/wasm/function-references/disabled.js')
-rw-r--r-- | js/src/jit-test/tests/wasm/function-references/disabled.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/function-references/disabled.js b/js/src/jit-test/tests/wasm/function-references/disabled.js new file mode 100644 index 0000000000..70a66a937d --- /dev/null +++ b/js/src/jit-test/tests/wasm/function-references/disabled.js @@ -0,0 +1,17 @@ +// |jit-test| skip-if: wasmFunctionReferencesEnabled() + +const { CompileError, validate } = WebAssembly; + +const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|bad type|\(ref T\) types not enabled/; + +let simpleTests = [ + `(module (func (param (ref 0)) (unreachable)))`, +]; + +// Test that use of function-references fails when function-references is disabled. + +for (let src of simpleTests) { + let bin = wasmTextToBinary(src); + assertEq(validate(bin), false); + wasmCompilationShouldFail(bin, UNRECOGNIZED_OPCODE_OR_BAD_TYPE); +} |