Skip to content

Commit

Permalink
[web-api] Correct MIME type check. (WebAssembly#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger authored and rossberg committed Mar 1, 2023
1 parent 29d23e8 commit eccf966
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions document/web-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ url:https://fetch.spec.whatwg.org/#concept-body-consume-body;text:consume body;t

<pre class='link-defaults'>
spec:ecma-262; type:exception; for:ECMAScript; text:TypeError
spec:fetch; type:dfn; text:get
spec:webidl; type:dfn; text:resolve
</pre>

Expand Down Expand Up @@ -111,8 +112,10 @@ Note: This algorithm accepts a {{Response}} object, or a
1. Let |returnValue| be [=a new promise=]
1. [=Upon fulfillment=] of |source| with value |unwrappedSource|:
1. Let |response| be |unwrappedSource|'s [=Response/response=].
1. Let |mimeType| be the result of [=extracting a MIME type=] from |response|'s [=response/header list=].
1. If |mimeType| is not `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.
1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=].
1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps.
1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|.
1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps.

Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``.

Expand Down

0 comments on commit eccf966

Please sign in to comment.