aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wagner <luke@mozilla.com>2017-02-26 23:41:57 -0600
committerLuke Wagner <luke@mozilla.com>2017-02-26 23:41:57 -0600
commite9f707cef4e29eeeb93ff4fdc533e0f2b104ef6b (patch)
tree15c4568d0a11cda03928a2faca800ffcb8e216a6
parent1be98b3f11979a5ca7a42a5c69818313a46cbc81 (diff)
downloadnanowasm-design-e9f707cef4e29eeeb93ff4fdc533e0f2b104ef6b.tar.gz
Revert "Split out compileAndInstantiate from instantiate"
This reverts commit 1be98b3f11979a5ca7a42a5c69818313a46cbc81.
-rw-r--r--JS.md37
-rw-r--r--Web.md61
2 files changed, 10 insertions, 88 deletions
diff --git a/JS.md b/JS.md
index e0d7804..9aa4279 100644
--- a/JS.md
+++ b/JS.md
@@ -111,7 +111,8 @@ If neither of the following overloads match, then the returned `Promise` is
with a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
```
-Promise<WebAssembly.Instance> instantiate(BufferSource bytes [, importObject])
+Promise<{module:WebAssembly.Module, instance:WebAssembly.Instance}>
+ instantiate(BufferSource bytes [, importObject])
```
This description applies if the first argument is a
@@ -122,7 +123,8 @@ from `bytes` as described in the [`WebAssembly.Module` constructor](#webassembly
and then instantiate the resulting `Module` with `importObject` as described in the
[`WebAssembly.Instance` constructor](#webassemblyinstance-constructor).
On success, the `Promise` is [fulfilled](http://tc39.github.io/ecma262/#sec-fulfillpromise)
-with the instance.
+with a plain JavaScript object pair `{module, instance}` containing the resulting
+`WebAssembly.Module` and `WebAssembly.Instance`. The 2 properties `module` and `instance` of the returned pair are configurable, enumerable and writable.
On failure, the `Promise` is
[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
@@ -146,37 +148,6 @@ with the resulting `WebAssembly.Instance` object. 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.
-#### `WebAssembly.compileAndInstantiate`
-
-The `compileAndInstantiate` function has the signature:
-
-```
-Promise<{module:WebAssembly.Module, instance:WebAssembly.Instance}>
- compileAndInstantiate(BufferSource bytes [, importObject])
-```
-
-If the given `bytes` argument is not a
-[`BufferSource`](https://heycam.github.io/webidl/#common-BufferSource),
-the returned `Promise` is [rejected](http://tc39.github.io/ecma262/#sec-rejectpromise)
-with a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
-
-This function starts an asynchronous task that first compiles a `WebAssembly.Module`
-from `bytes` as described in the [`WebAssembly.Module` constructor](#webassemblymodule-constructor)
-and then instantiate the resulting `Module` with `importObject` as described in the
-[`WebAssembly.Instance` constructor](#webassemblyinstance-constructor).
-On success, the `Promise` is [fulfilled](http://tc39.github.io/ecma262/#sec-fulfillpromise)
-with a plain JavaScript object pair `{module, instance}` containing the resulting
-`WebAssembly.Module` and `WebAssembly.Instance`. The 2 properties `module` and
-`instance` of the returned pair are configurable, enumerable and writable.
-
-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.
-
-The asynchronous compilation is logically performed on a copy of the state of
-the given `BufferSource` captured during the call to `instantiate`; subsequent mutations
-of the `BufferSource` after `instantiate` return do not affect ongoing compilations.
-
## `WebAssembly.Module` Objects
A `WebAssembly.Module` object represents the stateless result of compiling a
diff --git a/Web.md b/Web.md
index 0cca3b1..48f9d7d 100644
--- a/Web.md
+++ b/Web.md
@@ -79,60 +79,11 @@ In Web embeddings, the following overloads are added (in addition to the core
JS API method of the same name).
```
-Promise<WebAssembly.Instance> instantiate(Response source [, importObject])
-
-Promise<WebAssembly.Instance> instantiate(Promise<Response> source [, importObject])
-```
-
-Developers can set the argument `source` with either a promise that resolves
-with a
-[`Response`](https://fetch.spec.whatwg.org/#response-class)
-object or a
-[`Response`](https://fetch.spec.whatwg.org/#response-class)
-object (which is automatically cast to a
-promise).
-If when unwrapped that `Promise` is not a `Response` object, then the returned `Promise` is
-[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise)
-with a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
-Renderer-side
-security checks about tainting for cross-origin content are tied to the types
-of filtered responses defined in
-[`Fetch`](https://fetch.spec.whatwg.org/#concept-fetch).
-
-This function starts an asynchronous task that first compiles a `WebAssembly.Module`
-based on bytes from `source` as described in
-the [`WebAssembly.Module` constructor](#webassemblymodule-constructor)
-and then instantiate the resulting `Module` with `importObject` as described in the
-[`WebAssembly.Instance` constructor](#webassemblyinstance-constructor).
-On success, the `Promise` is [fulfilled](http://tc39.github.io/ecma262/#sec-fulfillpromise)
-with the instance.
-
-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.
-
-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`.
-
-#### `WebAssembly.compileAndInstantiate`
-
-:cyclone: Added for milestone 2, developers must feature detect.
-
-In Web embeddings, the following overloads are added (in addition to the core
-JS API method of the same name).
-
-```
Promise<{module:WebAssembly.Module, instance:WebAssembly.Instance}>
- compileAndInstantiate(Response source [, importObject])
+ instantiate(Response source [, importObject])
Promise<{module:WebAssembly.Module, instance:WebAssembly.Instance}>
- compileAndInstantiate(Promise<Response> source [, importObject])
+ instantiate(Promise<Response> source [, importObject])
```
Developers can set the argument `source` with either a promise that resolves
@@ -151,16 +102,16 @@ of filtered responses defined in
[`Fetch`](https://fetch.spec.whatwg.org/#concept-fetch).
This function starts an asynchronous task that first compiles a `WebAssembly.Module`
-from `bytes` as described in the [`WebAssembly.Module` constructor](#webassemblymodule-constructor)
+based on bytes from `source` as described in
+the [`WebAssembly.Module` constructor](#webassemblymodule-constructor)
and then instantiate the resulting `Module` with `importObject` as described in the
[`WebAssembly.Instance` constructor](#webassemblyinstance-constructor).
On success, the `Promise` is [fulfilled](http://tc39.github.io/ecma262/#sec-fulfillpromise)
with a plain JavaScript object pair `{module, instance}` containing the resulting
-`WebAssembly.Module` and `WebAssembly.Instance`. The 2 properties `module` and
-`instance` of the returned pair are configurable, enumerable and writable.
+`WebAssembly.Module` and `WebAssembly.Instance`. The 2 properties `module` and `instance` of the returned pair are configurable, enumerable and writable.
On failure, the `Promise` is
-[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
+[rejected](http://tc39.github.io/ecma262/#sec-rejectpromise) with a
`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.