[wasm] Fix subclassing for WebAssembly.* types.

R=rossberg@chromium.org

Bug: chromium:772636
Change-Id: I885f8657eb755953be17d7bf32aef2629092b9c2
Reviewed-on: https://chromium-review.googlesource.com/733086
Reviewed-by: Andreas Rossberg <rossberg@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48830}
This commit is contained in:
Ben L. Titzer 2017-10-23 14:24:53 +02:00 committed by Commit Bot
parent 271e3b108d
commit 0957bd96ac
2 changed files with 18 additions and 0 deletions

View File

@ -12829,6 +12829,10 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
case JS_VALUE_TYPE:
case JS_WEAK_MAP_TYPE:
case JS_WEAK_SET_TYPE:
case WASM_INSTANCE_TYPE:
case WASM_MEMORY_TYPE:
case WASM_MODULE_TYPE:
case WASM_TABLE_TYPE:
return true;
case BIGINT_TYPE:

View File

@ -889,3 +889,17 @@ assertInstantiateSuccess(importingModuleBinary, {'': {f: () => {}}});
assertInstantiateSuccess(importingModuleBinary.buffer, {'': {f: () => {}}});
assertInstantiateSuccess(
memoryImportingModuleBinary, {'': {'my_memory': scratch_memory}});
(function TestSubclassing() {
class M extends WebAssembly.Module { }
assertThrows(() => new M());
class I extends WebAssembly.Instance { }
assertThrows(() => new I());
class T extends WebAssembly.Table { }
assertThrows(() => new T());
class Y extends WebAssembly.Memory { }
assertThrows(() => new Y());
})();