@@ -2752,14 +2752,15 @@ functionality.
2752
2752
<dfn export id=concept-fetch-group for=fetch>fetch group</dfn> .
2753
2753
2754
2754
<p> A <a for=fetch>fetch group</a> has an associated
2755
- <dfn lt="fetch record" export for="fetch group" id=concept-fetch-record>fetch records</dfn> ,
2756
- a <a for=/>list</a> of <a for="/" data-lt="fetch record">fetch records</a> .
2755
+ <dfn lt="fetch record" export for="fetch group" id=concept-fetch-record>fetch records</dfn> , a
2756
+ <a for=/>list</a> of <a for="/" data-lt="fetch record">fetch records</a> .
2757
2757
2758
2758
<p> A <a for=fetch>fetch group</a> has an associated
2759
- <dfn export for="fetch group" id=concept-defer=fetch-record>deferred fetch records</dfn> ,
2760
- a <a for=/>list</a> of <a data-lt="deferred fetch record">deferred fetch records</a> .
2759
+ <dfn export for="fetch group" id=concept-defer=fetch-record>deferred fetch records</dfn> , a
2760
+ <a for=/>list</a> of <a data-lt="deferred fetch record">deferred fetch records</a> .
2761
2761
2762
- <p> A <dfn export>fetch record</dfn> is a [=struct=] . It has the following items:
2762
+ <p> A <dfn export>fetch record</dfn> is a <a for=/>struct</a> with the following
2763
+ <a for=struct>items</a> :
2763
2764
2764
2765
<dl>
2765
2766
<dt> <dfn export for="fetch record">request</dfn>
@@ -2770,9 +2771,9 @@ a <a for=/>list</a> of <a data-lt="deferred fetch record">deferred fetch records
2770
2771
</dl>
2771
2772
<hr>
2772
2773
2773
- <p> A <dfn>deferred fetch record</dfn> is a <a for=/>struct</a> used to maintain state needed
2774
- to invoke a fetch at a later time, e.g., when a document is unloaded or becomes
2775
- not <a for=Document>fully active</a> . It has the following <a for=struct>items</a> :
2774
+ <p> A <dfn>deferred fetch record</dfn> is a <a for=/>struct</a> used to maintain state needed to
2775
+ invoke a fetch at a later time, e.g., when a document is unloaded or becomes not
2776
+ <a for=Document>fully active</a> . It has the following <a for=struct>items</a> :
2776
2777
2777
2778
<dl>
2778
2779
<dt> <dfn for="deferred fetch record">request</dfn>
@@ -6995,40 +6996,37 @@ reserve 8 kibibytes:
6995
6996
<ul>
6996
6997
<li>
6997
6998
<p><code> https://top.example.com</code> , with permissions policy set to
6998
- <code> Permissions-policy: deferred-fetch=(self "https://ok.example.com")</code></p>
6999
+ <code> Permissions-policy: deferred-fetch=(self "https://ok.example.com")</code>
6999
7000
<ul>
7000
7001
<li>
7001
7002
<p><code> https://top.example.com/frame</code> : shares quota with the top-level traversable, as
7002
- they are same origin.</p>
7003
+ they are same origin.
7003
7004
7004
- <ul><li><p><code> https://x.example.com</code> : receives 8 kibibytes.</p></li></ul>
7005
- </li>
7005
+ <ul><li><p><code> https://x.example.com</code> : receives 8 kibibytes.</ul>
7006
7006
7007
7007
<li>
7008
- <p><code> https://x.example.com</code> : receives 8 kibibytes.</p>
7008
+ <p><code> https://x.example.com</code> : receives 8 kibibytes.
7009
7009
<ul><li><p><code> https://top.example.com</code> : 0. Even though it's same origin with the
7010
7010
top-level traversable, it does not automatically share its quota as they are separated by a
7011
- cross-origin intermediary.</p></ul>
7012
- </li>
7011
+ cross-origin intermediary.</ul>
7013
7012
7014
7013
<li>
7015
7014
<p><code> https://ok.example.com/good</code> : receives 64 kibibytes, granted via the
7016
- "{{PermissionsPolicy/deferred-fetch}} " policy.</p>
7015
+ "{{PermissionsPolicy/deferred-fetch}} " policy.
7017
7016
7018
7017
<ul><li><p><code> https://x.example.com</code> : receives no quota. Only documents with the same
7019
7018
origin as the top-level traversable can grant the 8 kibibytes based on the
7020
- "{{PermissionsPolicy/deferred-fetch-minimal}} " policy.</p></li></ ul>
7019
+ "{{PermissionsPolicy/deferred-fetch-minimal}} " policy.</ul>
7021
7020
7022
7021
<li><p><code> https://ok.example.com/redirect</code> , navigated to
7023
7022
<code> https://x.example.com</code> : receives no quota. The reserved 64 kibibytes for
7024
7023
<code> https://ok.example.com</code> are not available for
7025
- <code> https://x.example.com</code> .</p></li>
7024
+ <code> https://x.example.com</code> .
7026
7025
7027
7026
<li><p><code> https://ok.example.com/back</code> , navigated to
7028
7027
<code> https://top.example.com</code> : shares quota with the top-level traversable, as they're
7029
- same origin.</p></li>
7028
+ same origin.
7030
7029
</ul>
7031
- </li>
7032
7030
</ul>
7033
7031
7034
7032
<p> In the above example, the <a for=/>top-level traversable</a> and its <a>same origin</a>
@@ -7132,7 +7130,7 @@ descendants share a quota of 384 kibibytes. That value is computed as such:
7132
7130
<li>
7133
7131
<p> <a for=list>For each</a> <a>deferred fetch record</a> <var> deferredRecord</var> of
7134
7132
<var> navigable</var> 's <a for=navigable>active document</a>' s <a>fetch group</a> 's
7135
- <a for="fetch group">deferred fetch records</a> :</p>
7133
+ <a for="fetch group">deferred fetch records</a> :
7136
7134
7137
7135
<ol>
7138
7136
<li><p> Let <var> requestLength</var> be the <a>total request length</a> of
@@ -8960,7 +8958,6 @@ partial interface mixin WindowOrWorkerGlobalScope {
8960
8958
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
8961
8959
};
8962
8960
8963
-
8964
8961
dictionary DeferredRequestInit : RequestInit {
8965
8962
DOMHighResTimeStamp activateAfter;
8966
8963
};
@@ -9114,9 +9111,8 @@ which is an algorithm returning a boolean.
9114
9111
the result of running <a>this</a> 's <a for=FetchLaterResult>activated getter steps</a> .
9115
9112
</div>
9116
9113
9117
- <div algorithm="dom-fetch-later">
9118
- <p> The
9119
- <dfn method for=Window><code>fetchLater(<var>input</var>, <var>init</var>)</code></dfn>
9114
+ <div algorithm>
9115
+ <p> The <dfn method for=Window><code>fetchLater(<var>input</var>, <var>init</var>)</code></dfn>
9120
9116
method steps are:
9121
9117
9122
9118
<ol>
@@ -9169,11 +9165,17 @@ method steps are:
9169
9165
<li><p> Return a new {{FetchLaterResult}} whose
9170
9166
<a for=FetchLaterResult>activated getter steps</a> are to return <var> activated</var> .
9171
9167
</ol>
9168
+ </div>
9172
9169
9173
9170
<div class=example id=fetch-later-examples>
9174
9171
<p> The following call would queue a request to be fetched when the document is terminated:
9175
- <pre><code class=lang-javascript> fetchLater("https://report.example.com", { method: "POST",
9176
- body: JSON.stringify(myReport) })</code></pre>
9172
+
9173
+ <pre><code class=lang-javascript>
9174
+ fetchLater("https://report.example.com", {
9175
+ method: "POST",
9176
+ body: JSON.stringify(myReport),
9177
+ headers: { "Content-Type": "application/json" }
9178
+ })</code></pre>
9177
9179
9178
9180
<p> The following call would also queue this request after 5 seconds, and the returned value would
9179
9181
allow callers to observe if it was indeed activated. Note that the request is guaranteed to be
@@ -9183,15 +9185,16 @@ method steps are:
9183
9185
const result = fetchLater("https://report.example.com", {
9184
9186
method: "POST",
9185
9187
body: JSON.stringify(myReport),
9188
+ headers: { "Content-Type": "application/json" },
9186
9189
activateAfter: 5000
9187
9190
});
9188
9191
9189
9192
function check_if_fetched() {
9190
9193
return result.activated;
9191
- }
9192
- </code></pre>
9194
+ }</code></pre>
9195
+
9196
+ <p> The {{FetchLaterResult}} object can be used together with an {{AbortSignal}} . For example:
9193
9197
9194
- <p> The {{FetchLaterResult}} object can be used together with an {{AbortSignal}} . For example:
9195
9198
<pre><code class=lang-javascript>
9196
9199
let accumulated_events = [];
9197
9200
let previous_result = null;
@@ -9211,31 +9214,31 @@ method steps are:
9211
9214
result = fetchLater("https://report.example.com", {
9212
9215
method: "POST",
9213
9216
body: JSON.stringify(accumulated_events),
9217
+ headers: { "Content-Type": "application/json" },
9214
9218
activateAfter: 5000,
9215
9219
abort_signal
9216
9220
});
9217
- }
9218
- </code></pre>
9221
+ }</code></pre>
9219
9222
9223
+ <p> Any of the following calls to <a method><code>fetchLater()</code></a> would throw:
9220
9224
9221
- <p> Any of the following calls to <a method><code>fetchLater()</code></a> would throw:
9222
- <pre><code class=lang-javascript>
9223
- // Only <a>potentially trustworthy url</a> s are supported.
9224
- fetchLater("http://untrusted.example.com");
9225
+ <pre><code class=lang-javascript>
9226
+ // Only <a>potentially trustworthy URL</a> s are supported.
9227
+ fetchLater("http://untrusted.example.com");
9225
9228
9226
- // The length of the deferred request has to be known when.
9227
- fetchLater("https://origin.example.com", {body: someDynamicStream});
9229
+ // The length of the deferred request has to be known when.
9230
+ fetchLater("https://origin.example.com", {body: someDynamicStream});
9228
9231
9229
- // Deferred fetching only works on active windows.
9230
- const detachedWindow = iframe.contentWindow;
9231
- iframe.remove();
9232
- detachedWindow.fetchLater("https://origin.example.com");
9233
- </code></pre>
9232
+ // Deferred fetching only works on active windows.
9233
+ const detachedWindow = iframe.contentWindow;
9234
+ iframe.remove();
9235
+ detachedWindow.fetchLater("https://origin.example.com");</code></pre>
9234
9236
9235
- See <a href="#deferred-fetch-quota-examples">deferred fetch quota examples</a> for examples
9236
- portraying how the deferred-fetch quota works.
9237
+ <p> See <a href="#deferred-fetch-quota-examples">deferred fetch quota examples</a> for examples
9238
+ portraying how the deferred-fetch quota works.
9237
9239
</div>
9238
9240
9241
+
9239
9242
<h3 id=garbage-collection>Garbage collection</h3>
9240
9243
9241
9244
<p> The user agent may <a for="fetch controller">terminate</a> an ongoing fetch if that termination
0 commit comments