diff --git a/source b/source index 4d8cb26a588..1f8d9321af5 100644 --- a/source +++ b/source @@ -14750,24 +14750,34 @@ interface HTMLLinkElement : HTMLElement {
  • Fetch request with processResponseConsumeBody set to the following steps - given response response:

    + given response response and null, failure, or + a byte sequence bytesOrNull:

    1. Finalize and report timing with response, el's node document's relevant global object, and initiatorType.

    2. +
    3. Let success be true.

    4. +
    5. -

      If response is a network error or its status is not an ok - status, set success to false.

      +

      If either of the following conditions are met:

      + +
        +
      • bytesOrNull is null or failure; or

      • + +
      • response's status is not an + ok status,

      • +
      + +

      then set success to false.

      Note that content-specific errors, e.g., CSS parse errors or PNG decoding errors, do not affect success.

    6. -

      If success is true, wait for the link +

      Otherwise, wait for the link resource's critical subresources to finish loading.

      The specification that defines a link type's critical subresources @@ -14777,8 +14787,9 @@ interface HTMLLinkElement : HTMLElement { be fetched and processed, with the expectation that this will be done correctly.

    7. -
    8. Process the linked resource given el, - success, and response.

    9. + +
    10. Process the linked resource given el, success, and + response.

  • @@ -93037,8 +93048,8 @@ document.querySelector("button").addEventListener("click", bound); data-x="fetching-scripts-processCustomFetchResponse">processCustomFetchResponse algorithm. It runs processCustomFetchResponse with a - response (which may be a network - error).

    + response and either null (on failure) or a byte + sequence containing the response body.

    synchronous perform the fetch hook
    @@ -93100,7 +93111,8 @@ document.querySelector("button").addEventListener("click", bound);
  • Fetch request with the following processResponseConsumeBody steps given - response response:

    + response response and null, failure, or a + byte sequence bytesOrNull:

    response can be either CORS-same-origin or CORS-cross-origin. This only affects how error reporting happens.

    @@ -93113,10 +93125,16 @@ document.querySelector("button").addEventListener("click", bound);
  • Set response to response's unsafe response.

  • -

    If response's type is "error", or response's status is not an ok status, then - run onComplete given null, and abort these steps.

    +

    If either of the following conditions are met:

    + + + +

    then run onComplete given null, and abort these steps.

    For historical reasons, this algorithm does not include MIME type checking, unlike the other script-fetching algorithms in this section.

    @@ -93136,8 +93154,8 @@ document.querySelector("button").addEventListener("click", bound);
  • Let source text be the result of decoding - response's body to Unicode, using - character encoding as the fallback encoding.

    + bytesOrNull to Unicode, using character encoding as the fallback + encoding.

    The decode algorithm overrides character encoding if the file contains a BOM.

    @@ -93176,14 +93194,14 @@ document.querySelector("button").addEventListener("click", bound);
  • If performFetch was given, run performFetch with request, - true, and with processResponse as defined below.

    + true, and with processResponseConsumeBody as defined below.

    Otherwise, fetch request with processResponseConsumeBody set to - processResponse as defined below.

    + data-x="processResponseConsumeBody">processResponseConsumeBody as defined below.

    -

    In both cases, let processResponse given response response be the following algorithm:

    +

    In both cases, let processResponseConsumeBody given response response and null, failure, or a byte + sequence bytesOrNull be the following algorithm:

    1. Finalize and report timing with response, fetch client @@ -93196,8 +93214,7 @@ document.querySelector("button").addEventListener("click", bound);

      If either of the following conditions are met:

        -
      • response's type is "error"; or

      • +
      • bytesOrNull is null or failure; or

      • response's status is not an ok status,

      • @@ -93226,8 +93243,7 @@ document.querySelector("button").addEventListener("click", bound);
      • Let source text be the result of UTF-8 - decoding response's body.

      • + decoding bytesOrNull.

      • Let script be the result of creating a classic script using source text, script settings object, response's To fetch a worklet script graph given a url, a fetch client settings object, a destination, a credentials mode, a module map settings - object, a module responses map, and an onComplete algorithm, - fetch a worklet/module worker script graph given url, fetch client - settings object, destination, credentials mode, module map - settings object, onComplete, and the following asynchronous perform - the fetch hook given request and , a module responses map + moduleResponsesMap, and an onComplete algorithm, fetch a + worklet/module worker script graph given url, fetch client settings + object, destination, credentials mode, module map settings + object, onComplete, and the following asynchronous perform the fetch + hook given request and processCustomFetchResponse:

          @@ -93461,9 +93478,19 @@ document.querySelector("button").addEventListener("click", bound); queue a task on the networking task source to proceed with running the following steps.

          -
        1. If moduleResponsesMap[requestURL] exists, then run processCustomFetchResponse with - moduleResponsesMap[requestURL] and return.

        2. +
        3. +

          If moduleResponsesMap[requestURL] exists, then:

          + +
            +
          1. Let cached be moduleResponsesMap[requestURL].

          2. + +
          3. Run processCustomFetchResponse with cached[0] and + cached[1].

          4. + +
          5. Return.

          6. +
          +
        4. Set moduleResponsesMap[requestURL] to "fetching".

        5. @@ -93471,13 +93498,15 @@ document.querySelector("button").addEventListener("click", bound);
        6. Fetch request, with processResponseConsumeBody set to the following steps - given response response:

          + given response response and null, failure, or a + byte sequence bytesOrNull:

            -
          1. Set moduleResponsesMap[requestURL] to - response.

          2. +
          3. Set moduleResponsesMap[requestURL] to (response, + bytesOrNull).

          4. -
          5. Run processCustomFetchResponse with response.

          6. +
          7. Run processCustomFetchResponse with response and + bytesOrNull.

        @@ -93896,14 +93925,14 @@ document.querySelector("button").addEventListener("click", bound);
      • If performFetch was given, run performFetch with request, - isTopLevel, and with processResponse as defined below.

        + isTopLevel, and with processResponseConsumeBody as defined below.

        -

        Otherwise, fetch request with - processResponse as processResponseConsumeBody.

        +

        Otherwise, fetch request with processResponseConsumeBody as defined below.

        -

        In both cases, let processResponse given response response be the following algorithm:

        +

        In both cases, let processResponseConsumeBody given response response and null, failure, or a + byte sequence bytesOrNull be the following algorithm:

        response is always CORS-same-origin.

        @@ -93916,11 +93945,10 @@ document.querySelector("button").addEventListener("click", bound);

        If either of the following conditions are met:

          -
        • response's type is "error"; or

        • +
        • bytesOrNull is null or failure; or

        • response's status is not an - ok status.

        • + ok status,

        then set moduleMap[(url, @@ -93929,8 +93957,7 @@ document.querySelector("button").addEventListener("click", bound);

      • Let source text be the result of UTF-8 - decoding response's body.

      • + decoding bytesOrNull.

      • Let MIME type be the result of extracting a MIME type from response's SharedWorkerGlobalScope : WorkerGlobalScope

        In both cases, let performFetch be the following asynchronous perform the - fetch hook given request, is - top-level and given request, isTopLevel and processCustomFetchResponse:

        1. If isTopLevel is false, fetch - request with processCustomFetchResponse as processResponseConsumeBody and return.

        2. + request with processResponseConsumeBody + and abort these steps.

        3. Set request's reserved client to inside settings.
        4. -
        5. Fetch request. Return from this - algorithm, and run the remaining steps as part of the fetch's process response for - the response response.

        6. +
        7. +

          Fetch request with with processResponseConsumeBody set to the following steps + given response response and null, failure, or + a byte sequence bytesOrNull:

          -
        8. Set worker global scope's url to response's url.

        9. +
            +
          1. Set worker global scope's url to response's url.

          2. -
          3. Initialize worker global scope's - policy container given worker global scope, response, and - inside settings.

          4. +
          5. Initialize worker global scope's + policy container given worker global scope, response, and + inside settings.

          6. -
          7. If the Run CSP initialization for a global object algorithm returns "Blocked" when executed upon worker global scope, set - response to a network error.

          8. +
          9. If the Run CSP initialization for a global object algorithm returns "Blocked" when executed upon worker global scope, set + response to a network error.

          10. -
          11. -

            If worker global scope's embedder policy's value is compatible with cross-origin - isolation and is shared is true, then set agent's agent - cluster's cross-origin isolation - mode to "logical" or "concrete". The one chosen is - implementation-defined.

            - -

            This really ought to be set when the agent cluster is created, which requires a - redesign of this section.

            -
          12. +
          13. +

            If worker global scope's embedder policy's value is compatible with cross-origin + isolation and is shared is true, then set agent's agent + cluster's cross-origin isolation + mode to "logical" or "concrete". The one chosen is + implementation-defined.

            + +

            This really ought to be set when the agent cluster is created, which requires a + redesign of this section.

            +
          14. -
          15. If the result of checking a - global object's embedder policy with worker global scope, outside - settings, and response is false, then set response to a - network error.

          16. +
          17. If the result of checking a + global object's embedder policy with worker global scope, outside + settings, and response is false, then set response to a + network error.

          18. -
          19. Set worker global scope's cross-origin isolated - capability to true if agent's agent cluster's cross-origin isolation mode is "concrete".

          20. +
          21. Set worker global scope's cross-origin isolated + capability to true if agent's agent cluster's cross-origin isolation mode is "concrete".

          22. -
          23. If is shared is false and owner's cross-origin isolated - capability is false, then set worker global scope's cross-origin isolated - capability to false.

          24. +
          25. If is shared is false and owner's cross-origin isolated + capability is false, then set worker global scope's cross-origin isolated + capability to false.

          26. -
          27. -

            If is shared is false and response's - url's scheme is "data", then set - worker global scope's cross-origin isolated - capability to false.

            - -

            This is a conservative default for now, while we figure out how workers in - general, and data: URL workers in particular (which are - cross-origin from their owner), will be treated in the context of permissions policies. See - w3c/webappsec-permissions-policy - issue #207 for more details.

            -
          28. +
          29. +

            If is shared is false and response's + url's scheme is "data", then set + worker global scope's cross-origin isolated + capability to false.

            + +

            This is a conservative default for now, while we figure out how workers in + general, and data: URL workers in particular (which are + cross-origin from their owner), will be treated in the context of permissions policies. See + w3c/webappsec-permissions-policy + issue #207 for more details.

            +
          30. -
          31. Run processCustomFetchResponse with response.

          32. +
          33. Run processCustomFetchResponse with response and + bytesOrNull.

          34. +
          +

        In both cases, let onComplete given script be the following steps:

        @@ -106326,8 +106359,10 @@ dictionary WorkletOptions {

        A Worklet has a module responses map, which is an ordered map from URLs to - responses, initially empty. Access to this map should be - thread-safe.

        + either "fetching" or tuples consisting of a + response and either null, failure, or a byte + sequence representing the response body. This map is initially empty, and access to it + should be thread-safe.

        The added modules list and