Intent to Ship: Document rules, response header, eagerness

183 views
Skip to first unread message

Jeremy Roman

unread,
Nov 15, 2023, 6:33:49 PM11/15/23
to blink-dev

Note: This intent email spans three Chromestatus entries for different sub-features that we experimented with together and would like permission to ship together in M121.


Contact emails

jbr...@chromium.orgadit...@chromium.orgisab...@google.comdom...@chromium.orgmc...@chromium.org

Explainer

https://github.com/WICG/nav-speculation/blob/main/triggers.md

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

Summary

(1) An extension to speculation rules syntax that lets the browser obtain URLs for speculation from link elements in a page. They may include criteria which restrict which of these links can be used.


(2) Adding the eagerness field to the speculation rules will let the developers control how eagerly the browser preloads links in order to balance the performance advantage against resource overhead. This field accepts one of "conservative", "moderate", "eager", or "immediate" strings as the value, and it is applicable to both "prefetch" and "prerender" actions and both "list" or "document" sources. If not explicitly specified, list rules default to "immediate" and document rules default to "conservative".


(3) Currently developers can only specify speculation rules using inline script tags.  The proposed feature provides an alternative through the "Speculation-Rules" header. Its value must be a URL to a text resource with "application/speculationrules+json" MIME type. The resource's rules will be added to the document's rule set.



Blink component

Internals>Preload

TAG review

https://github.com/w3ctag/design-reviews/issues/721

TAG review status

Issues addressed (TAG still has reservations)

Chromium Trial Name

SpeculationRulesPrefetchFuture

Link to origin trial feedback summary

https://docs.google.com/document/d/13cJcoygFD64UcQH-P30dXCLbdD6SXpQwhpOUym64KXw/edit?usp=sharing

Origin Trial documentation link

https://github.com/WICG/nav-speculation/blob/main/chrome-2023q1-experiment-overview.md

WebFeature UseCounter name

SpeculationRulesDocumentRules
SpeculationRulesSelectorMatches
SpeculationRulesHeader
SpeculationRulesExplicitEagerness


Risks



Interoperability and Compatibility

Because authors cannot rely on document rules being evaluated (or preloading generally), applications which use them should function correctly in other browsers and should continue to function correctly were the feature to be deprecated. Of course, ideally other browsers do find it compelling to implement this feature.


Similar reasoning applies to the response header and eagerness field.



