Re: [whatwg/fetch] Deferred fetching (PR #1647)

@fergald commented on this pull request.



> -<a for="fetch record">controller</a>.
+<p>When a <a for=fetch>fetch group</a> <var>fetchGroup</var> is
+<dfn export for="fetch group" id=concept-fetch-group-terminate>terminated</dfn>:
+
+<ol>
+ <li><p>For each associated <a for="fetch group">fetch record</a> <var>record</var>,
+ if <var>record</var>'s <a for="fetch record">controller</a> is non-null and
+ <var>record</var>'s <a for="fetch record">request</a>'s <a>done flag</a> is unset or
+ <a for=request>keepalive</a> is false, <a for="fetch controller">terminate</a> <var>record</var>'s
+ <a for="fetch record">controller</a>.
+
+ <li><p><a for=list>For each</a> <a for="fetch group">deferred fetch record</a>
+ <var>deferredRecord</var> in <var>fetchGroup</var>'s
+ <a for="fetch group">deferred fetch records</a>: If the result of atomically exchanging the value
+ of <var>deferredRecord</var>'s <a for="deferred fetch record">invoke state</a> with
+ "<code>terminated</code>" is not "<code>sent</code>", then the user agent should

Should this be

is not sent or aborted

? Or are we insulated from that case by the fact that aborting removes the record from the group?

> + <li><p>Let <var>request</var> be <var>requestObject</var>'s <a for=Request>request</a>.
+
+ <li><p>Let <var>backgroundTimeout</var> be null.
+
+ <li><p>If <var>init</var> is given and <var>init</var>["<code>backgroundTimeout</code>"]
+ <a for=map>exists</a> then set <var>backgroundTimeout</var> to
+ <var>init</var>["<code>backgroundTimeout</code>"].
+
+ <li><p>If <var>backgroundTimeout</var> is not a {{DOMHighResTimeStamp}} then throw a {{TypeError}}.
+
+ <li><p>Let <var>deferredRecord</var> be the result of calling
+ <a>request a deferred fetch</a> given <var>request</var> and <var>backgroundTimeout</var>. This
+ may throw an exception.
+
+ <li>
+  <p><a for=AbortSignal lt=add>Add the following abort steps</a> to <var>requestObject</var>'s

My reading of this is that abort cannot be seen from JS. A request that has been aborted is indistinguishable from a request that is waiting to send. This is suprising to me and seems like a problem.

I feel like `pending` is a direct representation of the state. `sent==true` does not actually mean that it has been successfuly sent or even an attempt has been made yet. It also allows us to simplify the states of the beacon, merging `aborted` and `sent` into one.

That said, we might want to keep a distinction, in which case we would actually want to expose both bits.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1647#pullrequestreview-1482698676
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1647/review/1482698676@github.com>

Received on Friday, 16 June 2023 04:39:23 UTC