-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add speculation rules prefetch #11426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7ff9848
to
c23dcae
Compare
c23dcae
to
6ea2451
Compare
The spec text here is done and ready for review! Marking "do not merge yet" until I get the other prerequisites listed in the OP done (mostly PRs against other specs). |
Part of whatwg/html#11426, for requests initiated by the `Speculation-Rules` HTTP header.
33f0b13
to
647afa5
Compare
whatwg/html#11426 upstreams most of the speculation rules specification to HTML. Remove the upstreamed portions, and add references to the PR and PR preview.
This is now fully ready for review, including all prerequisites. I'll keep "do not merge yet" to reflect that we need to get #11442 reviewed and merged first, but that's a pretty small change... |
This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632}
This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633}
This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632}
This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633}
This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633}
This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632}
This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} Co-authored-by: Domenic Denicola <[email protected]>
This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632}
This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632}
…sts#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} Co-authored-by: Domenic Denicola <[email protected]>
…sts#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633}
This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633}
This ports the relevant text from https://wicg.github.io/nav-speculation/speculation-rules.html, with minor improvements and additions. It does *not* port the actual navigational prefetching algorithms, which are left in https://wicg.github.io/nav-speculation/prefetch.html for now. Notable changes from that document: * Allows treating prerender rules as prefetch rules. * Allows the presence of target_hint (a prerender-specific speculation rule key), but ignores it. * Follows the precedent set by import maps a bit more closely in how it integrates with the script processing model. Normatively, it fires error events on the script element for the few things that cause complete parsing failures. * Adds conformance requirements for speculation rules JSON documents, following the precedent set by import maps. * Adds explicit callouts for when the implementation may report warnings for parsing failures, following the precedent set by import maps. * Fixes a few minor bugs in the parsing algorithms. E.g., the previous text did not correctly deal with how CSS selector parsing returned a list, or called the slightly wrong algorithm for parsing URL patterns. * Simplified the processing model for the Speculation-Rules HTTP header. The previous text added various concepts around pending fetches and periodic implementation-defined processing of those fetches, all designed to allow the implementation to de-prioritize these fetches in favor of other things that happen during loading. This version instead explicitly allows an implementation-defined wait time and uses a separate task source which user agents can deprioritize. * Be explicit about when to consider speculative loads, instead of using vague language about "whenever something relevant changes". * Add re-parsing of <script type=speculationrules> on base URL changes, to match the Chromium implementation. * Slightly shorten some of the security and privacy considerations, e.g., by not mentioning mixed content concerns.
647afa5
to
d56b452
Compare
whatwg/html#11426 upstreams most of the speculation rules specification to HTML. Remove the upstreamed portions, and add references to the PR and PR preview.
…n rules tags, a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules tags (#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} Co-authored-by: Domenic Denicola <[email protected]> -- wpt-commits: 8c89451fb0955254073a736d55dc077abff0e391 wpt-pr: 53822
Could you, please, add a Note remarking the rationale for non-support for the |
We generally don't support new headers through |
I've added #11494 to document that in the overall definition of http-equiv. |
…r invalid speculation rules, a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632} -- wpt-commits: 1d91c36a40b59a975a869f4d5749ff3004839dab wpt-pr: 53821
…eculation rules tags", a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules tags (#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} -- wpt-commits: 978340f5361ac897deb74a619980fea749313f28 wpt-pr: 53905
That works. Thanks. |
…n rules tags, a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules tags (#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} Co-authored-by: Domenic Denicola <[email protected]> -- wpt-commits: 8c89451fb0955254073a736d55dc077abff0e391 wpt-pr: 53822
…r invalid speculation rules, a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules This CL introduces error handling for <script type=speculationrules>, mirroring the behavior of <script type=importmap>. Specifically, it adds error events for two cases: - Inline speculation rules with unparsable JSON. - External speculation rules, which are not yet supported. This is verified by new web platform tests. This follows the spec change at whatwg/html#11426. Change-Id: I9b0776b86059f6c8734d57c17f50ed26e89215da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6758353 Reviewed-by: Hiroki Nakagawa <[email protected]> Commit-Queue: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488632} -- wpt-commits: 1d91c36a40b59a975a869f4d5749ff3004839dab wpt-pr: 53821
…eculation rules tags", a=testonly Automatic update from web-platform-tests Fire error events for invalid speculation rules tags (#53822) This CL introduces error handling for <script type=speculationrules> with invalid ruleset-level tags. This changes the behavior: previously we would ignore such tags and preload with the null tag. But now, we error the entire <script type=speculationrules>, since it is better to avoid preloading if the web developer is expecting it to get a certain tag and we cannot fulfill that request. This matches the spec update at whatwg/html#11426. Bug: None Change-Id: I5d2211510bd4e3a3ecce15010325b411f18fde3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6746174 Commit-Queue: Domenic Denicola <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1488633} -- wpt-commits: 978340f5361ac897deb74a619980fea749313f28 wpt-pr: 53905
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass, although I'm certainly less than half-way through. Mostly small things and questions so far.
|
||
<li><p>If <var>prefetchRecord</var> is not <span>still being speculated</span> given | ||
<var>prefetchCandidates</var>, then <span data-x="prefetch-record-cancel-and-discard">cancel | ||
and discard</span> <var>prefetchRecord</var> given <var>document</var>.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this result in any prefetch request being canceled other than the one associated with the triggering of this algorithm to run in the first place? I'm asking because I know spec-wise we simplify things by "considering all speculative loads" in a state-less way whenever any individual link-specific thing happened, causing this algorithm to run. And I'm just trying to make sure it's not possible for a <a>
's href
attribute to be mutated, and for this algorithm to run and cancel an unrelated speculative load (because we evaluate all the thingz), in a way that a smarter implementation would never do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In spirit: no. But literally: yes.
This is because of the microtask queuing behavior. If you do
mutateLink1();
mutateLink2();
mutateLink3();
then mutateLink1()
queues a microtask to "consider speculative loads", mutateLink2()
and mutateLink3()
do nothing, and by the time the microtask runs, "consider speculative loads" will cancel prefetches from all 3 links.
In the Chromium implementation, what this looks like is all the various steps that call "consider speculative loads" add to a list of dirty candidates, and so this step looks at the dirty list.
Do you think explaining this implementation strategy would be worth a note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so it is possible for this to cancel multiple things beyond what the thing invoking this algorithm would do, but not so much "in a way that a smarter implementation would never do" since implementations achieve the same outcome just with a different, more stateful mechanism, if I'm correct. So the observable results shouldn't differ. I think that's worth a pretty brief note, yeah!
elements, given <var>insertedNode</var>, are:</p> | ||
|
||
<ol> | ||
<li><p><span>Consider speculative loads</span> given <var>insertedNode</var>'s <span>node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insertion steps do not imply connectedness, so just like the Chromium implementation, you'll need a connected check here, or you can use the post-connection steps (but you'd want to adjust the implementation to match that, since it's observable). Your best bet is just to add a connected check here and elsewhere relevant.
<p>The <span>HTML element removing steps</span> for <code>a</code> and <code>area</code> elements, | ||
given <var>removedNode</var> and <var>oldParent</var>, are:</p> | ||
|
||
<ol> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, you'll want to only proceed if <var>oldParent</var>
was connected. This matches Chromium too.
|
||
<li> | ||
<p>If <var>localName</var> is <code data-x="attr-hyperlink-href">href</code>, then <span | ||
data-x="concept-hyperlink-url-set">set the url</span> given <var>element</var>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really find a way to lean on the weird, unlinkable, unreferenced "change" definition in https://html.spec.whatwg.org/C#dom-trees someday.... but not today.
<span data-x="url parser">parsing</span> them involves a <span>Blob URL Store</span> lookup.</p> | ||
</li> | ||
|
||
<!-- PRERENDERING: also monitor target="" for target-hint. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why this is here? It's just a breadcrumb for when we eventually upstream prerendering? Are we likely to forget to do this, or inversely, are we like to remember to scan through all PRERENDERING:
instances to ensure we completed the full upstreaming?
types</a> includes the <code data-x="rel-noreferrer">noreferrer</code> keyword, then return | ||
"<code data-x="">no-referrer</code>".</p></li> | ||
|
||
<li><p>Return the current state of <var>subject</var>'s <code data-x="">referrerpolicy</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not linked previously, but it seems like it should be linked.
<li><p>Return the current state of <var>subject</var>'s <code data-x="">referrerpolicy</code> | |
<li><p>Return the current state of <var>subject</var>'s <code data-x="attr-hyperlink-referrerpolicy">referrerpolicy</code> |
<p>The user agent may <span data-x="list append">append</span> "<code | ||
data-x="">prerender</code>" to <var>typesToTreatAsPrefetch</var>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this means that "requires": ["anonymous-client-ip-when-cross-origin"]
in prerender
will be honored, but would be ignored when prerender
is supported as prerender. Is that intended?
</ol> | ||
</li> | ||
|
||
<li><p>Return a <span>document rule CSS selector predicate</span> whose <span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In spec land it's just selector, not CSS selector.
|
||
<p class="note">Such links, though present in <var>document</var>, aren't available for the | ||
user to interact with, and thus are unlikely to be good candidates. In addition, they might | ||
not have their style or layout computed, which might make CSS selector matching less efficient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not have their style or layout computed, which might make CSS selector matching less efficient | |
not have their style or layout computed, which might make selector matching less efficient |
data-x="">params=("a")</code>.</p></li> | ||
</ol> | ||
|
||
<p>With the current definition fo <span data-x="sl-candidate-redundant-with">redundant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
<p>With the current definition fo <span data-x="sl-candidate-redundant-with">redundant | |
<p>With the current definition of <span data-x="sl-candidate-redundant-with">redundant |
</ol> | ||
|
||
<p>To <dfn>compute a speculative load referrer policy</dfn> given a <span>speculation rule</span> | ||
<var>rule</var> and an <code>HTMLHyperlinkElementUtils</code>-or-null <var>link</var>:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it a bit surprising to reference HTMLHyperlinkElementUtils
here since it's a mixin, but maybe it's OK. Alternative could be "a
or area
element"
|
||
<ol> | ||
<li><p><span>Unregister speculation rules</span> given <var>removedNode</var>'s <span>relevant | ||
global object</span> and <var>removedNode</var>'s <span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing does not imply connected (see <var>isParentConnected</var>
in https://dom.spec.whatwg.org/#concept-node-remove), so it is possible that <var>script</var>
is in a detached document, and that its relevant global object is... null, right? Actually I'm curious how the implementation handles this, but I couldn't find any RemovedFrom()
override in Chromium's HTMLScriptElement
.
|
||
<ol> | ||
<li><p>Run the <code>script</code> <span>HTML element post-connection steps</span>, given | ||
<var>changedNode</var>.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Not actionable / just FYI, after reviewing this I decided to make #11543, and make this algorithm implement the connectedness pre-condition, after confusing myself about connectedness requirements.)
Other spec PRs that should be merged shortly after this one:
This ports the relevant text from https://wicg.github.io/nav-speculation/speculation-rules.html, with minor improvements and additions. It does not port the actual navigational prefetching algorithms, which are left in https://wicg.github.io/nav-speculation/prefetch.html for now.
Part of #11123.
Notable changes from that document:
Allows treating prerender rules as prefetch rules.
Allows the presence of target_hint (a prerender-specific speculation rule key), but ignores it.
Follows the precedent set by import maps a bit more closely in how it integrates with the script processing model. Normatively, it fires error events on the script element for the few things that cause complete parsing failures. (Chromium recently changed to do this.)
Adds conformance requirements for speculation rules JSON documents, following the precedent set by import maps.
Adds explicit callouts for when the implementation may report warnings for parsing failures, following the precedent set by import maps.
Fixes a few minor bugs in the parsing algorithms. E.g., the previous text did not correctly deal with how CSS selector parsing returned a list, or called the slightly wrong algorithm for parsing URL patterns.
Simplified the processing model for the Speculation-Rules HTTP header. The previous text added various concepts around pending fetches and periodic implementation-defined processing of those fetches, all designed to allow the implementation to de-prioritize these fetches in favor of other things that happen during loading. This version instead explicitly allows an implementation-defined wait time and uses a separate task source which user agents can deprioritize.
Be explicit about when to consider speculative loads, instead of using vague language about "whenever something relevant changes".
Add re-parsing of
<script type=speculationrules>
on base URL changes, to match the Chromium implementation.Slightly shorten some of the security and privacy considerations, e.g., by not mentioning mixed content concerns.
(See WHATWG Working Mode: Changes for more details.)
/acknowledgements.html ( diff )
/browsers.html ( diff )
/browsing-the-web.html ( diff )
/document-lifecycle.html ( diff )
/document-sequences.html ( diff )
/iana.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )
/links.html ( diff )
/nav-history-apis.html ( diff )
/references.html ( diff )
/scripting.html ( diff )
/semantics.html ( diff )
/urls-and-fetching.html ( diff )
/webappapis.html ( diff )
/speculative-loading.html ( diff )