From 51ff50a1f4f580e8d3bc185fd83479fdbb62ca7a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 17 Feb 2023 12:26:24 +0100 Subject: [PATCH] [web-api] Correct MIME type check. (#1537) Fixes #1138. --- document/web-api/index.bs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/document/web-api/index.bs b/document/web-api/index.bs index 1e74e09414..64c8ecf383 100644 --- a/document/web-api/index.bs +++ b/document/web-api/index.bs @@ -69,6 +69,7 @@ url:https://fetch.spec.whatwg.org/#concept-body-consume-body;text:consume body;t @@ -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;` ``.