Gecko: No signal (https://github.com/mozilla/standards-positions/issues/620)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/54)

Web developers: Positive (https://groups.google.com/a/chromium.org/g/blink-dev/c/L3mpXE1x3Zk/m/VvbMZrcsAQAJ) positive feedback from Akamai and use within Chrome on web.dev

Other signals:

Activation

Some developers might not be immediately aware of which URLs they can prefetch or prerender without side effects; this risk is reduced if they primarily use the feature for same-origin URL patterns they are familiar with.



Security

See https://wicg.github.io/nav-speculation/speculation-rules.html#security-considerations.



WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?



Debuggability

Speculative loading which occurs is visible in the Network panel and the new Preloading panel. Console warnings are logged when several types of issues are encountered.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes (though some capabilities vary per platform)

Is this feature fully tested by web-platform-tests?

Yes

https://wpt.fyi/results/speculation-rules?label=experimental&label=master&aligned Some tests cover behavior which isn't enabled by default (even if experimental web platform features are on).



Flag name on chrome://flags



Finch feature name

SpeculationRulesPrefetchFuture

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1371522
https://bugs.chromium.org/p/chromium/issues/detail?id=1366940

Estimated milestones

Shipping on desktop121
OriginTrial desktop last120
OriginTrial desktop first110
Shipping on Android121
OriginTrial Android last120
OriginTrial Android first110
OriginTrial webView last120
OriginTrial webView first110


Anticipated spec changes

A URLPattern change was made to facilitate this, and document rules will be affected by upstream changes to URLPattern. Similarly, upstream changes to CSS selectors will affect document rules which use selectors to match. Some minor changes to how links are identified may happen in the future. We anticipate most changes to be compatible.


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5112150536749056

Daniel Vogelheim

unread,
Nov 17, 2023, 11:40:44 AM11/17/23
to Jeremy Roman, blink-dev
Hi Jeremy,

On Thu, Nov 16, 2023 at 12:33 AM Jeremy Roman <jbr...@chromium.org> wrote:

(3) Currently developers can only specify speculation rules using inline script tags.  The proposed feature provides an alternative through the "Speculation-Rules" header. Its value must be a URL to a text resource with "application/speculationrules+json" MIME type. The resource's rules will be added to the document's rule set.


Is the URL from the speculation rules header restricted to same-origin resources?

The examples seem to assume so; but I couldn't find any definite statement. The header parsing code reads to me like it would allow arbitrary URLs (cross-origin; or mixed http/https). Is this the intent?

Jeremy Roman

unread,
Nov 17, 2023, 2:12:30 PM11/17/23
to Daniel Vogelheim, blink-dev
It is not restricted to be same-origin. This is similar to how other subresources, like scripts, stylesheets, and images, can be loaded cross-origin. However, if it is cross-origin, the response must be CORS-readable.

Yoav Weiss

unread,
Nov 22, 2023, 11:10:57 AM11/22/23
to Jeremy Roman, blink-dev
On Thu, Nov 16, 2023 at 12:33 AM Jeremy Roman <jbr...@chromium.org> wrote:

Note: This intent email spans three Chromestatus entries for different sub-features that we experimented with together and would like permission to ship together in M121.


Contact emails

jbr...@chromium.orgadit...@chromium.orgisab...@google.comdom...@chromium.orgmc...@chromium.org

Explainer

https://github.com/WICG/nav-speculation/blob/main/triggers.md

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

Summary

(1) An extension to speculation rules syntax that lets the browser obtain URLs for speculation from link elements in a page. They may include criteria which restrict which of these links can be used.


Any specific parts of the explainer/spec that cover this one?
 
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuR13dJ%2BLypC7QmGmwvoGn3%2BhPs77bDa-NFDWTw0bA5WDhsWA%40mail.gmail.com.

Jeremy Roman

unread,
Nov 22, 2023, 2:14:26 PM11/22/23
to Yoav Weiss, blink-dev
On Wed, Nov 22, 2023 at 11:10 AM Yoav Weiss <yoav...@chromium.org> wrote:


On Thu, Nov 16, 2023 at 12:33 AM Jeremy Roman <jbr...@chromium.org> wrote:

Note: This intent email spans three Chromestatus entries for different sub-features that we experimented with together and would like permission to ship together in M121.


Contact emails

jbr...@chromium.orgadit...@chromium.orgisab...@google.comdom...@chromium.orgmc...@chromium.org

Explainer

https://github.com/WICG/nav-speculation/blob/main/triggers.md

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

Summary

(1) An extension to speculation rules syntax that lets the browser obtain URLs for speculation from link elements in a page. They may include criteria which restrict which of these links can be used.


Any specific parts of the explainer/spec that cover this one?

Yoav Weiss

unread,
Nov 23, 2023, 4:11:39 AM11/23/23
to Jeremy Roman, blink-dev
LGTM1

These all seem like useful improvements! :)


On Wed, Nov 22, 2023 at 8:14 PM Jeremy Roman <jbr...@chromium.org> wrote:


On Wed, Nov 22, 2023 at 11:10 AM Yoav Weiss <yoav...@chromium.org> wrote:


On Thu, Nov 16, 2023 at 12:33 AM Jeremy Roman <jbr...@chromium.org> wrote:

Note: This intent email spans three Chromestatus entries for different sub-features that we experimented with together and would like permission to ship together in M121.


Contact emails

jbr...@chromium.orgadit...@chromium.orgisab...@google.comdom...@chromium.orgmc...@chromium.org

Explainer

https://github.com/WICG/nav-speculation/blob/main/triggers.md

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

Summary

(1) An extension to speculation rules syntax that lets the browser obtain URLs for speculation from link elements in a page. They may include criteria which restrict which of these links can be used.


Any specific parts of the explainer/spec that cover this one?

Sure:

That's very useful, thanks!! 

Daniel Bratell

unread,
Nov 29, 2023, 11:55:24 AM11/29/23
to Yoav Weiss, Jeremy Roman, blink-dev

Philip Jägenstedt

unread,
Nov 29, 2023, 11:56:31 AM11/29/23
to Daniel Bratell, Yoav Weiss, Jeremy Roman, blink-dev
Reply all
Reply to author
Forward
0 new messages