diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/wasm/oom | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/oom')
-rw-r--r-- | js/src/jit-test/tests/wasm/oom/breakpoints.js | 12 | ||||
-rw-r--r-- | js/src/jit-test/tests/wasm/oom/directives.txt | 1 | ||||
-rw-r--r-- | js/src/jit-test/tests/wasm/oom/exports.js | 11 | ||||
-rw-r--r-- | js/src/jit-test/tests/wasm/oom/jsapi-prototype.js | 29 |
4 files changed, 53 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/oom/breakpoints.js b/js/src/jit-test/tests/wasm/oom/breakpoints.js new file mode 100644 index 0000000000..a90f97739a --- /dev/null +++ b/js/src/jit-test/tests/wasm/oom/breakpoints.js @@ -0,0 +1,12 @@ +// |jit-test| skip-if: !('oomTest' in this) + +var dbgGlobal = newGlobal({newCompartment: true}); +var dbg = new dbgGlobal.Debugger(); +dbg.addDebuggee(this); + +oomTest(() => { + wasmEvalText(` + (import "" "" (func $d)) + (func try call $d end) + `); +}); diff --git a/js/src/jit-test/tests/wasm/oom/directives.txt b/js/src/jit-test/tests/wasm/oom/directives.txt new file mode 100644 index 0000000000..6c28625dd1 --- /dev/null +++ b/js/src/jit-test/tests/wasm/oom/directives.txt @@ -0,0 +1 @@ +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); include:wasm.js diff --git a/js/src/jit-test/tests/wasm/oom/exports.js b/js/src/jit-test/tests/wasm/oom/exports.js new file mode 100644 index 0000000000..391850fda7 --- /dev/null +++ b/js/src/jit-test/tests/wasm/oom/exports.js @@ -0,0 +1,11 @@ +// |jit-test| skip-if: !('oomTest' in this) + +oomTest(() => { + let text = `(module + (type (func (param i32) (result i32))) + )`; + let binary = wasmTextToBinary(text); + let module = new WebAssembly.Module(binary); + let obj = module.exports(); + assertEq(obj instanceof Object, true); +}); diff --git a/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js b/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js new file mode 100644 index 0000000000..4888a70db0 --- /dev/null +++ b/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js @@ -0,0 +1,29 @@ +// |jit-test| skip-if: !('oomTest' in this) + +oomTest(() => { + let memory = new WebAssembly.Memory({initial: 0}); + assertEq(Object.getPrototypeOf(memory), WebAssembly.Memory.prototype, "prototype"); +}); + +oomTest(() => { + let global = new WebAssembly.Global({value: 'i32'}); + assertEq(Object.getPrototypeOf(global), WebAssembly.Global.prototype, "prototype"); +}); + +oomTest(() => { + let table = new WebAssembly.Table({element: 'anyfunc', initial: 0}); + assertEq(Object.getPrototypeOf(table), WebAssembly.Table.prototype, "prototype"); +}); + +oomTest(() => { + let bytecode = wasmTextToBinary('(module)'); + let module = new WebAssembly.Module(bytecode); + assertEq(Object.getPrototypeOf(module), WebAssembly.Module.prototype, "prototype"); +}); + +oomTest(() => { + let bytecode = wasmTextToBinary('(module)'); + let module = new WebAssembly.Module(bytecode); + let instance = new WebAssembly.Instance(module, {}); + assertEq(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype, "prototype"); +}); |