From 646706cbf1374713678b2a7d43565f49b286a3e5 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 09:28:19 +0200 Subject: [PATCH 1/5] Editorial: align with new IDL patterns Use "this" and "x steps are". Also use the relevant settings object in constructors, rather than current. (They are identical there, but it's better to encourage relevant.) --- fetch.bs | 374 +++++++++++++++++++++++++------------------------------ 1 file changed, 168 insertions(+), 206 deletions(-) diff --git a/fetch.bs b/fetch.bs index bf9966c62..121629cfc 100644 --- a/fetch.bs +++ b/fetch.bs @@ -94,12 +94,6 @@ url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2; } - - -

Goals

@@ -5530,9 +5524,8 @@ objects. remove privileged no-CORS request headers from headers. -

To fill a -{{Headers}} object (headers) with a given object (object), -run these steps: +

To fill a {{Headers}} object +headers with a given object object, run these steps:

  1. @@ -5569,76 +5562,66 @@ from a {{Headers}} object (headers), run these steps:

    This is called when headers are modified by unprivileged code.

    The -Headers(init) -constructor, when invoked, must run these steps: +new Headers(init) +constructor steps are:

      -
    1. Let headers be a new {{Headers}} object whose - guard is "none". - -

    2. If init is given, then fill headers with - init. +

    3. Set this's guard to "none". -

    4. Return headers. +

    5. If init is given, then fill this with init.

    The append(name, value) -method, when invoked, must append name/value to the -context object. +method steps are to append name/value to this. -

    The delete(name) -method, when invoked, must run these steps: +

    The delete(name) method steps are:

    1. If name is not a name, then throw a {{TypeError}}. -

    2. If the context object's guard is "immutable", then - throw a {{TypeError}}. +

    3. If this's guard is "immutable", then throw a + {{TypeError}}. -

    4. Otherwise, if the context object's guard is "request" - and name is a forbidden header name, return. +

    5. Otherwise, if this's guard is "request" and + name is a forbidden header name, return. -

    6. Otherwise, if the context object's guard is - "request-no-cors", name is not a - no-CORS-safelisted request-header name, and name is not a - privileged no-CORS request-header name, return. +

    7. Otherwise, if this's guard is "request-no-cors", + name is not a no-CORS-safelisted request-header name, and name is not + a privileged no-CORS request-header name, return. -

    8. Otherwise, if the context object's guard is - "response" and name is a forbidden response-header name, return. +

    9. Otherwise, if this's guard is "response" and + name is a forbidden response-header name, return. -

    10. If the context object's header list does not - contain name, then return. +

    11. If this's header list does not contain + name, then return. -

    12. Delete name from the context object's +

    13. Delete name from this's header list. -

    14. If the context object's guard is "request-no-cors", - then remove privileged no-CORS request headers from the context object. +

    15. If this's guard is "request-no-cors", then + remove privileged no-CORS request headers from this.

    -

    The get(name) method, when -invoked, must run these steps: +

    The get(name) method steps are:

    1. If name is not a name, then throw a {{TypeError}}. -

    2. Return the result of getting name from the - context object's header list. +

    3. Return the result of getting name from this's + header list.

    -

    The has(name) method, -when invoked, must run these steps: +

    The has(name) method steps are:

    1. If name is not a name, then throw a {{TypeError}}. -

    2. Return true if the context object's header list - contains name, and false otherwise. +

    3. Return true if this's header list + contains name; otherwise false.

    -

    The -set(name, value) -method, when invoked, must run these steps: +

    The set(name, value) +method steps are:

    1. Normalize value. @@ -5646,29 +5629,27 @@ method, when invoked, must run these steps:

    2. If name is not a name or value is not a value, then throw a {{TypeError}}. -

    3. If the context object's guard is "immutable", then - throw a {{TypeError}}. +

    4. If this's guard is "immutable", then throw a + {{TypeError}}. -

    5. Otherwise, if the context object's guard is "request" - and name is a forbidden header name, return. +

    6. Otherwise, if this's guard is "request" and + name is a forbidden header name, return. -

    7. Otherwise, if the context object's guard is - "request-no-cors" and name/value is not a - no-CORS-safelisted request-header, return. +

    8. Otherwise, if this's guard is "request-no-cors" and + name/value is not a no-CORS-safelisted request-header, return. -

    9. Otherwise, if the context object's guard is - "response" and name is a forbidden response-header name, return. +

    10. Otherwise, if this's guard is "response" and + name is a forbidden response-header name, return. -

    11. Set name/value in the context object's +

    12. Set name/value in this's header list. -

    13. If the context object's guard is "request-no-cors", - then remove privileged no-CORS request headers from the context object. +

    14. If this's guard is "request-no-cors", then + remove privileged no-CORS request headers from this.

    The value pairs to iterate over are the return value of running -sort and combine with the context object's -header list. +sort and combine with this's header list.

    Body mixin

    @@ -5822,20 +5803,20 @@ due course. a MIME type (failure or a MIME type).

    An object implementing the {{Body}} mixin is said to be -disturbed if body is -non-null and its stream is -disturbed. +disturbed if its body is +non-null and its stream is disturbed.

    An object implementing the {{Body}} mixin is said to be locked if body is non-null and its stream is locked. -

    The body attribute's getter must return null if -body is null and body's stream otherwise. +

    The body getter steps are to return null if +this's body is null; otherwise this's body's +stream. -

    The bodyUsed attribute's getter must -return true if disturbed, and false otherwise. +

    The bodyUsed getter steps are to return true if +this is disturbed; otherwise false.

    Objects implementing the {{Body}} mixin also have an associated package data algorithm, given @@ -5946,25 +5927,20 @@ runs these steps: https://www.w3.org/2001/tag/doc/promises-guide -->

-

The arrayBuffer() -method, when invoked, must return the result of running -consume body with ArrayBuffer. +

The arrayBuffer() method steps are to return the result +of running consume body with ArrayBuffer. -

The blob() method, when -invoked, must return the result of running -consume body with Blob. +

The blob() method steps are to return the result of +running consume body with Blob. -

The formData() method, -when invoked, must return the result of running -consume body with FormData. +

The formData() method steps are to return the result of +running consume body with FormData. -

The json() method, when -invoked, must return the result of running -consume body with JSON. +

The json() method steps are to return the result of +running consume body with JSON. -

The text() method, when -invoked, must return the result of running -consume body with text. +

The text() method steps are to return the result of +running consume body with text.

Request class

@@ -6169,8 +6145,8 @@ initially a new {{AbortSignal}} object.

The -Request(input, init) -constructor must run these steps: +new Request(input, init) +constructor steps are:

  1. Let request be null. @@ -6179,7 +6155,7 @@ constructor must run these steps:

  2. Let fallbackCredentials be null. -

  3. Let baseURL be current settings object's +

  4. Let baseURL be this's relevant settings object's API base URL.

  5. Let signal be null. @@ -6206,16 +6182,18 @@ constructor must run these steps:

  • -

    Otherwise (input is a {{Request}} object): +

    Otherwise:

      +
    1. Assert: input is a {{Request}} object. +

    2. Set request to input's request.

    3. Set signal to input's signal.

    -
  • Let origin be current settings object's +

  • Let origin be this's relevant settings object's origin.

  • Let window be "client". @@ -6223,7 +6201,7 @@ constructor must run these steps:

  • If request's window is an environment settings object and its origin is same origin with - origin, set window to request's + origin, then set window to request's window.

  • If init["{{RequestInit/window}}"] exists and is non-null, then @@ -6408,12 +6386,12 @@ constructor must run these steps:

  • If init["{{RequestInit/signal}}"] exists, then set signal to it. -

  • Let r be a new {{Request}} object associated with request. +

  • Set this's request to request. -

  • If signal is not null, then make r's signal +

  • If signal is not null, then make this's signal follow signal. -

  • Set r's headers to a new {{Headers}} object, whose +

  • Set this's headers to a new {{Headers}} object, whose header list is request's header list, and guard is "request". @@ -6425,23 +6403,23 @@ constructor must run these steps: API.

      -
    1. Let headers be a copy of r's headers and its +

    2. Let headers be a copy of this's headers and its associated header list.

    3. If init["{{RequestInit/headers}}"] exists, then set headers to init["{{RequestInit/headers}}"]. -

    4. Empty r's headers's header list. +

    5. Empty this's headers's header list.

    6. -

      If r's request's mode is +

      If this's request's mode is "no-cors", then:

        -
      1. If r's request's method is not a +

      2. If this's request's method is not a CORS-safelisted method, then throw a {{TypeError}}. -

      3. Set r's headers's guard to +

      4. Set this's headers's guard to "request-no-cors".

    7. @@ -6449,9 +6427,9 @@ constructor must run these steps:
    8. If headers is a Headers object, then for each header in its header list, append header's name/header's value to - r's {{Headers}} object. + this's headers. -

    9. Otherwise, fill r's {{Headers}} object with +

    10. Otherwise, fill this's headers with headers.

  • @@ -6479,20 +6457,20 @@ constructor must run these steps:
  • Otherwise, set body and Content-Type to the result of extracting init["{{RequestInit/body}}"]. -

  • If Content-Type is non-null and r's headers's +

  • If Content-Type is non-null and this's headers's header list does not contain `Content-Type`, then append - `Content-Type`/Content-Type to r's headers. + `Content-Type`/Content-Type to this's headers.

  • If body is non-null and body's source is null, then:

      -
    1. If r's request's mode is neither +

    2. If this's request's mode is neither "same-origin" nor "cors", then throw a {{TypeError}}. -

    3. Set r's request's +

    4. Set this's request's use-CORS-preflight flag.

    @@ -6524,84 +6502,75 @@ constructor must run these steps: whose total bytes is inputBody's total bytes. -
  • Set r's request's body to body. +

  • Set this's request's body to body. -

  • Set r's MIME type to the result of - extracting a MIME type from r's request's +

  • Set this's MIME type to the result of + extracting a MIME type from this's request's header list. - -

  • Return r. -

    The method attribute's getter, when invoked, must -return the context object's request's method. +

    The method getter steps are to return this's +request's method. -

    The url attribute's getter, when invoked, must -return the context object's request's URL, -serialized. +

    The url getter steps are to return this's +request's URL, serialized. -

    The headers attribute's getter, when invoked, must -return the context object's headers. +

    The headers getter steps are to return +this's headers. -

    The destination attribute's getter, when invoked, -must return the context object's request's destination. +

    The destination getter are to return this's +request's destination. -

    The referrer attribute's getter, when invoked, must -return the empty string if the context object's request's -referrer is "no-referrer", "about:client" if the -context object's request's referrer is -"client", and the context object's request's -referrer, serialized, otherwise. +

    The referrer getter steps are to return +the empty string if this's request's referrer is +"no-referrer", "about:client" if this's +request's referrer is "client"; otherwise +this's request's referrer, +serialized. -

    The referrerPolicy attribute's getter, when -invoked, must return the context object's request's -referrer policy. +

    The referrerPolicy getter steps are to return +this's request's referrer policy. -

    The mode attribute's getter, when invoked, must -return the context object's request's mode. +

    The mode getter steps are to return this's +request's mode. -

    The credentials attribute's getter, when invoked, -must return the context object's request's -credentials mode. +

    The credentials getter steps are to return +this's request's credentials mode. -

    The cache attribute's getter, when invoked, must -return the context object's request's cache mode. +

    The cache getter steps are to return this's +request's cache mode. -

    The redirect attribute's getter, when invoked, must -return the context object's request's redirect mode. +

    The redirect getter steps are to return +this's request's redirect mode. -

    The integrity attribute's getter, when invoked, -must return the context object's request's -integrity metadata. +

    The integrity getter steps are to return +this's request's integrity metadata. -

    The keepalive attribute's getter, when invoked, -must return true if the context object's request's keepalive flag -is set, and false otherwise. +

    The keepalive getter steps are to return true if +this's request's keepalive flag is set; otherwise false. -

    The isReloadNavigation attribute's getter, when -invoked, must return true if the context object's request's -reload-navigation flag is set, and false otherwise. +

    The isReloadNavigation getter steps are to return +true if this's request's reload-navigation flag is set; +otherwise false. -

    The isHistoryNavigation attribute's getter, when -invoked, must return true if the context object's request's -history-navigation flag is set, and false otherwise. +

    The isHistoryNavigation getter steps are to return +true if this's request's history-navigation flag is +set; otherwise false. -

    The signal attribute's getter, when invoked, must -return the context object's signal. +

    The signal getter steps are to return this's +signal.


    -

    The clone() method, when invoked, must -run these steps: +

    The clone() method steps are:

      -
    1. If the context object is disturbed or locked, then - throw a {{TypeError}}. +

    2. If this is disturbed or locked, then throw a + {{TypeError}}.

    3. Let clonedRequestObject be a new {{Request}} object. -

    4. Let clonedRequest be the result of cloning the - context object's request. +

    5. Let clonedRequest be the result of cloning this's request.

    6. Set clonedRequestObject's request to clonedRequest. @@ -6614,12 +6583,12 @@ run these steps:

      clonedRequest's header list.
      guard -
      The context object's headers's guard. +
      This's headers's guard.
    7. Make clonedRequestObject's signal - follow the context object's signal. + follow this's signal.

    8. Return clonedRequestObject.

    @@ -6667,8 +6636,8 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire response's body.

    The -Response(body, init) -constructor, when invoked, must run these steps: +new Response(body, init) +constructor steps are:

    1. If init["{{ResponseInit/status}}"] is not in the range 200 to @@ -6677,20 +6646,20 @@ constructor, when invoked, must run these steps:

    2. If init["{{ResponseInit/statusText}}"] does not match the reason-phrase token production, then throw a {{TypeError}}. -

    3. Let r be a new {{Response}} object associated with a new response. +

    4. Set this's response to a new response. -

    5. Set r's headers to a new {{Headers}} object, whose +

    6. Set this's headers to a new {{Headers}} object, whose header list is r's response's header list, and guard is "response". -

    7. Set r's response's status to +

    8. Set this's response's status to init["{{ResponseInit/status}}"]. -

    9. Set r's response's status message to +

    10. Set this's response's status message to init["{{ResponseInit/statusText}}"].

    11. If init["{{ResponseInit/headers}}"] exists, then - fill r's headers with + fill this's headers with init["{{ResponseInit/headers}}"].

    12. @@ -6706,30 +6675,26 @@ constructor, when invoked, must run these steps:
    13. Let Content-Type be null. -

    14. Set r's response's body and +

    15. Set this's response's body and Content-Type to the result of extracting body. -

    16. If Content-Type is non-null and r's response's +

    17. If Content-Type is non-null and this's response's header list does not contain `Content-Type`, then append - `Content-Type`/Content-Type to r's + `Content-Type`/Content-Type to this's response's header list.

    -
  • Set r's MIME type to the result of - extracting a MIME type from r's response's +

  • Set this's MIME type to the result of + extracting a MIME type from this's response's header list. -

  • Set r's response's - HTTPS state to - current settings object's +

  • Set this's response's HTTPS state to + this's relevant settings object's HTTPS state. - -

  • Return r. -

    The static error() method, when invoked, must run -these steps: +

    The static error() method steps are:

    1. Let r be a new {{Response}} object, whose response is a new @@ -6742,8 +6707,8 @@ these steps:

    The static -redirect(url, status) -method, when invoked, must run these steps: +redirect(url, status) method steps +are:

    1. Let parsedURL be the result of @@ -6772,57 +6737,54 @@ method, when invoked, must run these steps:

    2. Return r.

    -

    The type attribute's getter, when invoked, must -return the context object's response's type. +

    The type getter steps are to return this's +response's type. -

    The url attribute's getter, when invoked, must -return the empty string if the context object's response's -URL is null and the context object's response's -URL, serialized with the exclude-fragment flag -set, otherwise. [[!URL]] +

    The url getter steps are to return +the empty string if this's response's URL is null; +otherwise this's response's URL, +serialized with the exclude-fragment flag set. [[!URL]] -

    The redirected attribute's getter, when invoked, -must return true if the context object's response's -URL list has more than one item, and false otherwise. +

    The redirected getter steps are to return true if +this's response's URL list has more than one item; +otherwise false.

    To filter out responses that are the result of a redirect, do this directly through the API, e.g., fetch(url, { redirect:"error" }). This way a potentially unsafe response cannot accidentally leak. -

    The status attribute's getter, when invoked, must -return the context object's response's status. +

    The status getter steps are to return +this's response's status. -

    The ok attribute's getter, when invoked, must -return true if the context object's response's status -is an ok status, and false otherwise. +

    The ok getter steps are to return true if +this's response's status is an ok status; +otherwise false. -

    The statusText attribute's getter, when invoked, -must return the context object's response's -status message. +

    The statusText getter steps are to return +this's response's status message. -

    The headers attribute's getter, when invoked, must -return the context object's headers. +

    The headers getter steps are to return +this's headers.


    -

    The clone() method, when invoked, must -run these steps: +

    The clone() method steps are:

      -
    1. If the context object is disturbed or locked, then - throw a {{TypeError}}. +

    2. If this is disturbed or locked, then throw a + {{TypeError}}.

    3. Let clonedResponseObject be a new {{Response}} object. -

    4. Let clonedResponse be the result of cloning the - context object's response. +

    5. Let clonedResponse be the result of cloning + this's response.

    6. Set clonedResponseObject's response to clonedResponse.

    7. Set clonedResponseObject's headers to a new {{Headers}} object whose header list is set to clonedResponse's - header list, and guard is the context object's + header list, and guard is this's headers's guard.

    8. Return clonedResponseObject. @@ -6841,7 +6803,7 @@ partial interface mixin WindowOrWorkerGlobalScope {

      The fetch(input, init) -method, must run these steps: +method steps are:

      1. Let p be a new promise. From 144624271c2d4f64bf3b149212c5e9da267a6c1a Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 10:19:57 +0200 Subject: [PATCH 2/5] adopt some promise language from IDL too --- fetch.bs | 65 ++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/fetch.bs b/fetch.bs index 121629cfc..21484ec16 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2450,7 +2450,7 @@ from a {{ReadableStream}} object with reader, run these steps:

        error steps, given e
          -
        1. Reject promise with e. +

        2. Reject promise with e.

        @@ -5804,12 +5804,12 @@ a MIME type (failure or a An object implementing the {{Body}} mixin is said to be disturbed if its body is -non-null and its stream is disturbed. +non-null and its body's stream is +disturbed.

        An object implementing the {{Body}} mixin is said to be -locked if body is -non-null and its stream is -locked. +locked if its body is non-null and +its body's stream is locked.

        The body getter steps are to return null if this's body is null; otherwise this's body's @@ -5818,10 +5818,9 @@ non-null and its stream is

        The bodyUsed getter steps are to return true if this is disturbed; otherwise false. -

        Objects implementing the {{Body}} mixin also have an associated -package data algorithm, given -bytes, a type and a mimeType, switches on type, and -runs the associated steps: +

        The package data algorithm, given +bytes, type, and a mimeType, switches on type, and runs +the associated steps:

        ArrayBuffer @@ -5898,33 +5897,29 @@ runs the associated steps: bytes.
        -

        Objects implementing the {{Body}} mixin also have an associated -consume body algorithm, given a type, -runs these steps: +

        The consume body algorithm, given an +object and type, runs these steps:

          -
        1. If this object is disturbed or locked, return a new promise - rejected with a {{TypeError}}. +

        2. If object is disturbed or locked, then return a + rejected promise with a {{TypeError}}. -

        3. Let stream be body's - stream if body is - non-null, or an empty - {{ReadableStream}} object otherwise. +

        4. Let stream be object's body's stream + if object's body is non-null; otherwise an empty + {{ReadableStream}} object. -

        5. Let reader be the result of getting - a reader from stream. If that threw an exception, return a new promise rejected - with that exception. +

        6. Let reader be the result of + getting a reader from stream. If that threw + an exception, return a rejected promise with that exception.

        7. Let promise be the result of - reading all bytes from - stream with reader. - -

        8. Return the result of transforming promise by a fulfillment handler that - returns the result of the package data algorithm - with its first argument, type and this object's - MIME type. - + reading all bytes from stream with + reader. + +

        9. Let steps be to return the result of package data with the first argument + given, type, and object's MIME type. + +

        10. Return the result of upon fulfillment of promise given steps.

        The arrayBuffer() method steps are to return the result @@ -6810,7 +6805,7 @@ method steps are:

      2. Let requestObject be the result of invoking the initial value of {{Request}} as constructor with input and init as arguments. If this throws an exception, - reject p with it and return p. + reject p with it and return p.

      3. Let request be requestObject's request. @@ -6865,12 +6860,12 @@ method steps are: with p, request, and responseObject, and terminate these substeps. -

      4. If response is a network error, then reject p with a - {{TypeError}} and terminate these substeps. +

      5. If response is a network error, then reject p + with a {{TypeError}} and terminate these substeps.

      6. Associate responseObject with response. -

      7. Resolve p with responseObject. +

      8. Resolve p with responseObject.

    9. Return p. @@ -6883,7 +6878,7 @@ method steps are:

    10. Let error be an "AbortError" {{DOMException}}.

    11. -

      Reject promise with error. +

      Reject promise with error.

      This is a no-op if promise has already fulfilled. From 814c82c13fc6e46766dafbce9498f2e298bbabab Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 10:21:10 +0200 Subject: [PATCH 3/5] give consume body something to work with --- fetch.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index 21484ec16..80e46bec9 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5923,19 +5923,19 @@ the associated steps:

    The arrayBuffer() method steps are to return the result -of running consume body with ArrayBuffer. +of running consume body with this and ArrayBuffer.

    The blob() method steps are to return the result of -running consume body with Blob. +running consume body with this and Blob.

    The formData() method steps are to return the result of -running consume body with FormData. +running consume body with this and FormData.

    The json() method steps are to return the result of -running consume body with JSON. +running consume body with this and JSON.

    The text() method steps are to return the result of -running consume body with text. +running consume body with this and text.

    Request class

    From 5597756642d647ff238574728566f7f2930b59f0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 10:24:48 +0200 Subject: [PATCH 4/5] nits --- fetch.bs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fetch.bs b/fetch.bs index 80e46bec9..a16c6f75b 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5901,8 +5901,8 @@ the associated steps: object and type, runs these steps:
      -
    1. If object is disturbed or locked, then return a - rejected promise with a {{TypeError}}. +

    2. If object is disturbed or locked, then return + a promise rejected with a {{TypeError}}.

    3. Let stream be object's body's stream if object's body is non-null; otherwise an empty @@ -5910,7 +5910,7 @@ the associated steps:

    4. Let reader be the result of getting a reader from stream. If that threw - an exception, return a rejected promise with that exception. + an exception, return a promise rejected with that exception.

    5. Let promise be the result of reading all bytes from stream with @@ -6565,7 +6565,8 @@ set; otherwise false.

    6. Let clonedRequestObject be a new {{Request}} object. -

    7. Let clonedRequest be the result of cloning this's request. +

    8. Let clonedRequest be the result of cloning + this's request.

    9. Set clonedRequestObject's request to clonedRequest. From 0744a98e6b92641f34d09fb72eea5a28d8b53b63 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 15 Jul 2020 07:51:24 +0200 Subject: [PATCH 5/5] feedback --- fetch.bs | 138 +++++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/fetch.bs b/fetch.bs index a16c6f75b..9057e3894 100644 --- a/fetch.bs +++ b/fetch.bs @@ -982,14 +982,11 @@ user-agent-defined value for the

      A status is a code. -

      A null body status is a status that is 101, -204, 205, or 304. +

      A null body status is a status that is 101, 204, 205, or 304. -

      An ok status is any status in the range 200 to -299, inclusive. +

      An ok status is any status in the range 200 to 299, inclusive. -

      A redirect status is a status that is 301, -302, 303, 307, or 308. +

      A redirect status is a status that is 301, 302, 303, 307, or 308.

      Bodies

      @@ -1822,8 +1819,8 @@ more response URLs). Unless stated otherwise, it is the empty list. atomic HTTP redirect handling.

      A response has an associated -status, which is a -status. Unless stated otherwise it is 200. +status, which is a status. +Unless stated otherwise it is 200.

      A response has an associated status message. Unless stated @@ -1906,9 +1903,8 @@ known as an aborted network errortype is "error" is known as a network error. -

      A network error is a -response whose -status is always 0, +

      A network error is a response whose +status is always 0, status message is always the empty byte sequence, header list is always empty, and body is always null. @@ -1954,7 +1950,7 @@ which is only "accessible" to internal specification algorithms and is never a filtered response whose type is "opaque", URL list is the empty list, -status is 0, +status is 0, status message is the empty byte sequence, header list is empty, and body is null. @@ -1963,7 +1959,7 @@ which is only "accessible" to internal specification algorithms and is never a opaque-redirect filtered response is a filtered response whose type is "opaqueredirect", -status is 0, +status is 0, status message is the empty byte sequence, header list is empty, and body is null. @@ -2712,8 +2708,8 @@ if the CORS protocol is understood. It uses `OPTIONS` as

      In case a server does not wish to participate in the CORS protocol, its HTTP response to the CORS or CORS-preflight request must not include any of the above -headers. The server is encouraged to use the 403 status in -such HTTP responses. +headers. The server is encouraged to use the 403 status in such HTTP +responses.

      HTTP new-header syntax

      @@ -3180,8 +3176,8 @@ run these steps:

    10. If mimeType is failure, then return allowed. -

    11. If response's status is 206 and - mimeType is a CORB-protected MIME type, then return blocked. +

    12. If response's status is 206 and mimeType is a + CORB-protected MIME type, then return blocked.

    13. If determine nosniff with response's header list is true @@ -3190,8 +3186,8 @@ run these steps:

      CORB only protects text/plain responses with a `X-Content-Type-Options: nosniff` header. Unfortunately, protecting such responses - without that header when their status is 206 would break too many - existing video responses that have a text/plain MIME type. + without that header when their status is 206 would break too many existing + video responses that have a text/plain MIME type. @@ -3779,11 +3775,10 @@ optionally with a recursive flag, run these steps:

    14. If response's type is "opaque", - internalResponse's status is 206, - internalResponse's range-requested flag is set, and - request's header list does not contain - `Range`, then set response and internalResponse to a - network error. + internalResponse's status is 206, internalResponse's + range-requested flag is set, and request's + header list does not contain `Range`, + then set response and internalResponse to a network error.

      Traditionally, APIs accept a ranged response even if a range was not requested. This prevents @@ -4116,8 +4111,8 @@ optional CORS-preflight flag, run these steps: network error.

      As the CORS check is not to be applied to - responses whose status is 304 or 407, - or responses from a service worker for that matter, it is applied here. + responses whose status is 304 or 407, or responses + from a service worker for that matter, it is applied here.

    15. If the TAO check for request and response returns failure, then set request's timing allow failed flag. @@ -4140,11 +4135,11 @@ optional CORS-preflight flag, run these steps:

      1. -

        If actualResponse's status is not 303, - request's body is not null, and the connection uses HTTP/2, - then user agents may, and are even encouraged to, transmit an RST_STREAM frame. +

        If actualResponse's status is not 303, request's + body is not null, and the connection uses HTTP/2, then user agents + may, and are even encouraged to, transmit an RST_STREAM frame. -

        303 is excluded as certain communities ascribe special status to it. +

        303 is excluded as certain communities ascribe special status to it.

      2. Let location be the result of extracting header list values given `Location` and actualResponse's header list. @@ -4228,9 +4223,9 @@ optional CORS-preflight flag, run these steps:

        This catches a cross-origin resource redirecting to a same-origin URL. -

      3. If actualResponse's status is not 303, - request's body is non-null, and request's - body's source is null, then return a network error. +

      4. If actualResponse's status is not 303, request's + body is non-null, and request's body's + source is null, then return a network error.

      5. If actualResponse's location URL's origin is not same origin with request's current URL's @@ -4242,10 +4237,10 @@ optional CORS-preflight flag, run these steps:

        If one of the following is true

          -
        • actualResponse's status is 301 or - 302 and request's method is `POST` -

        • actualResponse's status is 303 and - request's method is not `GET` or `HEAD` +

        • actualResponse's status is 301 or 302 and + request's method is `POST` +

        • actualResponse's status is 303 and request's + method is not `GET` or `HEAD`

        then: @@ -4657,14 +4652,14 @@ Range Requests. [[HTTP-RANGE]] However, this is not widely supported by b

      6. If httpRequest's method is unsafe and - forwardResponse's status is in the range 200 to - 399, inclusive, invalidate appropriate stored responses in httpCache, as - per the "Invalidation" chapter of + forwardResponse's status is in the range 200 to 399, inclusive, + invalidate appropriate stored responses in httpCache, as per the + "Invalidation" chapter of HTTP Caching, and set storedResponse to null. [[!HTTP-CACHING]]

      7. If the revalidatingFlag is set and forwardResponse's - status is 304, then: + status is 304, then:

        1. @@ -4702,10 +4697,10 @@ Range Requests. [[HTTP-RANGE]] However, this is not widely supported by b `Range`, then set response's range-requested flag.
        2. -

          If response's status is 401, - httpRequest's response tainting is not "cors", the - credentials flag is set, and request's window is an - environment settings object, then: +

          If response's status is 401, httpRequest's + response tainting is not "cors", the credentials flag is + set, and request's window is an environment settings object, + then:

          1. Needs testing: multiple `WWW-Authenticate` headers, missing, @@ -4756,7 +4751,7 @@ Range Requests. [[HTTP-RANGE]] However, this is not widely supported by b

        3. -

          If response's status is 407, then: +

          If response's status is 407, then:

          1. If request's window is @@ -4851,12 +4846,11 @@ Range Requests. [[HTTP-RANGE]] However, this is not widely supported by b

          2. Wait until all the headers are transmitted.

          3. -

            Any responses whose - status is in the range 100 to - 199, inclusive, and is not 101, are to be ignored. +

            Any responses whose status is in the range 100 to 199, + inclusive, and is not 101, are to be ignored. -

            These kind of responses are - eventually followed by a "final" response. +

            These kind of responses are eventually followed by a + "final" response.

            The exact layering between Fetch and HTTP still needs to be sorted through and @@ -6222,7 +6216,7 @@ constructor steps are:

            Set.
            client -
            Current settings object. +
            This's relevant settings object.
            window
            window. @@ -6516,12 +6510,18 @@ constructor steps are:

            The destination getter are to return this's request's destination. -

            The referrer getter steps are to return -the empty string if this's request's referrer is -"no-referrer", "about:client" if this's -request's referrer is "client"; otherwise -this's request's referrer, -serialized. +

            The referrer getter steps are: + +

              +
            1. If this's request's referrer is + "no-referrer", then return the empty string. + +

            2. If this's request's referrer is + "client", then return "about:client". + +

            3. Return this's request's referrer, + serialized. +

            The referrerPolicy getter steps are to return this's request's referrer policy. @@ -6636,8 +6636,8 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire constructor steps are:

              -
            1. If init["{{ResponseInit/status}}"] is not in the range 200 to - 599, inclusive, then throw a RangeError. +

            2. If init["{{ResponseInit/status}}"] is not in the range 200 to 599, inclusive, + then throw a {{RangeError}}.

            3. If init["{{ResponseInit/statusText}}"] does not match the reason-phrase token production, then throw a {{TypeError}}. @@ -6666,8 +6666,8 @@ constructor steps are:

              If init["{{ResponseInit/status}}"] is a null body status, then throw a {{TypeError}}. -

              101 is included in - null body status due to its use elsewhere. It does not affect this step. +

              101 is included in null body status due to its use elsewhere. + It does not affect this step.

            4. Let Content-Type be null. @@ -6714,8 +6714,7 @@ are:

            5. If parsedURL is failure, then throw a {{TypeError}}. -

            6. If status is not a redirect status, then throw a - RangeError. +

            7. If status is not a redirect status, then throw a {{RangeError}}.

            8. Let r be a new {{Response}} object, whose response is a new response. @@ -6726,8 +6725,10 @@ are:

            9. Set r's response's status to status. -

            10. Append `Location` to parsedURL, - serialized and isomorphic encoded, in r's +

            11. Let value be parsedURL, serialized and + isomorphic encoded. + +

            12. Append `Location`/value to r's response's header list.

            13. Return r. @@ -7070,9 +7071,8 @@ therefore not shareable, a WebSocket connection is very close to identical to an

            14. Let response be the result of fetching request. -

            15. If response is a network error or its - status is not 101, - fail the WebSocket connection. +

            16. If response is a network error or its status is not + 101, fail the WebSocket connection.

            17. If protocols is not the empty list and extracting header list values given