| Index: test/mjsunit/wasm/table.js
|
| diff --git a/test/mjsunit/wasm/table.js b/test/mjsunit/wasm/table.js
|
| index c04e3e2ad1de204e7ce9fa3f39e2fb7fb630cd68..0275bc05225c70e5be65032b6e0f0053b5c27cfb 100644
|
| --- a/test/mjsunit/wasm/table.js
|
| +++ b/test/mjsunit/wasm/table.js
|
| @@ -9,6 +9,13 @@
|
| var outOfUint32RangeValue = 1e12;
|
| var int32ButOob = 1073741824;
|
|
|
| +function assertTableIsValid(table) {
|
| + assertSame(WebAssembly.Table.prototype, table.__proto__);
|
| + assertSame(WebAssembly.Table, table.constructor);
|
| + assertTrue(table instanceof Object);
|
| + assertTrue(table instanceof WebAssembly.Table);
|
| +}
|
| +
|
| (function TestConstructor() {
|
| assertTrue(WebAssembly.Table instanceof Function);
|
| assertSame(WebAssembly.Table, WebAssembly.Table.prototype.constructor);
|
| @@ -39,16 +46,50 @@ var int32ButOob = 1073741824;
|
| assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: int32ButOob}));
|
|
|
| let table = new WebAssembly.Table({element: "anyfunc", initial: 1});
|
| - assertSame(WebAssembly.Table.prototype, table.__proto__);
|
| - assertSame(WebAssembly.Table, table.constructor);
|
| - assertTrue(table instanceof Object);
|
| - assertTrue(table instanceof WebAssembly.Table);
|
| + assertTableIsValid(table);
|
| })();
|
|
|
| (function TestConstructorWithMaximum() {
|
| - let table = new WebAssembly.Table({element: "anyfunc", initial: 1, maximum: 10});
|
| - assertSame(WebAssembly.Table.prototype, table.__proto__);
|
| - assertSame(WebAssembly.Table, table.constructor);
|
| - assertTrue(table instanceof Object);
|
| - assertTrue(table instanceof WebAssembly.Table);
|
| + let table = new WebAssembly.Table({element: "anyfunc", maximum: 10});
|
| + assertTableIsValid(table);
|
| +})();
|
| +
|
| +(function TestInitialIsUndefined() {
|
| + // New memory with initial = undefined, which means initial = 0.
|
| + let table = new WebAssembly.Table({element: "anyfunc", initial: undefined});
|
| + assertTableIsValid(table);
|
| +})();
|
| +
|
| +(function TestMaximumIsUndefined() {
|
| + // New memory with maximum = undefined, which means maximum = 0.
|
| + let table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: undefined});
|
| + assertTableIsValid(table);
|
| +})();
|
| +
|
| +(function TestMaximumIsReadOnce() {
|
| + var a = true;
|
| + var desc = {element: "anyfunc", initial: 10};
|
| + Object.defineProperty(desc, 'maximum', {get: function() {
|
| + if (a) {
|
| + a = false;
|
| + return 16;
|
| + }
|
| + else {
|
| + // Change the return value on the second call so it throws.
|
| + return -1;
|
| + }
|
| + }});
|
| + let table = new WebAssembly.Table(desc);
|
| + assertTableIsValid(table);
|
| +})();
|
| +
|
| +(function TestMaximumDoesHasProperty() {
|
| + var hasPropertyWasCalled = false;
|
| + var desc = {element: "anyfunc", initial: 10};
|
| + var proxy = new Proxy({maximum: 16}, {
|
| + has: function(target, name) { hasPropertyWasCalled = true; }
|
| + });
|
| + Object.setPrototypeOf(desc, proxy);
|
| + let table = new WebAssembly.Table(desc);
|
| + assertTableIsValid(table);
|
| })();
|
|
|