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

@fergald commented on this pull request.



> +<dl>
+ <dt><dfn export for="deferred fetch record">request</dfn>
+ <dd>A <a for=/>request</a>.
+
+ <dt><dfn export for="deferred fetch record">inactivity delay</dfn> (default null)
+ <dd>Null or a <a>duration</a>.
+
+ <dt><dfn export for="deferred fetch record">invoke state</dfn> (default "<code>deferred</code>")
+ <dd>
+  <p>"<code>deferred</code>", "<code>scheduled</code>", "<code>terminated</code>",
+  "<code>aborted</code>", or "<code>activated</code>".
+
+  <p class=note>This value can be modified <a>in parallel</a>. There could be a race condition where
+  the <code>Document</code> object's <a for=/>event loop</a> might change it to
+  "<code>deferred</code>" at the same time that it is changed to "<code>activated</code>". UAs can
+  mitigate this race condition in an <a>implementation-defined</a> manner.

Can we make this tighter?

We need the following code to reliably cancel a beacon if the `if` branch is entered.

```
if (!fetchLaterResult.activated) {
  abortController.abort();
}
```

Normally you'd say that in terms of tasks on the document's event loop but since we're dealing with cases where the event loop is not processing, that's not possible.

Can we include something about the code above in a comment?

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

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

Received on Friday, 1 September 2023 09:14:20 UTC