@@ -47,6 +47,7 @@ urlPrefix: https://html.spec.whatwg.org/multipage/
4747 type: dfn
4848 for: browsing context
4949 text: is popup
50+ text: opener browsing context
5051 text: opener origin at creation
5152urlPrefix: https://privacycg.github.io/nav-tracking-mitigations/
5253 type: dfn
@@ -850,63 +851,57 @@ supported on all {{Window}} objects and <code><{body}></code> elements as attrib
850851 </tbody>
851852</table>
852853
853- <h2 id="sa-heuristics-section">Storage Access Heuristics</h2>
854+ <h2 id="sa-heuristics-section">Cookie Access Heuristics</h2>
854855
855856User agents are blocking third-party cookies by default while avoiding user-facing
856857breakage by removing support for common web patterns, particularly login flows via
857858third-party identity providers. Browsers should follow the established patterns in
858- this specification in order to provide short-term storage access to unbreak these flows.
859+ this specification in order to provide short-term cookie access to unbreak these flows.
860+
861+ <h3 id="sa-heuristics-global-data">Global Data</h3>
862+
863+ A <dfn>site pair</dfn> is a [=tuple=] consisting of a [=site=] <dfn for=site pair>third party site</dfn>
864+ and a [=site=] <dfn for=site pair>first party site</dfn>
865+
866+ The user agent holds a <dfn>heuristic grants map</dfn> which is a [=map=] of [=site pairs=] to
867+ [=moments=] . The [=moment=] represents the expiration timestamp of a cookie access grant
868+ for [=third party site=] on [=first party site=] .
859869
860870<h3 id="sa-heuristics-constants">Constants</h3>
861871
862872The <dfn>popup heuristic grant duration</dfn> is an [=implementation-defined=]
863873[=duration=] that represents the length of time after the popup heuristic is
864- triggered that a user agent will store the corresponding [= popup heuristic grant=]
874+ triggered that a user agent will store the corresponding popup heuristic grant
865875in its [=heuristic grants map=] .
866876
867877Note: Most implementations use 30 days as the [=popup heuristic grant duration=] .
868878
869879The <dfn>redirect heuristic grant duration</dfn> is an [=implementation-defined=]
870880[=duration=] that represents the length of time after the redirect heuristic is
871- triggered that a user agent will store the corresponding [= redirect heuristic grant=]
881+ triggered that a user agent will store the corresponding redirect heuristic grant
872882in its [=heuristic grants map=] .
873883
874884Note: Most implementations use 15 minutes as the [=redirect heuristic grant duration=] .
875885
876- <h3 id="sa-heuristics-grant">Storage Access Grant</h3>
877-
878- Define a [=powerful feature=] identified by the [=powerful feature/name=]
879- "storage-access-heuristics", with the following <dfn>permission key type</dfn> :
880-
881- A [=permission key=] of the "storage-access-heuristics" feature is a [=tuple=] consisting
882- of a [=host=] <dfn property>top-level</dfn> and a [=host=] <dfn property>requester</dfn> .
886+ <h3 id="sa-heuristics-access-grant">Cookie Access Grant</h3>
883887
884888<div algorithm>
885889
886- To <dfn>grant access for heuristics</dfn> given a [=host=] |host|, [=host=]
887- |firstPartyHost|, and [=duration=] |duration|, perform the following steps:
888-
889- 1. Let |key| be a [=permission key=] with <var ignore> top-level</var> set to |firstPartyHost|
890- and <var ignore> requester</var> set to |host|.
891- 1. Queue a task on the [=current settings object=] 's [=responsible event loop=] to:
892- 1. [=Set a permission store entry=] with:
893- <dl>
894- <dt><var ignore> descriptor</var></dt>
895- <dd> "storage-access-heuristics"</dd>
896- <dt><var ignore> key</var></dt>
897- <dd> |key|</dd>
898- <dt><var ignore> current state</var></dt>
899- <dd> "granted"</dd>
900- </dl>
901- 2. Set the new permission's [=permission/lifetime=] to |duration|.
902-
903- <div class=note>
904- This algorithm is based on [=request permission to use=] , except for the following key differences:
905- - It sets a dynamic permission [=permission/lifetime=] .
906- - It generates a [=permission key=] independently of the [=current settings object=] .</div>
890+ To <dfn>grant access for heuristics</dfn> given a [=site=] |site|, [=site=]
891+ |firstPartySite|, [=moment=] |currentWallTime|, and [=duration=] |duration|,
892+ perform the following steps:
893+
894+ 1. Let |key| be a [=site pair=] with [=third party site=] set to |site| and
895+ [=first party site=] set to |firstPartySite|.
896+ 1. Let |expirationTime| be |duration| after |currentWallTime|.
897+ 1. Set [=heuristic grants map=] [|key|] to |expirationTime|.
907898
908899</div>
909900
901+ <h3 id="sa-heuristics-access">Cookie Access Monkey Patch</h3>
902+
903+ Issue: TODO: add monkey patch to network fetch cookie access that reads from [=heuristic grants map=] .
904+
910905<h3 id="sa-heuristics-popup">Popup Heuristic</h3>
911906
912907Append the following steps to the [[!HTML]] 's <a spec="html">activation notification</a> algorithm:
@@ -924,24 +919,23 @@ perform the following steps:
924919
9259201. Let |browsingContext| be |document|'s [=Document/browsing context=] .
9269211. If |browsingContext|'s [=browsing context/is popup=] is false, then return.
922+ 1. If |browsingContext|'s [=browsing context/opener browsing context=] is null, then return.
9279231. If |browsingContext|'s [=browsing context/opener origin at creation=] is null, then return.
924+ 1. Let |firstPartySite| be the result of running [=obtain a site=] given the |browsingContext|'s
925+ [=browsing context/opener origin at creation=] .
9289261. Let |navigable| be |document|'s [=node navigable=] .
9299271. If |navigable| is null, then return.
9309281. Let |topDocument| be |navigable|'s [=navigable/top-level traversable=]' s
931929 [=navigable/active document=] .
9329301. Let |origin| be |topDocument|'s [=Document/origin=] .
9339311. If |origin| is an [=opaque origin=] then return.
9349321. Let |site| be the result of running [=obtain a site=] given |origin|.
935- 1. Let |host| be |site|'s [=host=] .
936- 1. [=Grant access for heuristics=] given:
937- <dl>
938- <dt><var ignore> host</var></dt>
939- <dd> |host|</dd>
940- <dt><var ignore> firstPartyHost</var></dt>
941- <dd> |browsingContext|'s <var ignore> opener origin at creation=</var></dd>
942- <dt><var ignore> duration</var></dt>
943- <dd> [=popup heuristic grant duration=] </dd>
944- </dl>
933+ 1. Let |currentWallTime| be |topDocument|'s [=relevant settings object=]' s
934+ [=environment settings object/current wall time=] .
935+ 1. [=Grant access for heuristics=] given |site|, |firstPartySite|, |currentWallTime|, and
936+ [=popup heuristic grant duration=] .
937+
938+ Issue(amaliev/3pcd-exemption-heuristics#3): TODO: Consider whether to check for third-party iframe initiators.
945939
946940</div>
947941
@@ -966,23 +960,17 @@ steps:
9669601. Let |firstPartyOrigin| be |topDocument|'s [=Document/origin=] .
9679611. If |firstPartyOrigin| is an [=opaque origin=] then return.
9689621. Let |firstPartySite| be the result of running [=obtain a site=] given |firstPartyOrigin|.
969- 1. Let |firstPartyHost | be |firstPartySite |'s [=host=] .
970- 1. Let |bounceTrackingRecord| be |navigable| 's [=navigable/top-level traversable=]' s [=top-level traversable/bounce tracking record=] .
963+ 1. Let |bounceTrackingRecord | be |navigable |'s [=navigable/top-level traversable=]' s
964+ [=top-level traversable/bounce tracking record=] .
9719651. [=list/For each=] |bounceUrl| in |bounceTrackingRecord|'s [=bounce tracking record/bounce set=] :
972- 1. Let |bounceSite| be the result of running [=obtain a site=] given |bounceUrl|.
973- 1. Let |bounceHost| be |bounceSite|'s [=host=] .
974- 1. If |bounceHost| [=host/equals=] |firstPartyHost|, [=iteration/continue=] .
975- <!-- TODO: check if |bounceUrl| has a transient activation. This will require patching bounce tracking record. -->
976- <!-- TODO: check A-B-A user flow. This will require traversing the navigable's history. -->
977- 1. [=Grant access for heuristics=] given:
978- <dl>
979- <dt><var ignore> host</var></dt>
980- <dd> |bounceHost|</dd>
981- <dt><var ignore> firstPartyHost</var></dt>
982- <dd> |firstPartyHost|<dd>
983- <dt><var ignore> duration</var></dt>
984- <dd> [=redirect heuristic grant duration=] </dd>
985- </dl>
966+ 1. Let |site| be the result of running [=obtain a site=] given |bounceUrl|.
967+ 1. If |site| is [=site/same site=] to |firstPartySite|, [=iteration/continue=] .
968+ <!-- TODO: check if |bounceUrl| has a transient activation. This will require patching bounce tracking record. -->
969+ <!-- TODO: check A-B-A user flow. This will require traversing the navigable's history. -->
970+ 1. Let |currentWallTime| be |topDocument|'s [=relevant settings object=]' s
971+ [=environment settings object/current wall time=] .
972+ 1. [=Grant access for heuristics=] given |site|, |firstPartySite|, |currentWallTime|, and
973+ [=redirect heuristic grant duration=] .
986974
987975</div>
988976
0 commit comments