diff --git a/source b/source index c01f837daa4..ce7cfde5988 100644 --- a/source +++ b/source @@ -84869,6 +84869,23 @@ interface NavigatorOnLine {
Fetching scripts
+

The various script-fetching algorithms below have two hooks that may be customized by their + callers:

+ + + +

Service Workers is an example of a specification that runs these + algorithms with its own options for the hooks.

+

To fetch a classic script for a script element element, given a url, a CORS setting, a settings object, and a character encoding, run these steps. The algorithm will asynchronously complete with @@ -84884,6 +84901,9 @@ interface NavigatorOnLine { data-x="">script", and its destination to "script".

+
  • If the caller specified custom steps to set + up the request, perform them on request.

  • +
  • Fetch request.

  • @@ -84901,6 +84921,11 @@ interface NavigatorOnLine { data-x="concept-response-status">status is not an ok status, asynchronously complete this algorithm with null, and abort these steps.

    +
  • If the caller specified custom steps to validate the response, perform them on + response. If they return false, complete this algorithm with null, and abort these + steps.

  • +
  • If response's Content Type metadata, if any, specifies a character encoding, and the user agent supports that encoding, then set character encoding to that encoding (ignoring the passed-in value).

  • @@ -84942,6 +84967,9 @@ interface NavigatorOnLine { data-x="concept-request-credentials-mode">credentials mode is "same-origin", and whose use-URL-credentials flag is set.

    +
  • If the caller specified custom steps to set + up the request, perform them on request.

  • +
  • Fetch request.

  • @@ -84954,6 +84982,11 @@ interface NavigatorOnLine { data-x="concept-response-status">status is not an ok status, asynchronously complete this algorithm with null, and abort these steps.

    +
  • If the caller specified custom steps to validate the response, perform them on + response. If they return false, complete this algorithm with null, and abort these + steps.

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

  • @@ -84972,7 +85005,11 @@ interface NavigatorOnLine {
  • If ancestor list is not given, let it be an empty list.

  • Fetch a single module script given url, credentials - mode, destination, and settings object.

    + mode, destination, and settings object. If the caller of this + algorithm specified custom set up the + request or validate the response + steps, pass those along while fetching a single + module script.

  • Return from this algorithm and run the following steps when fetching a single module script asynchronously completes with @@ -84991,6 +85028,12 @@ interface NavigatorOnLine { asynchronously complete this algorithm with descendants result.

  • +
    + +

    The following algorithms are used when fetching a + module script tree, and are not meant to be used directly by other specifications (or by + other parts of this specification).

    +

    To fetch the descendants of a module script module script, given a destination and an ancestor list, run these steps. The algorithm will asynchronously complete with either null (on failure) or with module script (on @@ -85036,6 +85079,11 @@ interface NavigatorOnLine { data-x="concept-module-script-credentials-mode">credentials mode, destination, module script's settings object, and ancestor list.

    +

    It is intentional that no custom set up the request or validate the response steps are passed along + here. Those hooks only apply to the top-level fetch at the root of the module script tree.

    +

    If any of the fetch a module script tree invocations asynchronously complete with null, the user agent may terminate any or all of the other fetches, and must then asynchronously complete this algorithm with null.

    @@ -85073,6 +85121,9 @@ interface NavigatorOnLine { mode, and client is settings object.

    +
  • If the caller specified custom steps to set + up the request, perform them on request.

  • +
  • Fetch request.

  • @@ -85105,6 +85156,10 @@ interface NavigatorOnLine { classic script does not include MIME type checking. In contrast, module scripts will fail to load if they are not of a correct MIME type.

    + +
  • The caller specified custom steps to validate the response, which when performed + on response return false.