WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: document/js-api/index.bs
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -639,15 +639,17 @@ The verification of WebAssembly type requirements is deferred to the
639
639
To <dfn>instantiate a promise of a module</dfn> |promiseOfModule| with imports |importObject|, perform the following steps:
640
640
641
641
1. Let |promise| be [=a new promise=].
642
-
1. [=Upon fulfillment=] of |promiseOfModule| with value |module|:
643
-
1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result.
644
-
1. [=Upon fulfillment=] of |innerPromise| with value |instance|.
645
-
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
646
-
1. [=Resolve=] |promise| with |result|.
647
-
1. [=Upon rejection=] of |innerPromise| with reason |reason|:
642
+
1. [=React=] to |promiseOfModule|:
643
+
* If |promiseOfModule| was fulfilled with value |module|:
644
+
1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result.
645
+
1. [=React=] to |innerPromise|:
646
+
* If |innerPromise| was fulfilled with value |instance|.
647
+
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
648
+
1. [=Resolve=] |promise| with |result|.
649
+
* If |innerPromise| was rejected with reason |reason|:
650
+
1. [=Reject=] |promise| with |reason|.
651
+
* If |promiseOfModule| was rejected with reason |reason|:
648
652
1. [=Reject=] |promise| with |reason|.
649
-
1. [=Upon rejection=] of |promiseOfModule| with reason |reason|:
Copy file name to clipboardExpand all lines: document/web-api/index.bs
+25-23Lines changed: 25 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -117,30 +117,32 @@ Note: This algorithm accepts a {{Response}} object, or a
117
117
{{CompileError}} or other relevant error type, depending on the cause of failure.
118
118
119
119
120
-
1. Let |returnValue| be [=a new promise=]
121
-
1. [=Upon fulfillment=] of |source| with value |unwrappedSource|:
122
-
1. Let |response| be |unwrappedSource|'s [=Response/response=].
123
-
1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=].
124
-
1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps.
125
-
1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|.
126
-
1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.
127
-
128
-
Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``.
129
-
130
-
1. If |response| is not [=CORS-same-origin=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps.
131
-
1. If |response|'s [=response/status=] is not an [=ok status=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps.
132
-
1. [=Consume body|Consume=] |response|'s body as an {{ArrayBuffer}}, and let |bodyPromise| be the result.
133
-
134
-
Note: Although it is specified here that the response is consumed entirely before compilation proceeds, that is purely for ease of specification; implementations are likely to instead perform processing in a streaming fashion. The difference is unobservable, and thus the simpler model is specified. <!-- Using consume is a bit silly as it creates an ArrayBuffer but then we just want the underlying bytes. This is because of how streams is specced in terms of promises and JS objects whereas we want to operate more directly on the underlying concept. We can revisit this if things change in the Streams/Fetch specs. -->
135
-
136
-
1. [=Upon fulfillment=] of |bodyPromise| with value |bodyArrayBuffer|:
137
-
1. Let |stableBytes| be a [=get a copy of the buffer source|copy of the bytes held by the buffer=] |bodyArrayBuffer|.
138
-
1. [=Asynchronously compile a WebAssembly module|Asynchronously compile the WebAssembly module=] |stableBytes| using the [=networking task source=] and |options| and [=resolve=] |returnValue| with the result.
139
-
1. [=Upon rejection=] of |bodyPromise| with reason |reason|:
120
+
1. Let |returnValue| be [=a new promise=].
121
+
1. [=React=] to |source|:
122
+
* If |source| was fulfilled with value |unwrappedSource|:
123
+
1. Let |response| be |unwrappedSource|'s [=Response/response=].
124
+
1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=].
125
+
1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps.
126
+
1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|.
127
+
1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.
128
+
129
+
Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``.
130
+
131
+
1. If |response| is not [=CORS-same-origin=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps.
132
+
1. If |response|'s [=response/status=] is not an [=ok status=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps.
133
+
1. [=Consume body|Consume=] |response|'s body as an {{ArrayBuffer}}, and let |bodyPromise| be the result.
134
+
135
+
Note: Although it is specified here that the response is consumed entirely before compilation proceeds, that is purely for ease of specification; implementations are likely to instead perform processing in a streaming fashion. The difference is unobservable, and thus the simpler model is specified. <!-- Using consume is a bit silly as it creates an ArrayBuffer but then we just want the underlying bytes. This is because of how streams is specced in terms of promises and JS objects whereas we want to operate more directly on the underlying concept. We can revisit this if things change in the Streams/Fetch specs. -->
136
+
137
+
1. [=React=] to |bodyPromise|:
138
+
* If |bodyPromise| was fulfilled with value |bodyArrayBuffer|:
139
+
1. Let |stableBytes| be a [=get a copy of the buffer source|copy of the bytes held by the buffer=] |bodyArrayBuffer|.
140
+
1. [=Asynchronously compile a WebAssembly module|Asynchronously compile the WebAssembly module=] |stableBytes| using the [=networking task source=] and |options| and [=resolve=] |returnValue| with the result.
141
+
* If |bodyPromise| was rejected with reason |reason|:
142
+
1. [=Reject=] |returnValue| with |reason|.
143
+
* If |source| was rejected with reason |reason|:
140
144
1. [=Reject=] |returnValue| with |reason|.
141
-
1. [=Upon rejection=] of |source| with reason |reason|:
0 commit comments