Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require an ok status for a response #1060

Merged
merged 3 commits into from
May 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions Web.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ as described in the [`WebAssembly.Module` constructor](#webassemblymodule-constr
On success, the `Promise` is [fulfilled](http://tc39.github.io/ecma262/#sec-fulfillpromise)
with the resulting `WebAssembly.Module` object. On failure, the `Promise` is
[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
`WebAssembly.CompileError`.
`WebAssembly.CompileError` or `TypeError`, depending on the type of failure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should we say "depending on the type of failure, as it will be clarified further below"

... or something to that extent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with what we had for instantiate, but happy to change both in this manner if others agree. Eventually we need to redo both these descriptions in a more formal matter once you all figure out how you want to define your objects (see #1048).


The `Promise<Response>` is used as the source of the bytes to compile.
MIME type information is
[`extracted`](https://fetch.spec.whatwg.org/#concept-header-extract-mime-type)
from the `Response`, WebAssembly `source` data must have a MIME type of `application/wasm`,
extra parameters are not allowed (including empty `application/wasm;`).
MIME type mismatch or `opaque` response types
[reject](http://tc39.github.io/ecma262/#sec-rejectpromise) the Promise with a
A MIME type mismatch, a response whose
[type](https://fetch.spec.whatwg.org/#concept-response-type) is not "basic", "cors", or
"default", or a response whose status is not an
[ok status](https://fetch.spec.whatwg.org/#ok-status), must cause the Promise to be
[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
`TypeError`.

#### `WebAssembly.instantiate`
Expand Down Expand Up @@ -112,16 +115,20 @@ with a plain JavaScript object pair `{module, instance}` containing the resultin

On failure, the `Promise` is
[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
`WebAssembly.CompileError`, `WebAssembly.LinkError`, or `WebAssembly.RuntimeError`, depending on the cause of failure.
`TypeError`, `WebAssembly.CompileError`, `WebAssembly.LinkError`, or `WebAssembly.RuntimeError`,
depending on the cause of failure.

The `Promise<Response>` is used as the source of the bytes to compile.
MIME type information is
[`extracted`](https://fetch.spec.whatwg.org/#concept-header-extract-mime-type)
from the `Response`, WebAssembly `source` data must have a MIME type of `application/wasm`,
extra parameters are not allowed (including empty `application/wasm;`).
MIME type mismatch or `opaque` response types
[reject](http://tc39.github.io/ecma262/#sec-rejectpromise) the Promise with a
`WebAssembly.CompileError`.
A MIME type mismatch, a response whose
[type](https://fetch.spec.whatwg.org/#concept-response-type) is not "basic", "cors", or
"default", or a response whose status is not an
[ok status](https://fetch.spec.whatwg.org/#ok-status), must cause the Promise to be
[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
`TypeError`.

## Modules

Expand Down