From 07fb2c0449540a69221f81cd4e5b24bf1fcccd41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Fetch request with processResponseConsumeBody set to the following steps
- given response response:
Finalize and report timing with response, el's node document's relevant global object, and initiatorType.
Let success be true.
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.
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.
Process the linked resource given el, - success, and response.
Process the linked resource given el, success, and + response.
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:
+ +bytesOrNull is null or failure; or
response's status is not an + ok status,
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:
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 " bytesOrNull is null or failure; or response's status is not an
ok status,
-
error
"; or
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 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:
If moduleResponsesMap[requestURL] exists, then run processCustomFetchResponse with - moduleResponsesMap[requestURL] and return.
If moduleResponsesMap[requestURL] exists, then:
+ +Let cached be moduleResponsesMap[requestURL].
Run processCustomFetchResponse with cached[0] and + cached[1].
Return.
Set moduleResponsesMap[requestURL] to
"fetching
".
Fetch request, with processResponseConsumeBody set to the following steps - given response response:
+ given response response and null, failure, or a + byte sequence bytesOrNull:Set moduleResponsesMap[requestURL] to - response.
Set moduleResponsesMap[requestURL] to (response, + bytesOrNull).
Run processCustomFetchResponse with response.
Run processCustomFetchResponse with response and + bytesOrNull.
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.
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.
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: If isTopLevel is false, fetch
- request with processCustomFetchResponse as processResponseConsumeBody and return.
Fetch request. Return from this - algorithm, and run the remaining steps as part of the fetch's process response for - the response response.
Fetch request with with processResponseConsumeBody set to the following steps + given response response and null, failure, or + a byte sequence bytesOrNull:
-Set worker global scope's url to response's url.
Set worker global scope's url to response's url.
Initialize worker global scope's - policy container given worker global scope, response, and - inside settings.
Initialize worker global scope's + policy container given worker global scope, response, and + inside settings.
If the Run CSP initialization for a global object algorithm returns "Blocked
" when executed upon worker global scope, set
- response to a network error.
If the Run CSP initialization for a global object algorithm returns "Blocked
" when executed upon worker global scope, set
+ response to a network error.
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.
-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.
+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.
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.
Set worker global scope's cross-origin isolated
- capability to true if agent's agent cluster's cross-origin isolation mode is "concrete
".
Set worker global scope's cross-origin isolated
+ capability to true if agent's agent cluster's cross-origin isolation mode is "concrete
".
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.
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.
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.
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.
Run processCustomFetchResponse with response.
Run processCustomFetchResponse with response and + bytesOrNull.
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.
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
Date: Thu, 27 Oct 2022 17:59:34 +0200
Subject: [PATCH 2/7] Review by Domenic
---
source | 85 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 44 insertions(+), 41 deletions(-)
diff --git a/source b/source
index 1f8d9321af5..7707bb4f4ea 100644
--- a/source
+++ b/source
@@ -14751,7 +14751,7 @@ interface HTMLLinkElement : HTMLElement {
Fetch request with processResponseConsumeBody set to the following steps
given response response and null, failure, or
- a byte sequence bytesOrNull:
Finalize and report timing with response, @@ -14764,7 +14764,7 @@ interface HTMLLinkElement : HTMLElement {
If either of the following conditions are met:
bytesOrNull is null or failure; or
bodyBytes is null or failure; or
response's status is not an ok status,
Process the linked resource given el, success, and - response.
Process the linked resource given el, success, + response, and bodyBytes.
Similar to the fetch and process the linked resource algorithm, all external resource links have a process the linked
resource algorithm which takes a link
element el, boolean
- success, and response response.
- Individual link types may provide their own process the linked resource algorithm,
- but unless explicitly stated, that algorithm does nothing.
Unless otherwise specified for a given rel
keyword, the
element must delay the load event of the element's node document until
@@ -25562,15 +25563,16 @@ document.body.appendChild(wbr);
To process this type of linked resource given
- a link
element el, boolean success, and response response:
link
element el, boolean success, response response, and byte sequence
+ bodyBytes:
If response's Content-Type metadata is not a JSON MIME type, then set success to false.
If success is true, then process the manifest given el - and response.
If success is true, then process the manifest given el, + response, and bodyBytes.
The process a link header steps for this type of linked resource are to do @@ -26223,13 +26225,13 @@ document.body.appendChild(wbr);
Fetch request, with processResponseConsumeBody set to the following steps given a response response and null, failure, - or a byte sequence bytesOrNull:
+ or a byte sequence bodyBytes:If bytesOrNull is a byte sequence, then set response's +
If bodyBytes is a byte sequence, then set response's body to the first return value of safely extracting bytesOrNull.
+ data-x="body safely extract">safely extracting bodyBytes.By using processResponseConsumeBody,
we have extracted the entire
link
element is currently render-blocking.
To process this type of linked resource
- given a link
element el, boolean success, and response response, the user agent must run these
- steps:
link
element el, boolean success, response response, and byte sequence
+ bodyBytes, the user agent must run these steps:
Process the linked resource given el, success, response, and bodyBytes.
If respnse is null, pause until it is not null.
+Pause until response is not null.
Unlike other algorithms in this section, the fetching process is synchronous - here. If performFetch was given and it synchronously runs processResponseConsumeBody, response will - already be not null without pausing.
+ here.Finalize and report timing with response, settings
From 00b1401c4b61aadd2558e86cc10f04f629db5ed4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= If bodyBytes is a byte sequence, then set response's
- body to the first return value of safely extracting bodyBytes.
By using processResponseConsumeBody,
we have extracted the entire
To process this type of linked resource
given a link
element el, boolean success, response response, and byte sequence
- bodyBytes, the user agent must run these steps: