| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-wasm --allow-natives-syntax | 5 // Flags: --expose-wasm --allow-natives-syntax |
| 6 | 6 |
| 7 if ((typeof drainJobQueue) != "function") { | 7 if ((typeof drainJobQueue) != "function") { |
| 8 drainJobQueue = () => { %RunMicrotasks() }; | 8 drainJobQueue = () => { %RunMicrotasks() }; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 assertEq(String(exportingInstance), "[object WebAssembly.Instance]"); | 364 assertEq(String(exportingInstance), "[object WebAssembly.Instance]"); |
| 365 assertEq(Object.getPrototypeOf(exportingInstance), instanceProto); | 365 assertEq(Object.getPrototypeOf(exportingInstance), instanceProto); |
| 366 | 366 |
| 367 // 'WebAssembly.Instance' 'exports' data property | 367 // 'WebAssembly.Instance' 'exports' data property |
| 368 let instanceExportsDesc = Object.getOwnPropertyDescriptor(exportingInstance, 'ex
ports'); | 368 let instanceExportsDesc = Object.getOwnPropertyDescriptor(exportingInstance, 'ex
ports'); |
| 369 assertEq(typeof instanceExportsDesc.value, "object"); | 369 assertEq(typeof instanceExportsDesc.value, "object"); |
| 370 assertTrue(instanceExportsDesc.writable); | 370 assertTrue(instanceExportsDesc.writable); |
| 371 assertTrue(instanceExportsDesc.enumerable); | 371 assertTrue(instanceExportsDesc.enumerable); |
| 372 assertTrue(instanceExportsDesc.configurable); | 372 assertTrue(instanceExportsDesc.configurable); |
| 373 | 373 |
| 374 exportsObj = exportingInstance.exports; |
| 375 assertEq(typeof exportsObj, 'object'); |
| 376 assertFalse(Object.isExtensible(exportsObj)); |
| 377 assertEq(Object.getPrototypeOf(exportsObj), null); |
| 378 assertEq(Object.keys(exportsObj).join(), 'f'); |
| 379 |
| 374 // Exported WebAssembly functions | 380 // Exported WebAssembly functions |
| 375 let f = exportingInstance.exports.f; | 381 let f = exportingInstance.exports.f; |
| 376 assertTrue(f instanceof Function); | 382 assertTrue(f instanceof Function); |
| 377 assertEq(f.length, 0); | 383 assertEq(f.length, 0); |
| 378 assertTrue('name' in f); | 384 assertTrue('name' in f); |
| 379 assertEq(Function.prototype.call.call(f), 42); | 385 assertEq(Function.prototype.call.call(f), 42); |
| 380 assertErrorMessage(() => new f(), TypeError, /is not a constructor/); | 386 assertErrorMessage(() => new f(), TypeError, /is not a constructor/); |
| 381 | 387 |
| 382 // 'WebAssembly.Memory' data property | 388 // 'WebAssembly.Memory' data property |
| 383 let memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory'); | 389 let memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory'); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 assertTrue(result.instance instanceof Instance); | 706 assertTrue(result.instance instanceof Instance); |
| 701 } | 707 } |
| 702 } | 708 } |
| 703 assertInstantiateSuccess(emptyModule); | 709 assertInstantiateSuccess(emptyModule); |
| 704 assertInstantiateSuccess(emptyModuleBinary); | 710 assertInstantiateSuccess(emptyModuleBinary); |
| 705 assertInstantiateSuccess(emptyModuleBinary.buffer); | 711 assertInstantiateSuccess(emptyModuleBinary.buffer); |
| 706 assertInstantiateSuccess(importingModule, {'': {f: () => {}}}); | 712 assertInstantiateSuccess(importingModule, {'': {f: () => {}}}); |
| 707 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); | 713 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); |
| 708 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); | 714 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); |
| 709 assertInstantiateSuccess(memoryImportingModuleBinary, {"": {"my_memory": scratch
_memory}}); | 715 assertInstantiateSuccess(memoryImportingModuleBinary, {"": {"my_memory": scratch
_memory}}); |
| OLD | NEW |