You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+18-9Lines changed: 18 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -404,6 +404,13 @@ Per [[RFC6265BIS-14#name-storage-model|Cookies § Storage Model]], a [=cookie=]
404
404
405
405
</div>
406
406
407
+
<div algorithm>
408
+
409
+
To <dfn local-lt=normalize>normalize a cookie name or value</dfn> given a [=/string=] |input|:
410
+
remove all U+0009 TAB and U+0020 SPACE that are at the start or end of |input|.
411
+
412
+
</div>
413
+
407
414
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.
408
415
409
416
A cookie is also subject to certain size limits. Per [[RFC6265BIS-14#name-storage-model|Cookies § Storage Model]]:
1. If |list| is failure, then [=reject=] |p| with a {{TypeError}}.
610
617
1. Otherwise, [=/resolve=] |p| with |list|.
611
618
1. Return |p|.
@@ -781,6 +788,7 @@ The <dfn method for=CookieStoreManager>subscribe(|subscriptions|)</dfn> method s
781
788
1. Let |subscription list| be |registration|'s associated [=cookie change subscription list=].
782
789
1. [=list/For each=] |entry| in |subscriptions|, run these steps:
783
790
1. Let |name| be |entry|["{{CookieStoreGetOptions/name}}"].
791
+
1. [=Normalize=] |name|.
784
792
1. Let |url| be the result of [=basic URL parser|parsing=] |entry|["{{CookieStoreGetOptions/url}}"] with |settings|'s [=environment settings object/API base URL=].
785
793
1. If |url| does not start with |registration|'s [=service worker registration/scope url=],
786
794
then [=reject=] |p| with a {{TypeError}} and abort these steps.
@@ -837,6 +845,7 @@ The <dfn method for=CookieStoreManager>unsubscribe(|subscriptions|)</dfn> method
837
845
1. Let |subscription list| be |registration|'s associated [=cookie change subscription list=].
838
846
1. [=list/For each=] |entry| in |subscriptions|, run these steps:
839
847
1. Let |name| be |entry|["{{CookieStoreGetOptions/name}}"].
848
+
1. [=Normalize=] |name|.
840
849
1. Let |url| be the result of [=basic URL parser|parsing=] |entry|["{{CookieStoreGetOptions/url}}"] with |settings|'s [=environment settings object/API base URL=].
841
850
1. If |url| does not start with |registration|'s [=service worker registration/scope url=],
842
851
then [=reject=] |p| with a {{TypeError}} and abort these steps.
@@ -1006,10 +1015,7 @@ and return a [=byte sequence=] corresponding to the closest `cookie-date` repres
1006
1015
1007
1016
<div algorithm>
1008
1017
1009
-
To <dfn>query cookies</dfn> with
1010
-
|url| and
1011
-
optional |name|,
1012
-
run the following steps:
1018
+
To <dfn>query cookies</dfn> given a [=/URL=] |url| and [=/string=]-or-null |name|:
1013
1019
1014
1020
1. Perform the steps defined in [[RFC6265BIS-14#name-retrieval-model|Cookies § Retrieval Model]] to compute the "cookie-string from a given cookie store"
1015
1021
with |url| as <var ignore>request-uri</var>.
@@ -1020,7 +1026,8 @@ run the following steps:
1020
1026
1. Let |list| be a new [=/list=].
1021
1027
1. [=list/For each=] |cookie| in |cookie-list|, run these steps:
1022
1028
1. Assert: |cookie|'s [=cookie/http-only-flag=] is false.
1023
-
1. If |name| is given, then run these steps:
1029
+
1. If |name| is non-null:
1030
+
1. [=Normalize=] |name|.
1024
1031
1. Let |cookieName| be the result of running [=UTF-8 decode without BOM=] on |cookie|'s [=cookie/name=].
1025
1032
1. If |cookieName| does not equal |name|,
1026
1033
then [=iteration/continue=].
@@ -1059,8 +1066,8 @@ optional |expires|,
1059
1066
|partitioned|
1060
1067
run the following steps:
1061
1068
1062
-
1. Remove all U+0009 TAB and U+0020 SPACE that are at the start or end of |name|.
1063
-
1. Remove all U+0009 TAB and U+0020 SPACE that are at the start or end of |value|.
1069
+
1. [=Normalize=] |name|.
1070
+
1. [=Normalize=] |value|.
1064
1071
1. If |name| or |value| contain U+003B (;), any [=C0 control=] character except U+0009 TAB, or U+007F DELETE, then return failure.
1065
1072
1066
1073
ISSUE(httpwg/http-extensions#1593): Note that it's up for discussion whether these character restrictions should also apply to |expires|, |domain|, |path|, and |sameSite| as well.
@@ -1138,6 +1145,8 @@ run the following steps:
1138
1145
Note: The exact value of |expires| is not important for the purposes of this algorithm,
1139
1146
as long as it is in the past.
1140
1147
1148
+
1. [=Normalize=] |name|.
1149
+
1141
1150
1. Let |value| be the empty string.
1142
1151
1143
1152
1. If |name|'s [=string/length=] is 0, then set |value| to any non-empty [=implementation-defined=] string.
0 commit comments