WebAssembly Module and Instance calls should throw if new target is undefined |
|||
Issue descriptionAccording to the WebAssembly design: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodule-constructor This should throw a TypeError: WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x1, 0x00, 0x00, 0x00)); This should not: new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x1, 0x00, 0x00, 0x00)); In V8, neither does. SpiderMonkey and JavaScriptCore exhibit the spec behavior. Ditto for Instance, Memory, Table. Only the errors don't require that behavior because of JavaScript legacy where errors don't require new (except, amusingly, some DOM errors which have been flip-flopping about requiring new or not).
,
Nov 16 2017
,
Nov 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/fa268032fc646822757bdaac84e449e6b4e48c07 commit fa268032fc646822757bdaac84e449e6b4e48c07 Author: Brad Nelson <bradnelson@chromium.org> Date: Mon Nov 20 17:34:51 2017 [wasm] Disallow calling wasm constructors without new. BUG= chromium:786021 R=titzer@chromium.org Change-Id: I188ea4d639ef9d5ceeab5052e043ec1c9150bd77 Reviewed-on: https://chromium-review.googlesource.com/778282 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Brad Nelson <bradnelson@chromium.org> Cr-Commit-Position: refs/heads/master@{#49506} [modify] https://crrev.com/fa268032fc646822757bdaac84e449e6b4e48c07/src/wasm/wasm-js.cc [modify] https://crrev.com/fa268032fc646822757bdaac84e449e6b4e48c07/test/mjsunit/wasm/js-api.js [modify] https://crrev.com/fa268032fc646822757bdaac84e449e6b4e48c07/test/mjsunit/wasm/table-grow.js [modify] https://crrev.com/fa268032fc646822757bdaac84e449e6b4e48c07/test/mjsunit/wasm/test-wasm-module-builder.js
,
Nov 20 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by bradnelson@chromium.org
, Nov 16 2017Owner: bradnelson@chromium.org
Status: Assigned (was: Unconfirmed)