diff --git a/fetch.bs b/fetch.bs index e82e45b18..941244e99 100644 --- a/fetch.bs +++ b/fetch.bs @@ -225,8 +225,34 @@ lt="authentication entry">authentication entries (for HTTP authentication).
ongoing")
ongoing", "terminated", or "aborted"
+
+ To report timing for a
+fetch controller controller given a global object global:
+
+ Assert: this's report timing steps is not
+ null.
+
+ Call this's report timing steps with global.
+ To extract full timing info
+given a fetch controller controller:
+
+ Assert: this's full timing info is not
+ null.
+
+ Return this's full timing info.
+ To abort a fetch controller
controller, set controller's state to
" A response body info is a struct used to maintain
+information needed by Resource Timing and Navigation Timing. It has the
+following items: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
+
+ To
create an opaque timing info,
given a fetch timing info timingInfo, return a new
@@ -276,22 +310,6 @@ given a fetch timing info timingInfo, return a new
post-redirect start time are timingInfo's
start time.
- To update timing info from stored response, given a
-connection timing info timingInfo and a response
-response, perform the following steps:
-
- Let storedTimingInfo be response's timing info.
-
- If storedTimingInfo is null, then return.
-
- Set timingInfo's encoded body size to
- storedTimingInfo's encoded body size.
-
- Set timingInfo's decoded body size to
- storedTimingInfo's decoded body size.
- To queue a fetch task, given an algorithm algorithm, a
global object or a parallel queue taskDestination, run these
steps:
@@ -1404,6 +1422,32 @@ this flag set are subject to additional processing requirements.
A request has an associated service-workers mode, that
is " A request has an associated
+initiator type, which is null,
+" This determines which service workers will receive a {{fetch!!event}} event for this fetch.
@@ -2084,7 +2128,7 @@ message as HTTP/2 does not support them.
A response has an associated
cache state (the empty string,
-" This is intended for usage by Service Workers and
@@ -2123,8 +2167,9 @@ the response of a redirect has to be set if it was set for previous responses in
this is also tracked internally using the request's timing allow failed flag.
A response has an associated
-timing info (null or a
-fetch timing info), which is initially null.
+body info
+(a response body info). Unless stated otherwise, it is a new
+response body info.
A response has an associated
service worker timing info (null or a
@@ -3838,6 +3883,7 @@ the request.
Let fetchParams be a new fetch params whose
request is request,
timing info is timingInfo,
+ controller is controller,
process request body chunk length is
processRequestBodyChunkLength,
process request end-of-body is processRequestEndOfBody,
@@ -4283,28 +4329,13 @@ steps:
fetchParams and a response response, run these steps:
If response is a network error, then:
-
- Set response's URL list to « fetchParams's
- request's URL list[0] ».
-
- This is needed as after cloning fetchParams's
- request's URL list earlier, response
- might have been set to a network error. Set response's timing info to the result of
- creating an opaque timing info for fetchParams's
- timing info. Let timingInfo be fetchParams's
+ timing info.
Otherwise, if fetchParams's request's
- client is a secure context, set response's
- timing info's server-timing headers to the
+ If response is not a network error and fetchParams's
+ request's client is a secure context, then set
+ timingInfo's server-timing headers to the
result of getting, decoding, and splitting ` Let processResponseEndOfBody be the following steps:
Let unsafeEndTime be the unsafe shared current time.
+
+ If fetchParams's request's
+ destination is " Set fetchParams's controller's
+ report timing steps to the following steps given a
+ global object global:
- If fetchParams's process response end-of-body is not
- null, then queue a fetch task to run fetchParams's
- process response end-of-body given response with
+ If fetchParams's request's URL's
+ scheme is not an HTTP(S) scheme, then return.
+
+ Set timingInfo's end time to the
+ relative high resolution time given unsafeEndTime and
+ global.
+
+ Let cacheState be response's cache state.
+
+ Let bodyInfo be response's body info.
+
+ If response's timing allow passed flag is not set,
+ then set timingInfo to a the result of creating an opaque timing info for
+ timingInfo, set bodyInfo to a new response body info, and
+ set cacheState to the empty string.
+
+ This covers the case of response being a network error.
+
+ If fetchParams's request's
+ initiator type is not null, then
+ mark resource timing given timingInfo, request's
+ URL, request's
+ initiator type, global, cacheState, and
+ bodyInfo.
+ Let processResponseEndOfBodyTask be the following steps:
+
+ If fetchParams's process response end-of-body is
+ non-null, then run fetchParams's
+ process response end-of-body given response.
+
+ If fetchParams's request's
+ initiator type is non-null and fetchParams's
+ request's client's
+ global object is fetchParams's
+ task destination, then run fetchParams's
+ controller's report timing steps given
+ fetchParams's request's client's
+ global object.
+ Queue a fetch task to run processResponseEndOfBodyTask with
fetchParams's task destination.
To finalize and report timing given a response
-response, a global object global, and a string
-initiatorType (default " If response is an aborted network error, then return.
-
- Let originalURL be response's URL list[0].
-
- Let timingInfo be response's timing info.
-
- Let cacheState be response's cache state.
-
- If originalURL's scheme is not an HTTP(S) scheme, then
- return.
-
- If timingInfo is null, then return.
-
- If response's timing allow passed flag is not set, then:
-
- Set timingInfo to a the result of creating an opaque timing info for
- timingInfo.
-
- Set cacheState to the empty string.
- Set timingInfo's end time to the
- coarsened shared current time given global's
- relevant settings object's
- cross-origin isolated capability.
-
- Set response's timing info to timingInfo.
-
- Mark resource timing for timingInfo, originalURL,
- initiatorType, global, and cacheState.
- To scheme fetch, given a
@@ -4590,9 +4634,6 @@ these steps:
final service worker start time to
serviceWorkerStartTime.
- Update timing info from stored response given fetchParams's
- timing info and response.
-
Set response's timing info to timingInfo.
-
- Attaching the timing info to a response is what makes it exposed to the web as a
- Resource Timing entry later. This step is done here, as resource-timing entries are available only
- for HTTP fetches, including ones that are handled by service-workers or HTTP cache, and not for,
- e.g., Return response. Typically
actualResponse's body's
stream is still being enqueued to after returning.
@@ -5259,9 +5291,6 @@ steps. They return a response.
Set response to storedResponse.
Set response's cache state to " Update timing info from stored response given fetchParams's
- timing info and response.
If forwardResponse is a network error, this effectively caches
the network error, which is sometimes known as "negative caching".
- The associated timing info is stored in the cache
+ The associated body info is stored in the cache
alongside the response.
@@ -5692,8 +5721,9 @@ optional boolean forceNewConnection (default false), run these steps:
Let codings be the result of extracting header list values given
` Increase timingInfo's encoded body size
- by bytes's length.
+ Increase response's body info's
+ encoded size by bytes's
+ length.
Set bytes to the result of handling content
@@ -5702,7 +5732,8 @@ optional boolean forceNewConnection (default false), run these steps:
This makes the ` Increase timingInfo's decoded body size by
+ Increase response's body info's
+ decoded size by
bytes's length.
If bytes is failure, then terminate
@@ -7072,6 +7103,9 @@ constructor steps are:
Let handleFetchDone given response response be to
- finalize and report timing with response, globalObject, and
- " Set controller to the result of calling fetch given
- request, with processResponseEndOfBody set to
- handleFetchDone, and processResponse given response
- being these substeps:
+ request and processResponse given response being
+ these substeps:
If locallyAborted is true, terminate these substeps.
+
+
+
+
+
aborted".
@@ -258,10 +284,6 @@ following items: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
+
+
-
-
all" or "none". Unless stated otherwise it is "all".
+audio",
+"beacon",
+"body",
+"css",
+"early-hint",
+"embed",
+"fetch",
+"font",
+"frame",
+"iframe",
+"image",
+"img",
+"input",
+"link",
+"object",
+"ping",
+"script",
+"track",
+"video",
+"xmlhttprequest", or
+"other". Unless stated otherwise it is null. [[RESOURCE-TIMING]]
+
+
local", or "validated"). Unlesss stated otherwise, it is the empty
+"local", or "validated"). Unless stated otherwise, it is the empty
string.
-
-
-
+ Server-Timing`
from response's header list.
@@ -4315,12 +4346,68 @@ steps:
-
document", then set fetchParams's
+ controller's full timing info to
+ fetchParams's timing info.
+
+
+
+
+
+
+
+ other"), run these steps:
-
-
-
-
-
-
-
- Scheme fetch
data:, blob: URL fetches, and are only available after all the
- relevant security checks have succeeded.
-
validated".
-
- Content-Encoding` and response's header list.
- Content-Length` header
unreliable to the extent that it was reliable to begin with.
- fetch".
fetch".
-