Closed Bug 1324116 Opened 9 years ago Closed 9 years ago

Baldr: add WebAssembly.LinkError and throw it for errors during instantiation

Categories

(Core :: JavaScript Engine: JIT, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(1 file, 1 obsolete file)

Component: JavaScript Engine → JavaScript Engine: JIT
Attached patch link-error (obsolete) — Splinter Review
Attachment #8821284 - Flags: review?(bbouvier)
Comment on attachment 8821284 [details] [diff] [review] link-error Review of attachment 8821284 [details] [diff] [review]: ----------------------------------------------------------------- Thanks, there's still one case where the spec says to throw a TypeError and we'd now throw a LinkError, so cancelling review until either the spec or our code gets fixed. For what it's worth, the spec proto also shows two other implicit uses of LinkError: - https://github.com/WebAssembly/spec/blob/master/interpreter/spec/eval.ml#L425, which I think we can't have by construction (looks like it could be an assert in the spec proto). - https://github.com/WebAssembly/spec/blob/master/interpreter/spec/eval.ml#L405, which I also think we can't have by construction (we create imports and control their kinds; that being said, we could and should provide a default case in GetImports's switch, just in case something gets terribly wrong) ::: js/src/jit-test/tests/wasm/basic.js @@ +104,5 @@ > > var code = '(module (import "a" "b"))'; > assertErrorMessage(() => wasmEvalText(code), TypeError, noImportObj); > +assertErrorMessage(() => wasmEvalText(code, {}), LinkError, notObject); > +assertErrorMessage(() => wasmEvalText(code, {a:1}), LinkError, notObject); (see other comment: the last two should still be TypeErrors per spec) ::: js/src/js.msg @@ +358,5 @@ > MSG_DEF(JSMSG_USE_ASM_TYPE_OK, 1, JSEXN_WARN, "Successfully compiled asm.js code ({0})") > > // wasm > MSG_DEF(JSMSG_WASM_COMPILE_ERROR, 1, JSEXN_WASMCOMPILEERROR, "{0}") > +MSG_DEF(JSMSG_WASM_BAD_IMPORT_FIELD, 2, JSEXN_WASMLINKERROR, "import object field '{0}' is not {1}") This error is used when importObject[module_name] is not an object, but the spec (step 2) still says this should be a TypeError, so we have a discrepancy here and one of both sides has to be fixed.
Attachment #8821284 - Flags: review?(bbouvier)
Good catch!
Attached patch link-errorSplinter Review
Attachment #8821284 - Attachment is obsolete: true
Attachment #8821608 - Flags: review?(bbouvier)
Comment on attachment 8821608 [details] [diff] [review] link-error Review of attachment 8821608 [details] [diff] [review]: ----------------------------------------------------------------- Great, thanks
Attachment #8821608 - Flags: review?(bbouvier) → review+
Priority: -- → P1
Pushed by lwagner@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/67286eb47060 Baldr: add WebAssembly.LinkError and throw it for errors during instantiation (r=bbouvier)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: