From e630486e02745c8de8ce343e5439e3fa67fcd49d Mon Sep 17 00:00:00 2001 From: Lingqi Chi Date: Mon, 16 Jan 2023 10:42:37 +0000 Subject: [PATCH] update prerender AcceptCH algo --- prerendering.bs | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/prerendering.bs b/prerendering.bs index cee6161..df69852 100644 --- a/prerendering.bs +++ b/prerendering.bs @@ -82,13 +82,14 @@ spec: RFC8941; urlPrefix: https://www.rfc-editor.org/rfc/rfc8941.html spec: client-hints-infrastructure; urlPrefix: https://wicg.github.io/client-hints-infrastructure type: dfn text: Accept-CH cache; url: accept-ch-cache - text: add a new Accept-CH cache entry; url: add-a-new-accept-ch-cache-entry - text: append client hints to request; url: abstract-opdef-append-client-hints-to-request + text: create or override the cached client hints set; url: abstract-opdef-create-or-override-the-cached-client-hints-set text: client hints token; url: client-hints-token-definition text: client hints set; url: client-hints-set - text: update the Client Hints set; url: abstract-opdef-update-the-client-hints-set + text: update the client hints set from cache; url: update-the-client-hints-set-from-cache for: environment settings object text: client hints set; url: environment-settings-object-client-hints-set + for: accept-ch-cache + text: origin; url:accept-ch-cache-origin
@@ -312,7 +313,7 @@ Every {{Document}} has an activation start time, which
 
     1. [=map/For each=] |origin| → |hintSet| in |navigable|'s [=prerendering navigable/prerender-scoped Accept-CH cache=]:
 
-      1. [=Add a new Accept-CH cache entry=] to the [=Accept-CH cache=] with the |origin| and |hintSet|.
+      1. [=map/Set=] [=Accept-CH cache=][|origin|] to |hintSet|.
 
     1. Let |doc| be |navigable|'s [=navigable/active document=].
 
@@ -509,35 +510,29 @@ Each [=prerendering navigable=] has a prerende
 
 This stores which client hints each origin has opted into receiving, until it can be copied to the global [=Accept-CH cache=] when [=prerendering traversable/finalize activation|activation is finalized=].
 
-
- To add a new prerender Accept-CH cache entry given a [=prerendering navigable=] |bc|, an [=origin=] |origin|, and a [=client hints set=] |hintSet|: +
+ Modify the update the client hints set from cache algorithm, by replacing the second step with the following steps. - 1. Let |cache| be |bc|'s [=prerendering navigable/prerender-scoped Accept-CH cache=]. + 1. Let |navigable| be settingsObject’s [=environment settings object/global object=]'s [=Window/navigable=]. - 1. [=map/set=] |cache|[|origin|] to |hintSet|. + 1. Let |originMatchingEntries| be the entries in the [=Accept-CH cache=] whose [=accept-ch-cache/origin=] is + [=same origin=] with |settingsObject|'s [=environment settings object/origin=]. -

This is similar to [=add a new Accept-CH cache entry=]. -

+ 1. If |navigable| is a [=prerendering navigable=], then: + 1. Let |prerenderAcceptClientHintsCache| be |navigable|'s [=prerendering navigable/prerender-scoped Accept-CH cache=]. -
- Modify the append client hints to request algorithm, by prepending the following steps before iterating over the |hintSet|: + 1. Let |origin| be |settingsObject|'s [=environment settings object/origin=]. - 1. Let |navigable| be settingsObject’s [=environment settings object/global object=]'s [=Window/navigable=]. - 1. If |navigable| is a [=prerendering navigable=], then: - 1. Let |origin| be request's [=request/url=]'s [=url/origin=]. - 1. Set |hintSet| to the [=set/union=] of |hintSet| and |navigable|'s [=prerendering navigable/prerender-scoped Accept-CH cache=][|origin|]. + 1. If |prerenderAcceptClientHintsCache|[|origin|] [=map/exists=], then let |originMatchingEntries| be the entries in the |prerenderAcceptClientHintsCache| whose [=origin=] is [=same origin=] with |origin|.
-
- Modify the update the Client Hints set algorithm, by updating the last step. +
+ Modify the create or override the cached client hints set algorithm, by updating the last step. - 1. Let |origin| be response's [=response/url=]'s [=url/origin=]. - 1. Let |hintSet| be settingsObject's [=environment settings object/client hints set=]. 1. Let |navigable| be settingsObject’s [=environment settings object/global object=]'s [=Window/navigable=]. - 1. If |navigable| is a [=prerendering navigable=], [=add a new prerender Accept-CH cache entry=] with |navigable|, |origin| and |hintSet|. - 1. Otherwise, [=add a new Accept-CH cache entry=] with |origin| and |hintSet|. - + 1. If |navigable| is a [=prerendering navigable=], [=map/set=] |navigable|'s [=prerendering navigable/prerender-scoped Accept-CH cache=][|origin|] to |hintSet|. + 1. Otherwise, [=map/set=] [=Accept-CH cache=][|origin|] to |hintSet|.

The \`Supports-Loading-Mode\` HTTP response header