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 <nhiroki@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> 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 <domenic@chromium.org> Reviewed-by: Danil Somsikov <dsv@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> 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 <nhiroki@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> 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 <domenic@chromium.org> Reviewed-by: Danil Somsikov <dsv@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> 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 <domenic@chromium.org> Reviewed-by: Danil Somsikov <dsv@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> 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 <nhiroki@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> 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 <domenic@chromium.org> Reviewed-by: Danil Somsikov <dsv@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/main@{#1488633} Co-authored-by: Domenic Denicola <domenic@chromium.org>
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 <nhiroki@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> Cr-Commit-Position: refs/heads/main@{#1488632}
| <p><span>Register speculation rules</span> given <var>global</var>, | ||
| <var>newResult</var>, and true.</p> | ||
|
|
||
| <p class="note" id="note-update-speculation-rules-queue-errors">When updating speculation rules, as opposed to registering them for the first time, we ensure that any <code data-x="event-error">error</code> events are queued as tasks, instead of synchronously fired. Although synchronously executing <code data-x="event-error">error</code> event handlers is OK when inserting <code>script</code> elements, it's best if other modifications do not cause such synchronous script execution.</p> |
There was a problem hiding this comment.
Provided that the synchronous event is fired during post-connection steps, not just insertion steps! Not sure if that's worth a mention, probably not, but I figured I'd just beat the dead horse while I'm here.
|
Alright, I think this is ready to merge! I'll give folks another 24 hours or so to comment before doing so, but am excited to get this merged (as well as the CSP and Fetch PRs). Then I'll move on to working on the prefetch spec port. |
Other spec PRs that should be merged shortly after this one:
This ports the relevant text from https://github.com/WICG/nav-speculation/blob/90ccea636881ab7c9b4aabd04bfa233ef33477ee/speculation-rules.bs, 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 global object 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, uses a separate task source which user agents can deprioritize, and explicitly excludes non-top-level-traversables from caring about the header.
Be explicit about when to consider speculative loads, instead of using vague language about "whenever something relevant changes".
Give an explicit algorithm for how speculative load candidates are grouped and redundant ones coalesced, instead of stating that it must be done somehow.
Add re-parsing of
<script type=speculationrules>on base URL changes, to match the Chromium implementation.Remove the re-parsing of
<script type=speculationrules>on text content changes, to match the Chromium implementation and also match<script type=importmap>.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 )