diff --git a/fetch.bs b/fetch.bs index afa26221d..2d9713621 100644 --- a/fetch.bs +++ b/fetch.bs @@ -210,10 +210,38 @@ lt="authentication entry">authentication entries (for HTTP authentication).
A fetch controller is a struct used to enable callers of +fetch to perform certain operations on it after it has started. It has the following +items: + +
ongoing
")
+ ongoing
", "terminated
", or "aborted
"
+To abort a fetch controller
+controller, set controller's state to
+"aborted
".
+
+
To terminate a fetch controller
+controller, set controller's state to
+"terminated
".
+
+
A fetch params fetchParams is aborted if
+its controller's state is
+"aborted
".
+
+
A fetch params fetchParams is canceled if
+its controller's state is
+"aborted
" or "terminated
".
+
A fetch timing info is a struct used to maintain timing
information needed by Resource Timing and Navigation Timing. It has the
following items: [[RESOURCE-TIMING]] [[NAVIGATION-TIMING]]
@@ -2104,6 +2132,16 @@ known as an aborted network error
header list is always empty, and
body is always null.
+ To create the appropriate network error given fetch params
+fetchParams:
+
+ Assert: fetchParams is canceled.
+
+ Return an aborted network error if fetchParams is
+ aborted; otherwise return a network error.
+ A filtered response is a limited view on a
@@ -2285,16 +2323,18 @@ functionality.
request).
A fetch record has an associated
-fetch (a
-fetch algorithm or null).
+controller (a
+fetch controller or null).
When a fetch group is
terminated, for each associated
-fetch record whose request's done flag is
-unset or keepalive is false, terminate the
-fetch record's fetch.
+fetch record whose fetch record's
+controller is not null, and whose request's
+done flag is unset or keepalive is false,
+terminate the fetch record's
+controller.
An ongoing fetch can be
-terminated with flag aborted,
-which is unset unless otherwise specified.
-
The user agent may be asked to
suspend the ongoing fetch.
The user agent may either accept or ignore the suspension request. The suspended fetch can be
@@ -3889,14 +3925,17 @@ the request.
If request is a subresource request, then:
Let record be a new fetch record consisting of
- request and this instance of the fetch algorithm.
+ Let record be a new fetch record whose
+ request is request and controller
+ is fetchParams's controller.
Append record to request's client's
fetch group list of fetch records.
Run main fetch given fetchParams.
+
+ Return fetchParams's controller.
@@ -4354,7 +4393,8 @@ steps:
Run these steps, but abort when the ongoing fetch is terminated:
+ Run these steps, but abort when fetchParams is
+ canceled:
Let blob be request's current URL's
@@ -4385,16 +4425,8 @@ steps:
Return response.
If aborted, then:
-
- Let aborted be the termination's aborted flag.
-
- If aborted is set, then return an aborted network error.
-
- Return a network error.
- If aborted, then return the appropriate network error for
+ fetchParams.
Let transformAlgorithm given chunk be these steps:
If the ongoing fetch is terminated, then abort these steps.
+ If fetchParams is canceled, then abort these
+ steps.
If chunk is not a {{Uint8Array}} object, then
- terminate the ongoing fetch.
+ terminate fetchParams's
+ controller.
Otherwise, enqueue chunk. The user agent may
split the chunk into implementation-defined practical sizes and
@@ -4488,7 +4522,9 @@ these steps:
given fetchParams's cross-origin isolated capability.
Set response to the result of invoking handle fetch for
- requestForServiceWorker. [[!HTML]] [[!SW]]
+ requestForServiceWorker, with fetchParams's
+ controller and fetchParams's
+ cross-origin isolated capability. [[!HTML]] [[!SW]]
If response is not null, then:
@@ -4793,7 +4829,8 @@ steps. They return a response.
Let the revalidatingFlag be unset.
Run these steps, but abort when the ongoing fetch is terminated:
+ Run these steps, but abort when fetchParams is
+ canceled:
If aborted, then:
-
- Let aborted be the termination's aborted flag.
-
- If aborted is set, then return an aborted network error.
+ If aborted, then return the appropriate network error for
+ fetchParams.
- Return a network error.
- If the ongoing fetch is terminated, then:
-
- Let aborted be the termination's aborted flag.
-
- If aborted is set, then return an aborted network error.
-
- Return a network error.
- If fetchParams is canceled, then return the
+ appropriate network error for fetchParams.
Let username and password be the result of prompting the end user
for a username and password, respectively, in request's
@@ -5268,16 +5290,8 @@ steps. They return a response.
Needs testing: multiple ` If the ongoing fetch is terminated, then:
-
- Let aborted be the termination's aborted flag.
-
- If aborted is set, then return an aborted network error.
-
- Return a network error.
- If fetchParams is canceled, then return the
+ appropriate network error for fetchParams.
Prompt the end user as appropriate in request's
@@ -5306,16 +5320,8 @@ steps. They return a response.
then:
If the ongoing fetch is terminated, then:
-
- Let aborted be the termination's aborted flag.
-
- If aborted is set, then return an aborted network error.
-
- Return a network error.
- If fetchParams is canceled, then return the
+ appropriate network error for fetchParams.
Set response to the result of running HTTP-network-or-cache fetch given
fetchParams, isAuthenticationFetch, and true.
@@ -5372,7 +5378,8 @@ optional boolean forceNewConnection (default false), run these steps:
Run these steps, but abort when the ongoing fetch is terminated:
+ Run these steps, but abort when fetchParams is
+ canceled:
If connection is failure, then return a network error.
@@ -5474,7 +5481,8 @@ optional boolean forceNewConnection (default false), run these steps:
Let processBodyChunk given bytes be these steps:
If the ongoing fetch is terminated, then abort these steps.
+ If fetchParams is canceled, then abort these
+ steps.
Run this step in parallel: transmit bytes.
@@ -5488,7 +5496,8 @@ optional boolean forceNewConnection (default false), run these steps:
Let processEndOfBody be these steps:
If the ongoing fetch is terminated, then abort these steps.
+ If fetchParams is canceled, then abort these
+ steps.
If fetchParams's process request end-of-body is
non-null, then run fetchParams's
@@ -5499,12 +5508,15 @@ optional boolean forceNewConnection (default false), run these steps:
Let processBodyError given e be these steps:
If the ongoing fetch is terminated, then abort these steps.
+ If fetchParams is canceled, then abort these
+ steps.
If e is an " Otherwise, terminate the ongoing fetch.
+ Otherwise, terminate fetchParams's
+ controller.
Incrementally read request's body given
@@ -5521,20 +5533,16 @@ optional boolean forceNewConnection (default false), run these steps:
If aborted, then:
Let aborted be the termination's aborted flag.
-
If connection uses HTTP/2, then transmit an If aborted is set, then return an aborted network error.
-
- Return a network error.
+ Return the appropriate network error for fetchParams.
Let pullAlgorithm be an action that resumes the
+ Let pullAlgorithm be an algorithm that resumes the
ongoing fetch if it is suspended.
- Let cancelAlgorithm be an action that terminates
- the ongoing fetch with the aborted flag set.
+ Let cancelAlgorithm be an algorithm that aborts
+ fetchParams's controller.
Let highWaterMark be a non-negative, non-NaN number, chosen by the user agent.
@@ -5550,7 +5558,8 @@ optional boolean forceNewConnection (default false), run these steps:
sizeAlgorithm set to sizeAlgorithm.
Run these steps, but abort when the ongoing fetch is terminated:
+ Run these steps, but abort when fetchParams is
+ canceled:
Set response's body to a new
@@ -5579,10 +5588,8 @@ optional boolean forceNewConnection (default false), run these steps:
If aborted, then:
Let aborted be the termination's aborted flag.
-
- If aborted is set, then set response's
- aborted flag.
+ If fetchParams is aborted, then set
+ response's aborted flag.
Return response.
Run these steps, but abort when the ongoing fetch is terminated:
+ Run these steps, but abort when fetchParams is
+ canceled:
Increase timingInfo's decoded body size by
bytes's length.
- If bytes is failure, then terminate the
- ongoing fetch.
+ If bytes is failure, then terminate
+ fetchParams's controller.
Enqueue a {{Uint8Array}} wrapping an {{ArrayBuffer}}
containing bytes into stream.
If stream is errored, then
- terminate the ongoing fetch.
+ terminate fetchParams.'s
+ controller.
If stream doesn't need more data ask the user
agent to suspend the ongoing fetch.
@@ -5644,10 +5653,9 @@ optional boolean forceNewConnection (default false), run these steps:
If aborted, then:
Let aborted be the termination's aborted flag.
If aborted is set, then:
+ If fetchParams is aborted, then:
Set response's aborted flag.
@@ -7573,6 +7581,8 @@ method steps are:
This lets us reject promises with predictable timing, when the request to abort
comes from the same thread as the call to fetch.
+ Let controller be null.
+
Add the following abort steps to requestObject's
signal:
@@ -7582,7 +7592,8 @@ method steps are:
Abort fetch with p, request, and responseObject.
- Terminate the ongoing fetch with the aborted flag set.
+ If controller is not null, then abort
+ controller.
Let handleFetchDone given response response be to
@@ -7590,7 +7601,8 @@ method steps are:
" Fetch request with processResponseEndOfBody set to
+ Set controller to the result of calling fetch given
+ request, with processResponseEndOfBody set to
handleFetchDone, and processResponse given response
being these substeps:
@@ -7640,7 +7652,7 @@ method steps are:
The user agent may terminate an ongoing fetch if that termination
+ The user agent may terminate an ongoing fetch if that termination
is not observable through script.
"Observable through script" means observable through
@@ -8006,6 +8018,7 @@ resource — for non-CORS requests as well as CORS
requests — and do not use ` In its essence fetching is an exchange of a request for a
@@ -8074,6 +8087,12 @@ in a parallel queue if useParallelQueue is
as arguments will be invoked. Hopefully most standards will not need this.
+ When invoked, the fetch operation returns a fetch controller. The
+controller is used for performing actions on a fetch operation that has already started, such as
+aborting the operation by the user or page logic, or
+terminating it due to a browser-internal circumstance.
+
+
+
+
Resolving domains
@@ -3757,10 +3797,6 @@ an integer representing the number of bytes transmitted. If given,
given, processResponseConsumeBody must be an algorithm accepting a response
and null, failure, or a byte sequence.
-
-
-
-
+ data
"
@@ -4461,10 +4493,12 @@ these steps:
-
-
-
-
-
+ Proxy-Authenticate
` headers, missing,
parsing issues.
-
-
+
-
-
+
-
-
-
AbortError
" {{DOMException}},
- then terminate the ongoing fetch with the aborted flag set.
+ then abort fetchParams's
+ controller.
-
-
- RST_STREAM
frame.
-
-
@@ -5592,7 +5599,8 @@ optional boolean forceNewConnection (default false), run these steps:
-
fetch
".
Garbage collection
-Vary
`.
+
Using fetch in other standards
Acknowledgments