[wasm] Instance exports object should be iterable
BUG=v8:5863 R=titzer@chromium.org, dschuff@chromium.org Review-Url: https://codereview.chromium.org/2640403004 Cr-Commit-Position: refs/heads/master@{#42578}
This commit is contained in:
parent
50e0fe29bb
commit
2ca39001c8
@ -1884,6 +1884,7 @@ class WasmInstanceBuilder {
|
||||
|
||||
PropertyDescriptor desc;
|
||||
desc.set_writable(false);
|
||||
desc.set_enumerable(true);
|
||||
|
||||
// Count up export indexes.
|
||||
int export_index = 0;
|
||||
|
@ -247,3 +247,21 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
|
||||
builder.exportMemoryAs('memory');
|
||||
assertThrows(() => builder.instantiate(), WebAssembly.CompileError);
|
||||
})();
|
||||
|
||||
(function TestIterableExports() {
|
||||
print("TestIterableExports...");
|
||||
let builder = new WasmModuleBuilder;
|
||||
builder.addExport("a", builder.addFunction("", kSig_v_v).addBody([]));
|
||||
builder.addExport("b", builder.addFunction("", kSig_v_v).addBody([]));
|
||||
builder.addExport("c", builder.addFunction("", kSig_v_v).addBody([]));
|
||||
builder.addExport("d", builder.addFunction("", kSig_v_v).addBody([]));
|
||||
builder.addExport("e", builder.addGlobal(kWasmI32, false));
|
||||
|
||||
let module = new WebAssembly.Module(builder.toBuffer());
|
||||
let instance = new WebAssembly.Instance(module);
|
||||
|
||||
let exports_count = 0;
|
||||
for (var e in instance.exports) ++exports_count;
|
||||
|
||||
assertEquals(5, exports_count);
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user