From 94dfbb0ecd9e2b62ff9b2aab5f16537b374b333c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= The algorithms below can be customized by optionally supplying a custom perform the fetch
- hook, which takes a request, an is top-level flag, and a processCustomFetchResponse
- algorithm. The perform the fetch algorithm
- must run processCustomFetchResponse with a
- response (which may be a network
- error), either synchronously (when using fetch a classic worker-imported
- script) or asynchronously (otherwise). The is
- top-level flag will be set for all classic script fetches, and for the initial
- fetch when fetching an external module script
- graph, fetching a module worker script
- graph, or fetching an import() module
- script graph, but not for the fetches resulting from Many of the below algorithms can be customized with a perform the fetch
+ hook algorithm, in one of the following forms: It takes a request, an is top-level flag, and a processCustomFetchResponse
+ algorithm. It runs runs processCustomFetchResponse with a
+ response (which may be a network
+ error). It takes a request and an is top-level flag, and returns a response (which may be a network error). In both cases, the is top-level flag will be set for all
+ classic script fetches, and for the initial fetch when fetching an external module script graph, fetching a module worker script graph, or fetching an import() module script graph, but not for the
+ fetches resulting from By default, not supplying the perform the
- fetch will cause the below algorithms to simply fetch
+ By default, not supplying a perform the fetch
+ hook will cause the below algorithms to simply fetch
the given request, with algorithm-specific customizations
to the request and validations of the resulting response. To layer your own customizations on top of these algorithm-specific ones, supply a perform the fetch hook that modifies the given
+ data-x="fetching-scripts-perform-fetch">perform the fetch hook that modifies the given
request, fetches it,
and then performs specific validations of the resulting response (completing with a network error if the
@@ -92958,7 +92971,8 @@ document.querySelector("button").addEventListener("click", bound);
To fetch a classic script given a url, a settings
object, some options, a CORS setting, a character
- encoding, and an onComplete algorithm, run these steps. onComplete
+ encoding, an onComplete algorithm, and an optional asynchronous perform the
+ fetch hook performFetch, run these steps. onComplete
must be an algorithm accepting null (on failure) or a classic script (on
success). If the caller specified custom steps to perform
- the fetch, perform them on request, with the is top-level flag set. Return from this algorithm,
- and run the remaining steps as part of the perform
- the fetch's processCustomFetchResponse given response response. If performFetch was given, run performFetch with request,
+ with the is top-level flag set, and with
+ processResponse as defined below. Otherwise, fetch request. Return from this
- algorithm, and run the remaining steps as part of the fetch's processResponseConsumeBody given response response. Otherwise, fetch request with
+ processResponse as processResponseConsumeBody. In both cases, let processResponse given response response be the following algorithm: response can be either CORS-same-origin or
CORS-cross-origin. This only affects how error reporting happens. Finalize and report timing with response, settings
- object's global object, and " Finalize and report timing with response, settings
+ object's global object, and " Set response to response's unsafe response. Set response to response's unsafe response. If response's type is " If response's type is " For historical reasons, this algorithm does not include MIME type checking,
- unlike the other script-fetching algorithms in this section. For historical reasons, this algorithm does not include MIME type checking,
+ unlike the other script-fetching algorithms in this section. Let potentialMIMETypeForEncoding be the result of extracting a MIME type given response's header list. Let potentialMIMETypeForEncoding be the result of extracting a MIME type given response's header list. Set character encoding to the result of legacy extracting an encoding given potentialMIMETypeForEncoding and
- character encoding. Set character encoding to the result of legacy extracting an encoding given potentialMIMETypeForEncoding and
+ character encoding. This intentionally ignores the MIME type essence. This intentionally ignores the MIME type essence. Let source text be the result of decoding
- response's body to Unicode, using
- character encoding as the fallback encoding. Let source text be the result of decoding
+ response's body to Unicode, using
+ character encoding as the fallback encoding. The decode algorithm overrides character encoding if
- the file contains a BOM. The decode algorithm overrides character encoding if
+ the file contains a BOM. Let muted errors be true if response was
- CORS-cross-origin, and false otherwise. Let muted errors be true if response was
+ CORS-cross-origin, and false otherwise. Let script be the result of creating a classic script given
- source text, settings object, response's url, options, and muted
- errors. Let script be the result of creating a classic script given
+ source text, settings object, response's url, options, and muted
+ errors. To fetch a classic worker script given a url, a fetch client
- settings object, a destination, a script settings object, and an
- onComplete algorithm, run these steps. onComplete must be an algorithm
- accepting null (on failure) or a classic script (on success). Let request be a new request whose
If the caller specified custom steps to perform
- the fetch, perform them on request, with the is top-level flag set. Return from this algorithm,
- and run the remaining steps as part of the perform
- the fetch's processCustomFetchResponse given response response. If performFetch was given, run performFetch with request,
+ with the is top-level flag set, and with
+ processResponse as defined below. Otherwise, fetch request. Return from this
- algorithm, and run the remaining steps as part of the fetch's processResponseConsumeBody given response response.
- Otherwise, fetch request with
+ processResponse as processResponseConsumeBody. Finalize and report timing with response, fetch client
- settings object's global object, and
- " In both cases, let processResponse given response response be the following algorithm: Set response to response's unsafe response. Finalize and report timing with response, fetch client
+ settings object's global object, and
+ " If either of the following conditions are met: Set response to response's unsafe response. response's type is " If either of the following conditions are met: response's status is not an
- ok status, response's type is " then run onComplete given null, and return. If both of the following conditions are met: response's status is not an
+ ok status, response's url's scheme is an HTTP(S) scheme; and then run onComplete given null, and return. If both of the following conditions are met: the result of extracting a MIME type from
- response's header list is not a
- JavaScript MIME type, response's url's scheme is an HTTP(S) scheme; and then run onComplete given null, and return. the result of extracting a MIME type from
+ response's header list is not a
+ JavaScript MIME type, Other fetch schemes are exempted from MIME
- type checking for historical web-compatibility reasons. We might be able to tighten this in the
- future; see issue #3255. then run onComplete given null, and return. Let source text be the result of UTF-8
- decoding response's body. Other fetch schemes are exempted from MIME
+ type checking for historical web-compatibility reasons. We might be able to tighten this in the
+ future; see issue #3255. Let script be the result of creating a classic script using
- source text, script settings object, response's url, and the default classic script fetch
- options. Let source text be the result of UTF-8
+ decoding response's body. Let script be the result of creating a classic script using
+ source text, script settings object, response's url, and the default classic script fetch
+ options. Run onComplete given script. Run onComplete given script. To fetch a classic worker-imported script given a url and a
- settings object, run these steps. The algorithm will synchronously complete with a
+ To fetch a classic worker-imported script given a url, a
+ settings object, and an optional synchronous perform the fetch hook
+ performFetch, run these steps. The algorithm will synchronously complete with a
classic script on success, or throw an exception on failure. Let response be null. If the caller specified custom steps to perform
- the fetch, perform them on request, with the is top-level flag set, and with the following processCustomFetchResponse steps given
- response customFetchResponse: Set response to customFetchResponse. If performFetch was given, let response be the result of running
+ performFetch given request with the is top-level flag set. Otherwise, fetch request, and set
- response to the result. Otherwise, let response be the result of fetching request. Unlike other algorithms in this section, the fetching process is synchronous
- here. Thus any perform the fetch steps will
- also run processCustomFetchResponse
- synchronously, and response will have been set when this step completes. Finalize and report timing with response, settings
@@ -93195,8 +93201,9 @@ document.querySelector("button").addEventListener("click", bound);
To fetch an external module script graph
- given a url, a settings object, some options, and an
- onComplete algorithm, run these steps. onComplete must be an algorithm
+ given a url, a settings object, some options, an
+ onComplete algorithm, and an optional asynchronous perform the fetch hook
+ performFetch, run these steps. onComplete must be an algorithm
accepting null (on failure) or a module script (on success). Fetch the descendants of
and link result given settings object, " If the caller of this algorithm specified custom perform the fetch steps, pass those along as
- well. To fetch an import() module script graph given a moduleRequest, a
- base URL, a settings object, some options, and an
- onComplete algorithm, run these steps. onComplete must be an algorithm
+ base URL, a settings object, some options, an
+ onComplete algorithm, and an optional asynchronous perform the fetch hook
+ performFetch, run these steps. onComplete must be an algorithm
accepting null (on failure) or a module script (on success). If the caller of this algorithm specified custom perform the fetch steps, pass those along as
- well. If performFetch was given, pass it along as well. Let requestURL be request's To fetch a worklet/module worker script graph given a url, a fetch
client settings object, a destination, a credentials mode, a
- module map settings object, and an onComplete algorithm, run these steps.
+ module map settings object, an onComplete algorithm, and an optional
+ asynchronous perform the fetch hook performFetch, run these steps.
onComplete must be an algorithm accepting null (on failure) or a module
script (on success). Fetch the
descendants of and link result given fetch client settings
object, destination, visited set, and
- onComplete. If the caller of this algorithm specified custom perform the fetch steps, pass those along as
- well. If performFetch was given, pass it along as well. To fetch the descendants of and link a module script module
script, given a fetch client settings object, a destination, a
- visited set, and an onComplete algorithm, run these steps.
+ visited set, an onComplete algorithm, and an optional asynchronous
+ perform the fetch hook performFetch, run these steps.
onComplete must be an algorithm accepting null (on failure) or a module
script (on success). Run onComplete given result. If performFetch was given, pass it along as well. To fetch the descendants of a module script module script, given a
- fetch client settings object, a destination, a visited set, and
- an onComplete algorithm, run these steps. onComplete must be an algorithm
- accepting null (on failure) or a module script (on success). If module script's record is null,
@@ -93667,9 +93673,8 @@ document.querySelector("button").addEventListener("click", bound);
script. If the caller of this algorithm specified custom perform the fetch steps, pass those along while
- performing the internal module script graph fetching procedure. If performFetch was given, pass it along to the internal module
+ script graph fetching procedure. The fetches performed by the internal module script graph fetching
procedure are performed in parallel to each other. To perform the internal module script graph fetching procedure given a
moduleRequest, a fetch client settings object, a destination,
some options, a module map settings object, a visited set, a
- referrer, and an onComplete algorithm, run these steps.
+ referrer, an onComplete algorithm, and an optional asynchronous
+ perform the fetch hook performFetch, run these steps.
onComplete must be an algorithm accepting null (on failure) or a module
script (on success). Fetch the descendants of
result given fetch client settings object, destination,
- visited set, and with onComplete. If the caller of this algorithm specified custom perform the fetch steps, pass those along as
- well. If performFetch was given, pass it along as well. To fetch a single module script, given a url, a fetch client
settings object, a destination, some options, a module map
settings object, a referrer, an optional moduleRequest, a
- top-level module fetch flag, and an onComplete algorithm, run these steps.
+ top-level module fetch flag, an onComplete algorithm, and an optional
+ asynchronous perform the fetch hook performFetch, run these steps.
onComplete must be an algorithm accepting null (on failure) or a module
script (on success). If the caller specified custom steps to perform
- the fetch, perform them on request, setting the is top-level flag if the top-level module
- fetch flag is set. Return from this algorithm, and run the remaining steps as part of the
- perform the fetch's processCustomFetchResponse given response response. If performFetch was given, run performFetch with request,
+ setting the is top-level flag if the
+ top-level module fetch flag is set, and with processResponse as defined
+ below. Otherwise, fetch request. Return from this
- algorithm, and run the remaining steps as part of the fetch's processResponseConsumeBody given response response. Otherwise, fetch request with
+ processResponse as processResponseConsumeBody. response is always CORS-same-origin. In both cases, let processResponse given response response be the following algorithm: Finalize and report timing with response, fetch client
- settings object's global object, and
- " response is always CORS-same-origin. If either of the following conditions are met: Finalize and report timing with response, fetch client
+ settings object's global object, and
+ " response's type is " If either of the following conditions are met: response's status is not an
- ok status. response's type is " then set moduleMap[(url,
- moduleType)] to null, run onComplete given null, and return. response's status is not an
+ ok status. Let source text be the result of UTF-8
- decoding response's body. then set moduleMap[(url,
+ moduleType)] to null, run onComplete given null, and return. Let MIME type be the result of extracting a
- MIME type from response's header
- list. Let source text be the result of UTF-8
+ decoding response's body. Let module script be null. Let MIME type be the result of extracting
+ a MIME type from response's header list. If MIME type is a JavaScript MIME type and moduleType
- is " Let module script be null. If the MIME type essence of MIME type is " If MIME type is a JavaScript MIME type and moduleType
+ is " If MIME type essence is a JSON MIME type and moduleType
- is " If the MIME type essence of MIME type is " Set moduleMap[(url,
- moduleType)] to module script, and run onComplete given
- module script. If MIME type essence is a JSON MIME type and
+ moduleType is " It is intentional that the module map is keyed by the request URL, whereas the base URL for the module script is
- set to the response URL. The former is used to
- deduplicate fetches, while the latter is used for URL resolution. Set moduleMap[(url,
+ moduleType)] to module script, and run onComplete given
+ module script. It is intentional that the module map is keyed by the request URL, whereas the base URL for the module script is
+ set to the response URL. The former is used to
+ deduplicate fetches, while the latter is used for URL resolution. In both cases, to perform the fetch
- given request, is top-level and In both cases, let performFetch be the following asynchronous perform the
+ fetch hook given request, is
+ top-level and processCustomFetchResponse: To import scripts into worker global scope, given a
- If worker global scope's SharedWorker : EventTarget {
Fetch a classic worker-imported script given url and
- settings object, passing along any custom perform the fetch steps provided. If this
+ settings object, passing along performFetch if provided. If this
succeeds, let script be the result. Otherwise, rethrow the exception. Service Workers is an example of a specification that runs this
- algorithm with its own options for the perform the
- fetch hook. To fetch a classic script given a url, a settings
object, some options, a CORS setting, a character
- encoding, an onComplete algorithm, and an optional asynchronous perform the
- fetch hook performFetch, run these steps. onComplete
+ encoding, and an onComplete algorithm, run these steps. onComplete
must be an algorithm accepting null (on failure) or a classic script (on
success). If performFetch was given, run performFetch with request,
- with the is top-level flag set, and with
- processResponse as defined below. Otherwise, fetch request with
- processResponse as processResponseConsumeBody. In both cases, let processResponse given response response be the following algorithm: Fetch request with
+ the following processResponseConsumeBody steps given
+ response response: response can be either CORS-same-origin or
CORS-cross-origin. This only affects how error reporting happens. To fetch an external module script graph
- given a url, a settings object, some options, an
- onComplete algorithm, and an optional asynchronous perform the fetch hook
- performFetch, run these steps. onComplete must be an algorithm
+ given a url, a settings object, some options, and an
+ onComplete algorithm, run these steps. onComplete must be an algorithm
accepting null (on failure) or a module script (on success). Fetch the descendants of
and link result given settings object, "
- import
- statements encountered throughout the graph.
+
+
+ import
statements encountered throughout the
+ graph.script
".
+
+
script
".error
", or response's status is not an ok status, then
- run onComplete given null, and return.error
", or response's status is not an ok status, then
+ run onComplete given null, and return.
+
- other
".
+
other
".
-
+ error
"; or
+
error
"; or
-
+
+
-
@@ -93134,26 +93150,16 @@ document.querySelector("button").addEventListener("click", bound);
parser-inserted", synchronous flag is set, and whose
use-URL-credentials flag is set.
-
-
+
@@ -93214,17 +93221,15 @@ document.querySelector("button").addEventListener("click", bound);
-
- script
", visited set, and onComplete.
@@ -93262,9 +93267,7 @@ document.querySelector("button").addEventListener("click", bound);
visited set, and onComplete.
-
-
- other
".
+
other
".
-
+ error
"; or
+
error
"; orjavascript
", then set module script to the result of
- creating a JavaScript module script given source text, module map
- settings object, response's url, and
- options.text/css
"
- and moduleType is "css
", then set module script to
- the result of creating a CSS module script given source text and
- module map settings object.javascript
", then set module script to the result of
+ creating a JavaScript module script given source text, module map
+ settings object, response's url,
+ and options.json
", then set module script to the result of
- creating a JSON module script given source text and module map
- settings object.text/css
"
+ and moduleType is "css
", then set module script to
+ the result of creating a CSS module script given source text and
+ module map settings object.json
", then set module script to
+ the result of creating a JSON module script given source text and
+ module map settings object.classic
"module
"credentials
- member of options, inside settings, and with onComplete as
- defined below.
@@ -104593,11 +104601,9 @@ interface SharedWorker : EventTarget {
and urls.
WorkerGlobalScope
object worker global scope and a sequence<DOMString>
urls, run these steps. The algorithm may
- optionally be customized by supplying custom perform
- the fetch hooks, which if provided will be used when invoking fetch a classic
- worker-imported script.WorkerGlobalScope
object worker global scope, a sequence<DOMString>
urls, and an optional synchronous perform
+ the fetch hook performFetch, run these steps.
@@ -93221,15 +93212,14 @@ document.querySelector("button").addEventListener("click", bound);
script
", visited set, and onComplete. If
- performFetch was given, pass it along as well.
To fetch an import() module script graph given a moduleRequest, a - base URL, a settings object, some options, an - onComplete algorithm, and an optional asynchronous perform the fetch hook - performFetch, run these steps. onComplete must be an algorithm + base URL, a settings object, some options, and an + onComplete algorithm, run these steps. onComplete must be an algorithm accepting null (on failure) or a module script (on success).
If performFetch was given, pass it along as well.
From 92948a2df20f2a5d2e229aa1c54b06d320747dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?=It takes a request, an is top-level flag, and a request, a boolean isTopLevel, and a processCustomFetchResponse
algorithm. It runs runs synchronous perform the fetch hook
- It takes a request and an is top-level flag, and returns a It takes a request and a boolean isTopLevel, and returns a response (which may be a network error).
In both cases, the is top-level flag will be set for all
- classic script fetches, and for the initial fetch when fetching an external module script graph, fetching a module worker script graph, or fetching an import() module script graph, but not for the
- fetches resulting from import
statements encountered throughout the
- graph.
In both cases, isTopLevel will be true for all classic
+ script fetches, and for the initial fetch when fetching an external module script graph, fetching a module worker script graph, or fetching an import() module script graph, but false for the fetches
+ resulting from import
statements encountered throughout the graph.
By default, not supplying a perform the fetch
@@ -93066,8 +93065,7 @@ document.querySelector("button").addEventListener("click", bound);
If performFetch was given, run performFetch with request,
- with the is top-level flag set, and with
- processResponse as defined below.
Otherwise, fetch request with processResponse as
If performFetch was given, let response be the result of running - performFetch given request with the is top-level flag set.
+ performFetch given request and true.Otherwise, let response be the result of fetching request.
@@ -93201,7 +93198,7 @@ document.querySelector("button").addEventListener("click", bound);Fetch a single module script given url, settings
object, "script
", options, settings object,
- "client
", with the top-level module fetch flag set, and with
+ "client
", true, and with
the following steps given result:
Fetch a single module script given url, settings
object, "script
", options, settings object,
- "client
", moduleRequest, with the top-level module fetch
- flag set, and with the following steps given result:
client
", moduleRequest, true, and with the following steps
+ given result:
If result is null, run onComplete with null, and return.
Fetch a single module script given url, settings
object, destination, options, settings object, "client
", with the top-level module fetch flag set, and with the
+ data-x="">client", true, and with the
following steps given result:
Fetch a single module script given url, fetch client settings
object, destination, options, module map settings object,
- "client
", with the top-level module fetch flag set, and with
- the following steps given result:
client
", true, and with the following steps given result:
If result is null, run onComplete given null, and return.
Fetch a single module script given url, fetch client settings object, destination, options, module map settings object, - referrer, moduleRequest, with the top-level module fetch flag - unset, and with the following steps given result:
+ referrer, moduleRequest, false, and with the following steps given + result:If result is null, run onComplete with null, and return.
To fetch a single module script, given a url, a fetch client settings object, a destination, some options, a module map - settings object, a referrer, an optional moduleRequest, a - top-level module fetch flag, an onComplete algorithm, and an optional - asynchronous perform the fetch hook performFetch, run these steps. - onComplete must be an algorithm accepting null (on failure) or a module - script (on success).
+ settings object, a referrer, an optional moduleRequest, a boolean + isTopLevel, an onComplete + algorithm, and an optional asynchronous perform the fetch hook + performFetch, run these steps. onComplete must be an algorithm accepting + null (on failure) or a module script (on success).Let moduleType be "javascript
".
If performFetch was given, run performFetch with request, - setting the is top-level flag if the - top-level module fetch flag is set, and with processResponse as defined - below.
+ isTopLevel, and with processResponse as defined below.Otherwise, fetch request with processResponse as SharedWorkerGlobalScope : WorkerGlobalScope data-x="fetching-scripts-processCustomFetchResponse">processCustomFetchResponse:
If is top-level is not set, fetch +
If isTopLevel is false, fetch request with processCustomFetchResponse as processResponseConsumeBody and return.
Many of the below algorithms can be customized with a Several of the below algorithms can be customized with a perform the fetch hook algorithm, in one of the following forms:
@@ -92922,7 +92922,7 @@ document.querySelector("button").addEventListener("click", bound); data-x="fetching-scripts-is-top-level">isTopLevel, and a processCustomFetchResponse - algorithm. It runs runs processCustomFetchResponse with a response (which may be a network error). @@ -93067,9 +93067,9 @@ document.querySelector("button").addEventListener("click", bound);If performFetch was given, run performFetch with request, true, and with processResponse as defined below.
-Otherwise, fetch request with - processResponse as processResponseConsumeBody.
+Otherwise, fetch request with processResponseConsumeBody set to + processResponse as defined below.
In both cases, let processResponse given response response be the following algorithm:
@@ -93325,8 +93325,8 @@ document.querySelector("button").addEventListener("click", bound); 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 with the following asynchronous perform - the fetch hook given response and , onComplete, and the following asynchronous perform + the fetch hook given request and processCustomFetchResponse:Fetch a single module script given url, fetch client settings
object, destination, options, module map settings object,
- "client
", true, and with the following steps given result:
client
", true, and onSingleFetchComplete as defined below. If
+ performFetch was given, pass it along as well.
+
+ onSingleFetchComplete given result is the following algorithm:
If result is null, run onComplete given null, and return.
If performFetch was given, pass it along as well.
Fetch the descendants of module script, given fetch client settings object, destination, - visited set, and with the following steps given result:
+ visited set, and onFetchDescendantsComplete as defined below. If + performFetch was given, pass it along as well. + +onFetchDescendantsComplete given result is the following algorithm:
Run onComplete given result.
If performFetch was given, pass it along as well.
onInternalFetchingComplete given result is the following algorithm:
If failed is true, then abort these steps.
If performFetch was given, pass it along to the internal module - script graph fetching procedure.
-The fetches performed by the internal module script graph fetching procedure are performed in parallel to each other.
Fetch a single module script given url, fetch client settings object, destination, options, module map settings object, - referrer, moduleRequest, false, and with the following steps given - result:
+ referrer, moduleRequest, false, and onSingleFetchComplete as + defined below. If performFetch was given, pass it along as well. + +onSingleFetchComplete given result is the following algorithm:
If result is null, run onComplete with null, and return.
If performFetch was given, pass it along as well.
+It takes a request, a boolean isTopLevel, and a response (which may be a network error).
It takes a request and a boolean isTopLevel, and returns a
Date: Tue, 4 Oct 2022 15:31:29 +0900
Subject: [PATCH 6/7] Small fixes, some to preexisting text
---
source | 76 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 40 insertions(+), 36 deletions(-)
diff --git a/source b/source
index fe85c740c31..b4270d726d7 100644
--- a/source
+++ b/source
@@ -92942,24 +92942,22 @@ document.querySelector("button").addEventListener("click", bound);
module script graph">fetching an import() module script graph, but false for the fetches
resulting from import
statements encountered throughout the graph.
By default, not supplying a perform the fetch - hook will cause the below algorithms to simply fetch - the given request, with algorithm-specific customizations - to the request and validations of the resulting response.
- -To layer your own customizations on top of these algorithm-specific ones, supply a perform the fetch hook that modifies the given - request, fetches it, - and then performs specific validations of the resulting response (completing with a network error if the - validations fail).
- -The hook can also be used to perform more subtle customizations, such as keeping a cache of - responses and avoiding performing a fetch at all.
-By default, not supplying a perform the fetch + hook will cause the below algorithms to simply fetch + the given request, with algorithm-specific customizations + to the request and validations of the resulting response.
+ +To layer your own customizations on top of these algorithm-specific ones, supply a perform the fetch hook that modifies the given + request, fetches it, + and then performs specific validations of the resulting response (completing with a network error if the + validations fail).
+ +The hook can also be used to perform more subtle customizations, such as keeping a cache of + responses and avoiding performing a fetch at all.
Service Workers is an example of a specification that runs these algorithms with its own options for the hook.
@@ -93005,7 +93003,7 @@ document.querySelector("button").addEventListener("click", bound);If response's type is "error
", or response's status is not an ok status, then
- run onComplete given null, and return.
For historical reasons, this algorithm does not include MIME type checking, unlike the other script-fetching algorithms in this section.
@@ -93037,7 +93035,7 @@ document.querySelector("button").addEventListener("click", bound);Let script be the result of creating a classic script given source text, settings object, response's url, options, and muted + data-x="concept-response-url">URL, options, and muted errors.
then run onComplete given null, and return.
+then run onComplete given null, and abort these steps.
If both of the following conditions are met:
response's url's response's URL's scheme is an HTTP(S) scheme; and
the result of extracting a MIME type from @@ -93106,7 +93105,7 @@ document.querySelector("button").addEventListener("click", bound); JavaScript MIME type,
then run onComplete given null, and return.
+then run onComplete given null, and abort these steps.
Other fetch schemes are exempted from MIME type checking for historical web-compatibility reasons. We might be able to tighten this in the @@ -93118,7 +93117,7 @@ document.querySelector("button").addEventListener("click", bound);
Let script be the result of creating a classic script using source text, script settings object, response's url, and the default classic script fetch + data-x="concept-response-url">URL, and the default classic script fetch options.
Run onComplete given script.
Let script be the result of creating a classic script given source text, settings object, response's url, the default classic script fetch options, + data-x="concept-response-url">URL, the default classic script fetch options, and muted errors.
Return script.
If result is null, run onComplete given null, and return.
If result is null, run onComplete given null, and abort these + steps.
Let visited set be « (url, "javascript
")
».
If result is null, run onComplete with null, and return.
If result is null, run onComplete with null, and abort these + steps.
Let visited set be « (url, moduleType) ».
onSingleFetchComplete given result is the following algorithm:
If result is null, run onComplete given null, and return.
If result is null, run onComplete given null, and abort these + steps.
Let visited set be « (url, "javascript
")
».
If result is null, then run onComplete given result, and - return.
+ abort these steps.In this case, there was an error fetching one or more of the descendants. We will not attempt to link.
@@ -93699,7 +93701,8 @@ document.querySelector("button").addEventListener("click", bound);onSingleFetchComplete given result is the following algorithm:
If result is null, run onComplete with null, and return.
If result is null, run onComplete with null, and abort these + steps.
Fetch the descendants of result given fetch client settings object, destination, @@ -93800,7 +93803,8 @@ document.querySelector("button").addEventListener("click", bound);
then set moduleMap[(url, - moduleType)] to null, run onComplete given null, and return.
+ moduleType)] to null, run onComplete given null, and abort these + steps.Let source text be the result of UTF-8
@@ -93816,7 +93820,7 @@ document.querySelector("button").addEventListener("click", bound);
If MIME type is a JavaScript MIME type and moduleType
is " If the MIME type essence of MIME type is " To import scripts into worker global scope, given a
- javascript
", then set module script to the result of
creating a JavaScript module script given source text, module map
- settings object, response's url,
+ settings object, response's URL,
and options.text/css
"
@@ -104586,9 +104590,9 @@ interface SharedWorker : EventTarget {
and urls.WorkerGlobalScope
object worker global scope, a sequence<DOMString>
urls, and an optional synchronous perform
- the fetch hook performFetch, run these steps.WorkerGlobalScope
object worker global scope, a list of
+ scalar value strings urls, and an optional
+ synchronous perform the fetch hook performFetch:
If worker global scope's SharedWorker : EventTarget {
For each url in the resulting URL
- records, run these substeps:
Fetch a classic worker-imported script given url and
From 5979594d26eaf0926c8d12da5eec56fa74425a30 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Let potentialMIMETypeForEncoding be the result of extracting a MIME type given response's Let potentialMIMETypeForEncoding be the result of extracting a MIME type given response's header list.
Set character encoding to the result of legacy extracting an encoding given potentialMIMETypeForEncoding and - character encoding.
+ encoding">legacy extracting an encoding given potentialMIMETypeForEncoding + and character encoding.This intentionally ignores the MIME type essence.
the result of extracting a MIME type from - response's header list is not a - JavaScript MIME type,
+ response's header list is not + a JavaScript MIME type,then run onComplete given null, and abort these steps.
Other fetch schemes are exempted from MIME - type checking for historical web-compatibility reasons. We might be able to tighten this in the - future; see issue #3255.
+ type checking for historical web-compatibility reasons. We might be able to tighten this in + the future; see issue #3255.Let source text be the result of UTF-8 - decoding response's body.
Let script be the result of creating a classic script using
source text, script settings object, response's
Fetch a single module script given url, settings
- object, " Fetch a single module script given url, settings object,
+ " If result is null, run onComplete given null, and abort these
script
", options, settings object,
- "client
", true, and with
- the following steps given result:script
", options, settings object, "client
", true, and with the following steps given result: