Skip to content

Commit 1fa286a

Browse files
authored
Update spec for cookie partition keys and partitioned storage keys (#78)
* Specify handling of partitioned cookies in deletion * Add refs for paritioned cookies and domain attribute * Correct partition key matching description * Rename cookie clearing algorithm for clarity * Revert "Rename cookie clearing algorithm for clarity" This reverts commit 045d4bd. * Document host precondition in cookie-clearing algorithm * Handle non-site info in cookie partition keys * Add dfn links for `continue` * Handle partitioned non-cookie storage in deletion * Drop phantom link to storage key top-level site
1 parent d6335ec commit 1fa286a

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

index.bs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ spec: RFC6265; urlPrefix: https://tools.ietf.org/html/rfc6265/
5050
type: dfn
5151
text: cookie store; url: section-5.3
5252
text: domain-match; url: section-5.1.3
53+
text: domain attribute; url: section-5.2.3
5354
spec: RFC7234; urlPrefix: https://tools.ietf.org/html/rfc7234/
5455
type: dfn
5556
text: network cache; url: section-2
57+
spec: PARTITIONED-COOKIES; urlPrefix: https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#
58+
type: dfn
59+
text: partitioned cookie; url: section-2.1
60+
text: partition key; url: section-2.2
5661
</pre>
5762

5863
<section class="non-normative">
@@ -755,8 +760,15 @@ spec. It would be nice to unify these in the future.</p>
755760
To <dfn>clear cookies for host</dfn> given a [=host=] |host|, perform the
756761
following steps:
757762

758-
1. Let |cookieList| be the set of cookies from the [=cookie store=] whose
759-
domain attribute is a [=domain-match=] with |host|.
763+
1. [=Assert=]: |host|'s [=host/registrable domain=] is |host| or null.
764+
1. Let |cookieList| be a set of cookies, initially empty.
765+
1. [=list/For each=] cookie |cookie| in the [=cookie store=]:
766+
1. If |cookie| is not [=partitioned cookie|partitioned=]:
767+
1. If |cookie|'s [=domain attribute=] is a [=domain-match=] with |host|, add |cookie| to |cookieList|; otherwise, [=iteration/continue=].
768+
1. If |cookie| is [=partitioned cookie|partitioned=]:
769+
1. If the top-level [=site=] in |cookie|'s [=partition key=] is [=same site=] with the [=site=] ("http", |host|), add |cookie| to |cookieList|.
770+
1. If the top-level [=site=] in |cookie|'s [=partition key=] is [=same site=] with the [=site=] ("https", |host|), add |cookie| to |cookieList|.
771+
1. Otherwise, [=iteration/continue=].
760772
1. [=list/For each=] |cookie| in |cookieList|:
761773
1. Remove |cookie| from the [=cookie store=].
762774

@@ -772,13 +784,18 @@ the following steps:
772784
1. For each <a spec=storage>storage shed</a> |shed| held by the user agent or a
773785
[=traversable navigable=]:
774786
1. [=map/For each=] |storageKey| -> |storageShelf| of |shed|:
775-
1. If |storageKey|'s <a spec=storage for="storage key">origin</a> is an
776-
[=opaque origin=], then [=iteration/continue=].
777-
1. If |storageKey|'s <a spec=storage for="storage key">origin</a>'s
778-
[=origin/host=] does not equal |host|, then [=iteration/continue=].
787+
1. Let |topLevelSite| be |storageKey|'s top-level site.
788+
1. If |topLevelSite| is an [=opaque origin=], then [=iteration/continue=].
789+
1. If |topLevelSite|'s [=host=] does not equal |host|, then [=iteration/continue=].
779790
1. Delete all data stored in |storageShelf|.
780791
1. [=map/Remove=] |storageKey| from |shed|.
781792

793+
Note: This algorithm is written assuming the implementation of the
794+
[work-in-progress update](https://github.com/whatwg/storage/pull/144) to
795+
the [Storage Standard](https://storage.spec.whatwg.org/) to
796+
<a spec=storage lt="storage key">key</a> storage on both an
797+
<a spec=storage for="storage key">origin</a> and a top-level site.
798+
782799
</div>
783800

784801
<div algorithm>

0 commit comments

Comments
 (0)