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

@noamr 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.

Actually I think we can make it tighter and getting rid of the raciness by making `activated` async:

```js
const activated = await fetchLaterResult.checkActivationStatus();
if (!activated) {
  abortController.abort();
}
``` 

WDYT? Also @annevk 

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

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

Received on Sunday, 3 September 2023 12:39:37 UTC