Skip to content

Commit f0ff023

Browse files
authored
Reduce CookieListItem to only expose name and value
We never had agreement to expose more than information than document.cookie, so make the standard reflect that. Tests: web-platform-tests/wpt#54129. Fixes #238 and closes #241.
1 parent 6306bc9 commit f0ff023

File tree

1 file changed

+6
-48
lines changed

1 file changed

+6
-48
lines changed

index.bs

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -398,20 +398,13 @@ A <dfn>cookie</dfn> is normatively defined for user agents by [[RFC6265BIS-14#na
398398
Per [[RFC6265BIS-14#name-storage-model|Cookies § Storage Model]], a [=cookie=] has the following fields:
399399
<dfn>name</dfn>,
400400
<dfn>value</dfn>,
401-
<dfn>expiry-time</dfn>,
402401
<dfn>domain</dfn>,
403402
<dfn>path</dfn>,
404-
<dfn>creation-time</dfn>,
405-
<dfn>last-access-time</dfn>,
406-
<dfn>persistent-flag</dfn>,
407-
<dfn>host-only-flag</dfn>,
408-
<dfn>secure-only-flag</dfn>,
409-
<dfn>http-only-flag</dfn>,
410-
<dfn>same-site-flag</dfn>.
403+
<dfn>http-only-flag</dfn>.
411404

412405
</div>
413406

414-
A cookie is <dfn>script-visible</dfn> when it is in-scope and does not have the `HttpOnly` cookie flag. This is more formally enforced in the processing model, which consults [[RFC6265BIS-14#name-retrieval-model|Cookies § Retrieval Model]] at appropriate points.
407+
A cookie is <dfn>script-visible</dfn> when it is in-scope and its [=cookie/http-only-flag=] is unset. This is more formally enforced in the processing model, which consults [[RFC6265BIS-14#name-retrieval-model|Cookies § Retrieval Model]] at appropriate points.
415408

416409
A cookie is also subject to certain size limits. Per [[RFC6265BIS-14#name-storage-model|Cookies § Storage Model]]:
417410
* The combined lengths of the name and value fields must not be greater than 4096 [=bytes=] (the <dfn for=cookie>maximum name/value pair size</dfn>).
@@ -499,12 +492,6 @@ dictionary CookieStoreDeleteOptions {
499492
dictionary CookieListItem {
500493
USVString name;
501494
USVString value;
502-
USVString? domain;
503-
USVString path;
504-
DOMHighResTimeStamp? expires;
505-
boolean secure;
506-
CookieSameSite sameSite;
507-
boolean partitioned;
508495
};
509496

510497
typedef sequence<CookieListItem> CookieList;
@@ -1046,42 +1033,13 @@ run the following steps:
10461033

10471034
<div algorithm>
10481035

1049-
To <dfn>create a {{CookieListItem}}</dfn> from |cookie|, run the following steps.
1036+
To <dfn>create a {{CookieListItem}}</dfn> from a [=/cookie=] |cookie|:
10501037

10511038
1. Let |name| be the result of running [=UTF-8 decode without BOM=] on |cookie|'s [=cookie/name=].
10521039
1. Let |value| be the result of running [=UTF-8 decode without BOM=] on |cookie|'s [=cookie/value=].
1053-
1. Let |domain| be the result of running [=UTF-8 decode without BOM=] on |cookie|'s [=cookie/domain=].
1054-
1. Let |path| be the result of running [=UTF-8 decode without BOM=] on |cookie|'s [=cookie/path=].
1055-
1. Let |expires| be |cookie|'s [=cookie/expiry-time=] ([=as a timestamp=]).
1056-
1. Let |secure| be |cookie|'s [=cookie/secure-only-flag=].
1057-
1. Switch on |cookie|'s [=cookie/same-site-flag=]:
1058-
<dl class=switch>
1059-
: \``None`\`
1060-
:: Let |sameSite| be "{{CookieSameSite/none}}".
1061-
: \``Strict`\`
1062-
:: Let |sameSite| be "{{CookieSameSite/strict}}".
1063-
: \``Lax`\`
1064-
:: Let |sameSite| be "{{CookieSameSite/lax}}".
1065-
</dl>
1066-
1. Let |partitioned| be a boolean indicating that the user agent supports [cookie partitioning](https://github.com/privacycg/CHIPS) and that that |cookie| has a partition key.
1067-
1. Return «[
1068-
"name" → |name|,
1069-
"value" → |value|,
1070-
"domain" → |domain|,
1071-
"path" → |path|,
1072-
"expires" → |expires|,
1073-
"secure" → |secure|,
1074-
"sameSite" → |sameSite|,
1075-
"partitioned" → |partitioned|
1076-
1077-
1078-
Note: The |cookie|'s
1079-
[=cookie/creation-time=],
1080-
[=cookie/last-access-time=],
1081-
[=cookie/persistent-flag=],
1082-
[=cookie/host-only-flag=], and
1083-
[=cookie/http-only-flag=]
1084-
attributes are not exposed to script.
1040+
1. Return «[ "{{CookieListItem/name}}" → |name|, "{{CookieListItem/value}}" → |value| ]».
1041+
1042+
Note: One implementation is known to expose information beyond _name_ and _value_.
10851043

10861044
</div>
10871045

0 commit comments

Comments
 (0)