From 148e1c9369f940cff0798bd11387d3c02ad39c84 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 1 Jun 2022 19:30:11 +0200 Subject: [PATCH] Honor Content-Type on responses for encoding purposes --- fetch.bs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 932f65151..3accfd774 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3093,9 +3093,19 @@ and a response response, is to run these steps:

If there is an exception, response is not JSON. If there is not, it is. +

  • Let potentialMIMETypeForEncoding be the result of extracting a MIME type + given response's header list. + +

  • +

    Let encoding be the result of legacy extracting an encoding given + potentialMIMETypeForEncoding and request's + no-cors JavaScript fallback encoding. + +

    Equivalently to fetch a classic script, this ignores the + MIME type essence. +

  • Let sourceText be the result of decoding - responseBodyBytes given request's - no-cors JavaScript fallback encoding. + responseBodyBytes given encoding.

  • If ParseText(sourceText, Script) returns a Script Record, then return true.