Index: test/mjsunit/wasm/indirect-tables.js |
diff --git a/test/mjsunit/wasm/indirect-tables.js b/test/mjsunit/wasm/indirect-tables.js |
index 057d0f3661f044879a28dc6015484182a8ee1f19..80920c91c63fdd1fe8c31b2371e542da374de97e 100644 |
--- a/test/mjsunit/wasm/indirect-tables.js |
+++ b/test/mjsunit/wasm/indirect-tables.js |
@@ -199,7 +199,8 @@ function js_div(a, b) { return (a / b) | 0; } |
for (let i = 0; i < 5; i++) { |
print(" base = " + i); |
let table = new WebAssembly.Table({element: "anyfunc", |
- initial: kTableSize}); |
+ initial: kTableSize, |
+ maximum: kTableSize}); |
assertEquals(10, table.length); |
let i2 = new WebAssembly.Instance(m2, {q: {base: i, table: table, |
js_div: js_div}}); |
@@ -242,7 +243,8 @@ function js_div(a, b) { return (a / b) | 0; } |
print("CumulativeTest..."); |
let kTableSize = 10; |
- let table = new WebAssembly.Table({element: "anyfunc", initial: 10}); |
+ let table = new WebAssembly.Table( |
+ {element: "anyfunc", initial: kTableSize, maximum: kTableSize}); |
var builder = new WasmModuleBuilder(); |
@@ -457,3 +459,22 @@ function js_div(a, b) { return (a / b) | 0; } |
} |
assertThrows(() => table.grow(11)); |
})(); |
+ |
+ |
+(function TestImportTooLarge() { |
+ print("TestImportTooLarge..."); |
+ let builder = new WasmModuleBuilder(); |
+ builder.addImportedTable("t", "t", 1, 2); |
+ |
+ // initial size is too large |
+ assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
+ {element: "anyfunc", initial: 3, maximum: 3})}})); |
+ |
+ // maximum size is too large |
+ assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
+ {element: "anyfunc", initial: 1, maximum: 4})}})); |
+ |
+ // no maximum |
+ assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
+ {element: "anyfunc", initial: 1})}})); |
+})(); |