You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prefetch.bs
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -556,7 +556,7 @@ Modify the [=snapshot source snapshot params=] algorithm to set the return value
556
556
1. Let |request| be the result of [=creating a navigation request=] given <var ignore>entry</var>, <var ignore>sourceSnapshotParams</var>'s [=source snapshot params/fetch client=], <var ignore>navigable</var>'s [=navigable/container=], and <var ignore>sourceSnapshotParams</var>'s [=source snapshot params/has transient activation=].
557
557
1. Set |request|'s [=request/replaces client id=] to <var ignore>navigable</var>'s [=navigable/active document=]'s [=relevant settings object=]'s [=environment/id=].
558
558
1. Let |prefetched| be false.
559
-
1. If <var ignore>documentResource</var> is null:
559
+
1. If <var ignore>documentResource</var> is null and <var ignore>navigable</var> is a [=top-level traversable=]:
560
560
1. Let |prefetchRecord| be the result of [=waiting for a matching prefetch record=] given <var ignore>navigable</var>, <var ignore>sourceSnapshotParams</var>, <var ignore>entry</var>'s [=session history entry/URL=], and <var ignore>sourceSnapshotParams</var>'s [=source snapshot params/sandboxing flags=].
561
561
1. If |prefetchRecord| is not null:
562
562
1. Set <var ignore>navigationParams</var> to the result of [=creating navigation params from a prefetch record=] given <var ignore>navigable</var>, <var ignore>entry</var>'s [=session history entry/document state=], <var ignore>navigationId</var>, <var ignore>navTimingType</var>, <var ignore>request</var>, |prefetchRecord|, <var ignore>targetSnapshotParams</var>, and <var ignore>sourceSnapshotParams</var>.
@@ -565,7 +565,7 @@ Modify the [=snapshot source snapshot params=] algorithm to set the return value
565
565
<div class="note">This copy is complete before continuing, in the sense that subresource fetches, {{Document/cookie|document.cookie}}, etc. can observe the cookies. If the prefetch never reached a cross-site URL, there will be no cookies to copy.</div>
566
566
1. Set |prefetched| to true.
567
567
568
-
<p class="note">This means that prefetches are only ever used to fulfill \``GET`\` requests.</p>
568
+
<p class="note">This means that prefetches are only ever used to fulfill \``GET`\` requests, and only ever activated into [=top-level traversables=].</p>
569
569
1. If |prefetched| is false:
570
570
1. Let |coopEnforcementResult| be the result of [=creating a cross-origin opener policy enforcement result for navigation=] given <var ignore>navigable</var>'s [=navigable/active document=] and <var ignore>entry</var>'s [=session history entry/document state=]'s [=document state/initiator origin=].
571
571
1. Set <var ignore>navigationParams</var> to the result of [=creating navigation params by fetching=] given |request|, <var ignore>entry</var>, |coopEnforcementResult|, <var ignore>navigable</var>, <var ignore>sourceSnapshotParams</var>, <var ignore>targetSnapshotParams</var>, <var ignore>cspNavigationType</var>, <var ignore>navigationId</var>, and <var ignore>navTimingType</var>.
@@ -794,6 +794,9 @@ The <dfn>list of sufficiently strict speculative navigation referrer policies</d
794
794
<div algorithm>
795
795
To <dfn export>prefetch</dfn> given a {{Document}} |document| and a [=prefetch record=] |prefetchRecord|, perform the following steps.
796
796
797
+
1. [=Assert=]: |document|'s [=node navigable=] is a [=top-level traversable=].
798
+
799
+
<p class="note" id="note-prefetch-top-level">Supporting prefetches in [=child navigables=] has some complexities and is not currently defined. It might be possible to define in the future.</p>
797
800
1. If |document| [=has a matching prefetch record=] given |prefetchRecord|, then return.
798
801
1. Let |sourceSnapshotParams| be the result of [=snapshotting source snapshot params=] given |document|.
799
802
1. Let |targetSnapshotParams| be the result of [=snapshotting target snapshot params=] given |document|'s [=node navigable=].
@@ -614,6 +615,14 @@ A <dfn>prerender candidate</dfn> is a [=speculative load candidate=] with the fo
614
615
<div algorithm="consider speculation">
615
616
To <dfn>consider speculation</dfn> for a [=document=] |document|:
616
617
618
+
1. If |document|'s [=node navigable=] is not a [=top-level traversable=], then return.
619
+
620
+
<p class="note" id="note-speculation-top-level">Supporting speculative loads in [=child navigables=] has some complexities and is not currently defined. It might be possible to define in the future.</p>
621
+
622
+
1. If |document|'s [=node navigable=] is a [=prerendering navigable=], then return.
623
+
624
+
<p class="note" id="note-speculation-prerendering">Speculative loads in prerendering navigables would be too potentially wasteful.</p>
625
+
617
626
1. [=Queue a microtask=] that runs the following steps given |document|:
618
627
1. If |document| is not [=Document/fully active=], then return.
619
628
<p class="issue">It's likely that we should also handle prerendered documents.
0 commit comments