Repository navigation
Conversation
| * `WebAssembly.CompileError` : a [NativeError](http://tc39.github.io/ecma262/#sec-nativeerror-object-structure) | ||
| which indicates an error during WebAssembly decoding or validation | ||
| * `WebAssembly.LinkError` : a [NativeError](http://tc39.github.io/ecma262/#sec-nativeerror-object-structure) | ||
| which indicates an error during WebAssembly instantiating a mdoule |
There was a problem hiding this comment.
IIUC: CompileError is for Module creation, and LinkError is for Instance creation up to but excluding calling the start function? I'd call that out explicitly.
|
@jfbastien, excellent question, but I think it's a somewhat tricky issue that's better discussed separately. Nothing specified in this PR depends on how that's resolved. |
|
The proposed wording lgtm |
| `WebAssembly.Module` and `WebAssembly.Instance`. On failure, the `Promise` is | ||
| [rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a | ||
| `WebAssembly.CompileError`. | ||
| `WebAssembly.CompileError`, `WebAssemlby.LinkError`, or `WebAssembly.RuntimeError`, depending on the cause of failure. |
| with the resulting `WebAssembly.Instance` object. On failure, the `Promise` is | ||
| [rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a | ||
| `WebAssembly.CompileError`. | ||
| `WebAssembly.CompileError`, `WebAssemlby.LinkError`, or `WebAssembly.RuntimeError`, depending on the cause of failure. |
|
lgtm |
| with the resulting `WebAssembly.Instance` object. On failure, the `Promise` is | ||
| [rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a | ||
| `WebAssembly.CompileError`. | ||
| `WebAssembly.CompileError`, `WebAssembly.LinkError`, or `WebAssembly.RuntimeError`, depending on the cause of failure. |
There was a problem hiding this comment.
driveby nit: IIUC, no CompileError is possible here.
| @@ -288,10 +290,10 @@ For each [`import`](https://github.com/WebAssembly/spec/blob/master/interpreter/ | |||
| 1. Let `v` be the value of performing [`Get`](http://tc39.github.io/ecma262/#sec-get-o-p)(`o`, [`i.item_name`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/ast.ml#L171)) | |||
There was a problem hiding this comment.
The omission of the above TypeError ("If Type(o) is not Object") is on purpose, right? It kinda happens before the constructor is called I guess?
Same question for "If the importObject parameter is not undefined and Type(importObject) is not Object".
There was a problem hiding this comment.
The required type of v differs depending on what type of import they match, so is tested in the individual cases below. In particular, for globals it must not be an object.
https://bugs.webkit.org/show_bug.cgi?id=165805 <rdar://problem/29747874> JSTests: Reviewed by Mark lam. Update all exception sites which now throw WebAssembly.LinkError. * wasm/js-api/element-data.js: * wasm/js-api/element.js: (assert.throws): * wasm/js-api/global-error.js: (new.Number): * wasm/js-api/table.js: (assert.throws): (new.WebAssembly.Table): * wasm/js-api/test_Data.js: * wasm/js-api/test_basic_api.js: (const.c.in.constructorProperties.switch): * wasm/js-api/test_memory.js: (test): (test.testMemImportError): Deleted. Source/JavaScriptCore: Reviewed by Mark Lam. As described here: WebAssembly/design#901 Some TypeError and RangeError are now converted to WebAssembly.LinkError. * CMakeLists.txt: add files * DerivedSources.make: add autoget .lut.h files * JavaScriptCore.xcodeproj/project.pbxproj: add files * builtins/BuiltinNames.h: new name LinkError * runtime/JSGlobalObject.h: auto-register LinkError using existing macro magic * wasm/JSWebAssembly.h: make the new includes available * wasm/js/JSWebAssemblyLinkError.cpp: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.cpp. (JSC::JSWebAssemblyLinkError::create): (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): (JSC::createWebAssemblyLinkError): * wasm/js/JSWebAssemblyLinkError.h: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.h. (JSC::JSWebAssemblyLinkError::create): * wasm/js/WebAssemblyInstanceConstructor.cpp: update as per spec change (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.cpp. (JSC::constructJSWebAssemblyLinkError): (JSC::callJSWebAssemblyLinkError): (JSC::WebAssemblyLinkErrorConstructor::create): (JSC::WebAssemblyLinkErrorConstructor::createStructure): (JSC::WebAssemblyLinkErrorConstructor::finishCreation): (JSC::WebAssemblyLinkErrorConstructor::WebAssemblyLinkErrorConstructor): (JSC::WebAssemblyLinkErrorConstructor::getConstructData): (JSC::WebAssemblyLinkErrorConstructor::getCallData): * wasm/js/WebAssemblyLinkErrorConstructor.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.h. * wasm/js/WebAssemblyLinkErrorPrototype.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.cpp. (JSC::WebAssemblyLinkErrorPrototype::create): (JSC::WebAssemblyLinkErrorPrototype::createStructure): (JSC::WebAssemblyLinkErrorPrototype::finishCreation): (JSC::WebAssemblyLinkErrorPrototype::WebAssemblyLinkErrorPrototype): * wasm/js/WebAssemblyLinkErrorPrototype.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.h. * wasm/js/WebAssemblyModuleRecord.cpp: update as per spec change (JSC::dataSegmentFail): (JSC::WebAssemblyModuleRecord::evaluate): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=165805 <rdar://problem/29747874> JSTests: Reviewed by Mark lam. Update all exception sites which now throw WebAssembly.LinkError. * wasm/js-api/element-data.js: * wasm/js-api/element.js: (assert.throws): * wasm/js-api/global-error.js: (new.Number): * wasm/js-api/table.js: (assert.throws): (new.WebAssembly.Table): * wasm/js-api/test_Data.js: * wasm/js-api/test_basic_api.js: (const.c.in.constructorProperties.switch): * wasm/js-api/test_memory.js: (test): (test.testMemImportError): Deleted. Source/JavaScriptCore: Reviewed by Mark Lam. As described here: WebAssembly/design#901 Some TypeError and RangeError are now converted to WebAssembly.LinkError. * CMakeLists.txt: add files * DerivedSources.make: add autoget .lut.h files * JavaScriptCore.xcodeproj/project.pbxproj: add files * builtins/BuiltinNames.h: new name LinkError * runtime/JSGlobalObject.h: auto-register LinkError using existing macro magic * wasm/JSWebAssembly.h: make the new includes available * wasm/js/JSWebAssemblyLinkError.cpp: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.cpp. (JSC::JSWebAssemblyLinkError::create): (JSC::JSWebAssemblyLinkError::JSWebAssemblyLinkError): (JSC::createWebAssemblyLinkError): * wasm/js/JSWebAssemblyLinkError.h: Copied from Source/JavaScriptCore/wasm/JSWebAssemblyCompileError.h. (JSC::JSWebAssemblyLinkError::create): * wasm/js/WebAssemblyInstanceConstructor.cpp: update as per spec change (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.cpp. (JSC::constructJSWebAssemblyLinkError): (JSC::callJSWebAssemblyLinkError): (JSC::WebAssemblyLinkErrorConstructor::create): (JSC::WebAssemblyLinkErrorConstructor::createStructure): (JSC::WebAssemblyLinkErrorConstructor::finishCreation): (JSC::WebAssemblyLinkErrorConstructor::WebAssemblyLinkErrorConstructor): (JSC::WebAssemblyLinkErrorConstructor::getConstructData): (JSC::WebAssemblyLinkErrorConstructor::getCallData): * wasm/js/WebAssemblyLinkErrorConstructor.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorConstructor.h. * wasm/js/WebAssemblyLinkErrorPrototype.cpp: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.cpp. (JSC::WebAssemblyLinkErrorPrototype::create): (JSC::WebAssemblyLinkErrorPrototype::createStructure): (JSC::WebAssemblyLinkErrorPrototype::finishCreation): (JSC::WebAssemblyLinkErrorPrototype::WebAssemblyLinkErrorPrototype): * wasm/js/WebAssemblyLinkErrorPrototype.h: Copied from Source/JavaScriptCore/wasm/WebAssemblyCompileErrorPrototypr.h. * wasm/js/WebAssemblyModuleRecord.cpp: update as per spec change (JSC::dataSegmentFail): (JSC::WebAssemblyModuleRecord::evaluate): Canonical link: https://commits.webkit.org/183647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
In order to distinguish WebAssembly link-time failure from JS-level errors, introduce a new error class
WebAssembly.LinkError, which arises from instantiation in analogy toCompileErrorandRuntimeError. It indicates link-time type errors (function signatures, memory/table bounds mismatches), data/elem initialisation errors (out-of-bounds), and other potential future error causes. Traps from the start function will still raise aRuntimeError.Addresses #889.