Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 22 additions & 30 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Level: 1

<pre class=anchors>
spec: ecma262; urlPrefix: https://tc39.github.io/ecma262/
type: dfn
text: time values; url: sec-time-values-and-time-range
type: dfn; text: time values; url: sec-time-values-and-time-range
type: dfn; text: ToString; url: sec-tostring
</pre>

<pre class=link-defaults>
Expand Down Expand Up @@ -490,6 +490,7 @@ dictionary CookieInit {
USVString path = "/";
CookieSameSite sameSite = "strict";
boolean partitioned = false;
long long? maxAge = null;
};

dictionary CookieStoreDeleteOptions {
Expand Down Expand Up @@ -658,8 +659,9 @@ The <dfn method for=CookieStore>set(|name|, |value|)</dfn> method steps are:
null,
null,
"`/`",
"{{CookieSameSite/strict}}", and
false.
"{{CookieSameSite/strict}}",
false, and
null.
1. If |r| is failure, then [=reject=] |p| with a {{TypeError}} and abort these steps.
1. [=/Resolve=] |p| with undefined.
1. Return |p|.
Expand All @@ -682,8 +684,9 @@ The <dfn method for=CookieStore>set(|options|)</dfn> method steps are:
|options|["{{CookieInit/expires}}"],
|options|["{{CookieInit/domain}}"],
|options|["{{CookieInit/path}}"],
|options|["{{CookieInit/sameSite}}"], and
|options|["{{CookieInit/partitioned}}"].
|options|["{{CookieInit/sameSite}}"],
|options|["{{CookieInit/partitioned}}"], and
|options|["{{CookieInit/maxAge}}"].
1. If |r| is failure, then [=reject=] |p| with a {{TypeError}} and abort these steps.
1. [=/Resolve=] |p| with undefined.
1. Return |p|.
Expand Down Expand Up @@ -992,15 +995,6 @@ The <dfn attribute for=ServiceWorkerGlobalScope>cookieStore</dfn> getter steps a
<!-- ============================================================ -->


<div algorithm>
To represent a date and time |dateTime| <dfn>as a timestamp</dfn>,
return the number of milliseconds from 00:00:00 UTC, 1 January 1970 to |dateTime|
(assuming that there are exactly 86,400,000 milliseconds per day).

Note: This is the same representation used for [=time values=] in [[ECMAScript]].
</div>


<div algorithm>
To <dfn>date serialize</dfn> a {{DOMHighResTimeStamp}} |millis|,
let |dateTime| be the date and time |millis| milliseconds after 00:00:00 UTC, 1 January 1970
Expand Down Expand Up @@ -1061,8 +1055,9 @@ To <dfn>set a cookie</dfn> given a [=/URL=] |url|,
{{DOMHighResTimeStamp}}-or-null |expires|,
[=/scalar value string=]-or-null |domain|,
[=/scalar value string=] |path|,
[=/string=] |sameSite|, and
[=/boolean=] |partitioned|:
[=/string=] |sameSite|,
[=/boolean=] |partitioned|, and
[=/64-bit signed integer=]-or-null |maxAge|:

1. [=Normalize=] |name|.
1. [=Normalize=] |value|.
Expand Down Expand Up @@ -1090,7 +1085,10 @@ To <dfn>set a cookie</dfn> given a [=/URL=] |url|,
1. Let |encodedDomain| be the result of [=UTF-8 encode|UTF-8 encoding=] |parsedDomain|.
1. If the [=byte sequence=] [=byte sequence/length=] of |encodedDomain| is greater than the [=cookie/maximum attribute value size=], then return failure.
1. [=list/Append=] (\``Domain`\`, |encodedDomain|) to |attributes|.
1. If |expires| is non-null, then [=list/append=] (\``Expires`\`, |expires| ([=date serialized=])) to |attributes|.
1. If |expires| is non-null:
1. If |maxAge| is non-null, then return failure.
1. [=list/Append=] (\``Expires`\`, |expires| ([=date serialized=])) to |attributes|.
1. Otherwise, if |maxAge| is non-null, then [=list/append=] (\``Max-Age`\`, [=ToString=](|maxAge|)) to |attributes|.
1. If |path| is the empty string, then set |path| to the [=/serialized cookie default path=] of |url|.
1. If |path| does not start with U+002F (/), then return failure.
1. If |path| is not U+002F (/), and |name|, [=byte-lowercased=], [=byte sequence/starts with=] \``__host-`\`, then return failure.
Expand All @@ -1107,7 +1105,7 @@ To <dfn>set a cookie</dfn> given a [=/URL=] |url|,
: "{{CookieSameSite/lax}}"
:: [=list/Append=] (\``SameSite`\`, \``Lax`\`) to |attributes|.
</dl>
1. If |partitioned| is true, [=list/Append=] (``Partitioned`\`, \`\`) to |attributes|.
1. If |partitioned| is true, [=list/Append=] (\``Partitioned`\`, \`\`) to |attributes|.
1. Perform the steps defined in [[RFC6265BIS-14#name-storage-model|Cookies § Storage Model]] for when the user agent "receives a cookie" with
|url| as <var ignore>request-uri</var>,
|encodedName| as <var ignore>cookie-name</var>,
Expand Down Expand Up @@ -1136,26 +1134,20 @@ a [=/URL=] |url|,
[=/scalar value string=] |path|, and
[=/boolean=] |partitioned|:

1. Let |expires| be the earliest representable date represented [=as a timestamp=].

Note: The exact value of |expires| is not important for the purposes of this algorithm,
as long as it is in the past.

1. Let |maxAge| be 0.
1. [=Normalize=] |name|.

1. Let |value| be the empty string.

1. If |name|'s [=string/length=] is 0, then set |value| to any non-empty [=implementation-defined=] string.

1. Return the results of running [=set a cookie=] with
|url|,
|name|,
|value|,
|expires|,
null,
|domain|,
|path|,
"{{CookieSameSite/strict}}", and
|partitioned|.
"{{CookieSameSite/strict}}",
|partitioned|, and
|maxAge|.

</div>

Expand Down