- From: Ming-Ying Chung <notifications@github.com>
- Date: Tue, 26 Sep 2023 23:03:35 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1647/review/1645654690@github.com>
@mingyc commented on this pull request. > +<pre class=idl> + +dictionary DeferredRequestInit : RequestInit { + DOMHighResTimeStamp backgroundTimeout; +}; + +interface FetchLaterResult { + readonly attribute boolean sent; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [NewObject] FetchLaterResult fetchLater(RequestInfo input, optional DeferredRequestInit init = {}); +}; +</pre> + +<p>A {{FetchLaterResult}} has an associated <a>deferred fetch record</a> Resolved. > @@ -8481,6 +8615,75 @@ with a <var>promise</var>, <var>request</var>, <var>responseObject</var>, and an </div> +<h3 id=fetch-later-method>FetchLater method</h3> + +<pre class=idl> + +dictionary DeferredRequestInit : RequestInit { + DOMHighResTimeStamp backgroundTimeout; +}; + +interface FetchLaterResult { + readonly attribute boolean sent; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [NewObject] FetchLaterResult fetchLater(RequestInfo input, optional DeferredRequestInit init = {}); Resolved > + throw a {{NotAllowedError}}. + + <p class=note>User-agents can, for example, decide that deferred fetching is not allowed for + subframes or gated behind some permission. + </li> + + <li><p>Let <var>requestObject</var> be the result of invoking the initial value of {{Request}} as + constructor with <var>input</var> and <var>init</var> as arguments. This may throw an exception. + + <li><p>If <var>requestObject</var>'s <a for=Request>signal</a> is <a for=AbortSignal>aborted</a>, + then throw <a for=Request>signal</a>'s <a for=AbortSignal>abort reason</a>. + + <li><p>Let <var>request</var> be <var>requestObject</var>'s <a for=Request>request</a>. + + <li><p>If <var>request</var>'s <a for=request>URL</a>'s <a for=url>scheme</a> is not an + <a>HTTP(S) scheme</a> then throw a {{TypeError}}. @noamr This one is not addressed. > + </li> + + <li><p><a for=list>For each</a> <a>deferred fetch record</a> <var>deferredRecord</var> in + <var>request</var>'s <a for=request>client</a>'s <a for=fetch>fetch group</a>'s + <a for="fetch group">deferred fetch records</a>: if <var>deferredRecord</var>'s + <a for="deferred fetch record">request</a>'s <a for=request>body</a> is not null and + <var>deferredRecord</var>'s <a for="deferred fetch record">request</a>'s <a for=request>URL</a>'s + <a for=url>origin</a> is <a>same origin</a> with <var>request</var>'s <a for=request>URL</a>'s + <a for=url>origin</a>, then increment <var>totalScheduledDeferredBytesForOrigin</var> by + <var>deferredRecord</var>'s <a for="deferred fetch record">request</a>'s <a for=request>body</a>'s + <a for=body>length</a>. + + <li><p>If <var>totalScheduledDeferredBytesForOrigin</var> is greater than 64 kilobytes, then + throw a {{QuotaExceededError}}. + + <li><p>Set <var>request</var>'s <a for=request>keepalive</a> to true. This one should be resolved now as we explicilty forbid ReadableStream. > + <a for=request>body</a>'s <a for=body>length</a> is null, then throw a {{TypeError}}. + + <li><p>Set <var>totalScheduledDeferredBytesForOrigin</var> to <var>request</var>'s + <a for=request>body</a>'s <a for=body>length</a>. + </ol> + </li> + + <li><p><a for=list>For each</a> <a>deferred fetch record</a> <var>deferredRecord</var> in + <var>request</var>'s <a for=request>client</a>'s <a for=fetch>fetch group</a>'s + <a for="fetch group">deferred fetch records</a>: if <var>deferredRecord</var>'s + <a for="deferred fetch record">request</a>'s <a for=request>body</a> is not null and + <var>deferredRecord</var>'s <a for="deferred fetch record">request</a>'s <a for=request>URL</a>'s + <a for=url>origin</a> is <a>same origin</a> with <var>request</var>'s <a for=request>URL</a>'s + <a for=url>origin</a>, then increment <var>totalScheduledDeferredBytesForOrigin</var> by + <var>deferredRecord</var>'s <a for="deferred fetch record">request</a>'s <a for=request>body</a>'s + <a for=body>length</a>. Resolved. > +<var>inactivityDeferredDelay</var> (default null): + +<ol> + <li><p>Assert: <var>request</var>'s <a for=request>client</a> is an + <a>environment settings object</a>. + + <li>Let <var>totalScheduledDeferredBytesForOrigin</var> be 0. + + <li> + <p>If <var>request</var>'s <a for=request>body</a> is not null then: + + <ol> + <li><p>If <var>request</var>'s + <a for=request>body</a>'s <a for=body>length</a> is null, then throw a {{TypeError}}. + + <li><p>Set <var>totalScheduledDeferredBytesForOrigin</var> to <var>request</var>'s Ok Resolved. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1647#discussion_r1338081170 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1647/review/1645654690@github.com>
Received on Wednesday, 27 September 2023 06:03:40 UTC