summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/oom
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/wasm/oom')
-rw-r--r--js/src/jit-test/tests/wasm/oom/breakpoints.js12
-rw-r--r--js/src/jit-test/tests/wasm/oom/directives.txt1
-rw-r--r--js/src/jit-test/tests/wasm/oom/exports.js11
-rw-r--r--js/src/jit-test/tests/wasm/oom/jsapi-prototype.js29
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");
+});