Skip to content

Commit c23dcae

Browse files
committed
Add speculation rules prefetch
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.
1 parent ee567cc commit c23dcae

File tree

1 file changed

+2116
-50
lines changed

1 file changed

+2116
-50
lines changed

0 commit comments

Comments
 (0)