diff --git a/fetch.bs b/fetch.bs index dd3a2f0b0..842262772 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2711,12 +2711,15 @@ has the following items:
deferred
")
+ "deferred
", "scheduled
", "terminated
",
+ "aborted
", or "sent
"
+
+
This value can be modified in parallel. @@ -2726,79 +2729,60 @@ has the following items: terminated:
For each deferred fetch record - deferredRecord in fetchGroup's - deferred fetch records whose invoked is - false: - -
If deferredRecord's pending steps is not - null then abort deferredRecord's - pending steps. - -
For each associated fetch record record, if record's controller is non-null and record's request's done flag is unset or keepalive is false, terminate record's controller. -
When a fetch group fetchGroup is -activated: -for each deferred fetch record deferredRecord in -fetchGroup's deferred fetch records: - -
If deferredRecord's invoked is true then: -
If deferredRecord's invoked callback is not - null then call deferredRecord's invoked callback. - -
Remove deferredRecord from fetchGroup's - deferred fetch records. -
Otherwise, if deferredRecord's - pending steps is not null, then abort - deferredRecord's pending steps and set - deferredRecord's pending steps to null. +
For each deferred fetch record
+ deferredRecord in fetchGroup's
+ deferred fetch records: If the result of atomically exchanging the value
+ of deferredRecord's invoke state with
+ "terminated
" is not "sent
", then the user agent should
+ fetch deferredRecord's request. The
+ exact time in which the fetch takes place is implementation-defined.
When a fetch group fetchGroup is deactivated: +For each deferred fetch record deferredRecord in +fetchGroup's deferred fetch records whose +inactivity deferred delay is not null:
Set deferredRecord's invoke state to
+ "scheduled
".
+
For each deferred fetch record deferredRecord in - fetchGroup's deferred fetch records whose - inactivity deferred delay is not null: set - deferredRecord's pending steps to running the - following steps in parallel: +
Run the following steps in parallel:
Wait until deferredRecord's - inactivity deferred delay have passed. - -
Queue a fetch task to run the following steps with - request's client's - global object: - -
-The user agent should wait until deferredRecord's
+ inactivity deferred delay have passed or until
+ deferredRecord's invoke state is not
+ "scheduled
". The user agent may wait for a longer or shorter period time, e.g., to
+ optimize batching of deferred fetches.
+
+
If the result of atomically exchanging the value of deferredRecord's
+ invoke state with "sent
" is
+ "scheduled
", then fetch record's
+ request.
When a fetch group fetchGroup is
+reactivated:
+For each deferred fetch record deferredRecord in
+fetchGroup's deferred fetch records: If the result of atomically
+exchanging the value of deferredRecord's invoke state
+with "deferred
" is "sent
", then remove
+deferredRecord from fetchGroup's
+deferred fetch records and set deferredRecord's
+sent to true.
+
+
A {{FetchLaterResult}} has an associated deferred fetch record +deferred record. + +
The sent
getter steps are to return
+this's deferred record's sent.
+
The
fetchLater(input, init)
method steps are:
Let promise be a new promise. -
Let requestObject be the result of invoking the initial value of {{Request}} as constructor with input and init as arguments. If that threw an exception, reject promise with that exception and return promise. @@ -8669,17 +8663,24 @@ method steps are:
If backgroundTimeout is not a {{DOMHighResTimeStamp}} then throw a {{TypeError}}.
Let deferredRecord be the result of calling - request a deferred fetch given request and backgroundTimeout. If that - threw an exception, reject promise with that exception and return - promise. + request a deferred fetch given request and backgroundTimeout. This + may throw an exception. -
Set deferredRecord's invoke callback to - resolve promise. +
Add the following abort steps to requestObject's + signal: -
Add the following abort steps to requestObject's - signal: remove deferredRecord from - request's client's fetch group's - deferred fetch records. +
Set deferredRecord's invoke state to
+ "aborted
".
+
+
Remove deferredRecord from + request's client's fetch group's + deferred fetch records. +
Return a new {{FetchLaterResult}} whose deferred record is + deferredRecord.