From c94e764562c1980c532336d76738a060de94fb47 Mon Sep 17 00:00:00 2001 From: lola odelola Date: Wed, 19 Jul 2023 14:03:45 +0100 Subject: [PATCH 01/50] add cookie events, command & result references --- index.bs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index e4596cff..77930bfe 100644 --- a/index.bs +++ b/index.bs @@ -1848,7 +1848,10 @@ BrowsingContextCommand = ( browsingContext.Navigate // browsingContext.Print // browsingContext.Reload // - browsingContext.SetViewport + browsingContext.SetViewport // + browsingContext.GetCookie // + browsingContext.SetCookie // + browsingContext.DeleteCookie ) @@ -1860,7 +1863,9 @@ BrowsingContextResult = ( browsingContext.CreateResult // browsingContext.GetTreeResult // browsingContext.NavigateResult // - browsingContext.PrintResult + browsingContext.PrintResult // + browsingContext.GetCookieResult // + browsingContext.SetCookieResult ) BrowsingContextEvent = ( @@ -1874,7 +1879,9 @@ BrowsingContextEvent = ( browsingContext.NavigationAborted // browsingContext.NavigationFailed // browsingContext.UserPromptClosed // - browsingContext.UserPromptOpened + browsingContext.UserPromptOpened // + browsingContext.CookieCreated // + browsingContext.CookieDestroyed ) @@ -3059,6 +3066,11 @@ The [=remote end steps=] with |command parameters| are: +#### The browsingContext.getCookie Command #### {#command-browsingContext-getCookie} + +#### The browsingContext.setCookie Command #### {#command-browsingContext-setCookie} + +#### The browsingContext.deleteCookie Command #### {#command-browsingContext-deleteCookie} ### Events ### {#module-contexts-events} @@ -3542,6 +3554,11 @@ opened steps given |window|, |type| and |message|. +#### The browsingContext.CookieCreated Event #### {#event-browsingContext-cookieCreated} + +#### The browsingContext.CookieDestroyed Event #### {#event-browsingContext-cookieDestroyed} + + ## The network Module ## {#module-network} The network module contains commands and events From e4deba9e599b96491749c787696517bcbb492f35 Mon Sep 17 00:00:00 2001 From: lola odelola Date: Wed, 19 Jul 2023 19:21:33 +0100 Subject: [PATCH 02/50] add command & result definitions -wip --- index.bs | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 77930bfe..8280ca36 100644 --- a/index.bs +++ b/index.bs @@ -1879,9 +1879,7 @@ BrowsingContextEvent = ( browsingContext.NavigationAborted // browsingContext.NavigationFailed // browsingContext.UserPromptClosed // - browsingContext.UserPromptOpened // - browsingContext.CookieCreated // - browsingContext.CookieDestroyed + browsingContext.UserPromptOpened ) @@ -2159,6 +2157,25 @@ browsingContext.ReadinessState = "none" / "interactive" / "complete" The browsingContext.ReadinessState type represents the stage of document loading at which a navigation command will return. +#### The browsingContext.Cookie Type #### {#type-browsingContext-Cookie} + +[=remote end definition=] and [=local end definition=] + +
+browsingContext.Cookie = {
+    name: text;
+    value: text;
+    host: text;
+    partitionKey: text|undefined;
+}
+
+
+ +The browsingContext.Cookie type provides details of a given cookie. + +Issue Confirm if `cookie` type should be consolidated in one place `browsingContext.Cookie` or `Network.Cookie` + + ### Commands ### {#module-browsingContext-commands} #### The browsingContext.activate Command #### {#command-browsingContext-activate} @@ -3068,10 +3085,64 @@ The [=remote end steps=] with |command parameters| are: #### The browsingContext.getCookie Command #### {#command-browsingContext-getCookie} +The browsingContext.getCookie command specific cookie characteristics (e.g. ) on the given top-level browsing context. + +
+
Command Type
+
+
+        browsingContext.GetCookie = {
+
+        }
+    
+
+
Result Type
+
+
+      browsingContext.GetCookieResult = {
+        data: text
+      }
+    
+
+
+ #### The browsingContext.setCookie Command #### {#command-browsingContext-setCookie} +The browsingContext.setCookie command specific cookie characteristics (e.g. ) on the +given top-level browsing context. + +
+
Command Type
+
+
+        browsingContext.SetCookie = {
+
+        }
+    
+
+
Result Type
+
+
+      browsingContext.SetCookieResult = {
+        data: text
+      }
+    
+
+
+ #### The browsingContext.deleteCookie Command #### {#command-browsingContext-deleteCookie} +
+
Command Type
+
+
+        browsingContext.DeleteCookie = {
+
+        }
+    
+
+
+ ### Events ### {#module-contexts-events} #### The browsingContext.contextCreated Event #### {#event-browsingContext-contextCreated} From a4e209135e0a4fd963b69dc5b4c4544c008a4f1a Mon Sep 17 00:00:00 2001 From: lola odelola Date: Wed, 19 Jul 2023 19:23:06 +0100 Subject: [PATCH 03/50] rm ref to events --- index.bs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/index.bs b/index.bs index 8280ca36..d6e3a76e 100644 --- a/index.bs +++ b/index.bs @@ -3625,11 +3625,6 @@ opened steps given |window|, |type| and |message|. -#### The browsingContext.CookieCreated Event #### {#event-browsingContext-cookieCreated} - -#### The browsingContext.CookieDestroyed Event #### {#event-browsingContext-cookieDestroyed} - - ## The network Module ## {#module-network} The network module contains commands and events From 3e95822f5c29db10251377cd0770eacbf96937e2 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 24 Jul 2023 18:08:41 -0400 Subject: [PATCH 04/50] Reorganize into a new module named "Storage" --- index.bs | 203 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 116 insertions(+), 87 deletions(-) diff --git a/index.bs b/index.bs index d6e3a76e..694f80d5 100644 --- a/index.bs +++ b/index.bs @@ -316,7 +316,8 @@ CommandData = ( InputCommand // NetworkCommand // ScriptCommand // - SessionCommand + SessionCommand // + StorageCommand ) EmptyParams = { @@ -354,7 +355,8 @@ ResultData = ( EmptyResult // NetworkResult // ScriptResult // - SessionResult + SessionResult // + StorageResult ) EmptyResult = { @@ -1848,10 +1850,7 @@ BrowsingContextCommand = ( browsingContext.Navigate // browsingContext.Print // browsingContext.Reload // - browsingContext.SetViewport // - browsingContext.GetCookie // - browsingContext.SetCookie // - browsingContext.DeleteCookie + browsingContext.SetViewport ) @@ -1863,9 +1862,7 @@ BrowsingContextResult = ( browsingContext.CreateResult // browsingContext.GetTreeResult // browsingContext.NavigateResult // - browsingContext.PrintResult // - browsingContext.GetCookieResult // - browsingContext.SetCookieResult + browsingContext.PrintResult ) BrowsingContextEvent = ( @@ -2157,25 +2154,6 @@ browsingContext.ReadinessState = "none" / "interactive" / "complete" The browsingContext.ReadinessState type represents the stage of document loading at which a navigation command will return. -#### The browsingContext.Cookie Type #### {#type-browsingContext-Cookie} - -[=remote end definition=] and [=local end definition=] - -
-browsingContext.Cookie = {
-    name: text;
-    value: text;
-    host: text;
-    partitionKey: text|undefined;
-}
-
-
- -The browsingContext.Cookie type provides details of a given cookie. - -Issue Confirm if `cookie` type should be consolidated in one place `browsingContext.Cookie` or `Network.Cookie` - - ### Commands ### {#module-browsingContext-commands} #### The browsingContext.activate Command #### {#command-browsingContext-activate} @@ -3083,65 +3061,6 @@ The [=remote end steps=] with |command parameters| are: -#### The browsingContext.getCookie Command #### {#command-browsingContext-getCookie} - -The browsingContext.getCookie command specific cookie characteristics (e.g. ) on the given top-level browsing context. - -
-
Command Type
-
-
-        browsingContext.GetCookie = {
-
-        }
-    
-
-
Result Type
-
-
-      browsingContext.GetCookieResult = {
-        data: text
-      }
-    
-
-
- -#### The browsingContext.setCookie Command #### {#command-browsingContext-setCookie} - -The browsingContext.setCookie command specific cookie characteristics (e.g. ) on the -given top-level browsing context. - -
-
Command Type
-
-
-        browsingContext.SetCookie = {
-
-        }
-    
-
-
Result Type
-
-
-      browsingContext.SetCookieResult = {
-        data: text
-      }
-    
-
-
- -#### The browsingContext.deleteCookie Command #### {#command-browsingContext-deleteCookie} - -
-
Command Type
-
-
-        browsingContext.DeleteCookie = {
-
-        }
-    
-
-
### Events ### {#module-contexts-events} @@ -7118,6 +7037,116 @@ worker=] algorithm: +## The storage Module ## {#module-storage} + +The storage module contains functionality and +events related to storage. + +### Definition ### {#module-storage-definition} + +[=Local end definition=] + +### Types ### {#module-storage-types} + +#### The storage.Cookie Type #### {#type-storage-Cookie} + +[=Remote end definition=] + +
+StorageCommand = (
+  storage.GetCookie //
+  storage.SetCookie //
+  storage.DeleteCookie
+)
+
+ +[=Local end definition=] + +
+StorageResult = (
+  storage.GetCookieResult //
+  storage.SetCookieResult
+)
+
+ +[=Remote end definition=] and [=Local end definition=] + +
+storage.Cookie = {
+    name: text;
+    value: text;
+    host: text;
+    partitionKey: text|undefined;
+}
+
+ +The storage.Cookie type provides details of a given cookie. + +Issue: Confirm if cookie type should be consolidated in one place storage.Cookie or Network.Cookie. + +### Commands ### {#module-storage-commands} + +#### The storage.getCookie Command #### {#command-storage-getCookie} + +The storage.getCookie command specific cookie characteristics (e.g. ) on the given top-level browsing context. + +
+
Command Type
+
+
+        storage.GetCookie = {
+
+        }
+    
+
+
Result Type
+
+
+      storage.GetCookieResult = {
+        data: text
+      }
+    
+
+
+ +#### The storage.setCookie Command #### {#command-storage-setCookie} + +The storage.setCookie command specific cookie characteristics (e.g. ) on the +given top-level browsing context. + +
+
Command Type
+
+
+        storage.SetCookie = {
+
+        }
+    
+
+
Result Type
+
+
+      storage.SetCookieResult = {
+        data: text
+      }
+    
+
+
+ +#### The storage.deleteCookie Command #### {#command-storage-deleteCookie} + +
+
Command Type
+
+
+        storage.DeleteCookie = {
+
+        }
+    
+
+
+ + ## The log Module ## {#module-log} The log module contains functionality and events From 6008d95e1b0256a00a44c4a560daa4324c0d86c9 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 24 Jul 2023 19:55:36 -0400 Subject: [PATCH 05/50] Add storage partition keys to capabilities --- index.bs | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 694f80d5..8367c7c2 100644 --- a/index.bs +++ b/index.bs @@ -73,7 +73,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ text: no such element; url: dfn-no-such-element text: no such frame; url: dfn-no-such-frame text: parse a page range; url: dfn-parse-a-page-range - text: process capabilities; url: dfn-processing-capabilities + text: process classic capabilities; url: dfn-processing-capabilities text: readiness state; url: dfn-readiness-state text: remote end steps; url: dfn-remote-end-steps text: remote end; url: dfn-remote-ends @@ -1375,6 +1375,40 @@ filter only those that ought to be returned to the local end. +
+ +To process BiDi capabilities given |command parameters| and |flags|: + +1. Let |capabilities| be the result of [=trying=] to [=process classic + capabilities=] with |command parameters| and |flags|. + +1. If |capabilities| is null, return |capabilities|. + +1. [=Assert=]: |capabilities| is an [=Object=]. + +1. Let |keys| be a new [=Object=]. + +1. For each |key| in [=storage partition keys=]: + + 1. Let |schema| be a new [=Object=]. + + 1. If [=default values for storage partition keys=][|key|] exists: + + 1. [=Set a property=] on |schema| named "default" to [=default values for storage partition keys=][|key|]. + + 1. Otherwise: + + 1. [=Set a property=] on |schema| named "required" to true. + + 1. [=Set a property=] on |keys| named |key| to |schema|. + +1. [=Set a property=] on |capabilities| named + "storagePartitionKeys" to |keys|. + +1. Return |capabilities|. + +
+ ### Types ### {#module-session-types} #### The session.CapabilitiesRequest Type #### {#type-session-CapabilitiesRequest} @@ -1524,6 +1558,9 @@ This is a [=static command=]. ? socksVersion: 0..255, }, setWindowRect: bool, + storagePartitionKeys: { + Extensible + }, Extensible } } @@ -1542,7 +1579,7 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. Let |flags| be a [=/set=] containing "bidi". -1. Let |capabilities| be the result of [=trying=] to [=process capabilities=] +1. Let |capabilities| be the result of [=trying=] to [=process BiDi capabilities=] with |command parameters| and |flags|. 1. Let |session| be the result of [=trying=] to [=create a session=] with @@ -7084,6 +7121,10 @@ The storage.Cookie type provides details of a given cookie. Issue: Confirm if cookie type should be consolidated in one place storage.Cookie or Network.Cookie. +A [=remote end=] has a [=/set=] of storage partition keys which contains zero or more implementation-defined string values. + +A [=remote end=] has a [=/map=] of default values for storage partition keys which contains zero or more implementation-defined entries. Each key must be a member of the [=storage partition keys=] which the [=remote end=] does not require as input to [=storage.getCookie=], [=storage.setCookie=], and [=storage.deleteCookie=]; the corresponding value is a the value which the [=remote end=] uses when one is not provided. + ### Commands ### {#module-storage-commands} #### The storage.getCookie Command #### {#command-storage-getCookie} @@ -7135,6 +7176,8 @@ given top-level browsing context. #### The storage.deleteCookie Command #### {#command-storage-deleteCookie} +The storage.deleteCookie command removes the specified cookie. +
Command Type
From d34f4062d7f950630f9d8a1d803a605d7b653dbe Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 24 Jul 2023 20:18:02 -0400 Subject: [PATCH 06/50] Support cookies with multiple partition keys --- index.bs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 8367c7c2..5956b9f3 100644 --- a/index.bs +++ b/index.bs @@ -7113,7 +7113,9 @@ storage.Cookie = { name: text; value: text; host: text; - partitionKey: text|undefined; + ? partitionKey: { + Extensible + }; } From 38d02e412a0b5f9835f855d5b1f9600fa845227a Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 19 Sep 2023 17:39:27 -0400 Subject: [PATCH 07/50] Remove modifications to capabilities processing --- index.bs | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/index.bs b/index.bs index 19c275ff..58edf709 100644 --- a/index.bs +++ b/index.bs @@ -72,7 +72,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ text: no such element; url: dfn-no-such-element text: no such frame; url: dfn-no-such-frame text: parse a page range; url: dfn-parse-a-page-range - text: process classic capabilities; url: dfn-processing-capabilities + text: process capabilities; url: dfn-processing-capabilities text: readiness state; url: dfn-readiness-state text: remote end steps; url: dfn-remote-end-steps text: remote end; url: dfn-remote-ends @@ -1378,40 +1378,6 @@ filter only those that ought to be returned to the local end. -
- -To process BiDi capabilities given |command parameters| and |flags|: - -1. Let |capabilities| be the result of [=trying=] to [=process classic - capabilities=] with |command parameters| and |flags|. - -1. If |capabilities| is null, return |capabilities|. - -1. [=Assert=]: |capabilities| is an [=Object=]. - -1. Let |keys| be a new [=Object=]. - -1. For each |key| in [=storage partition keys=]: - - 1. Let |schema| be a new [=Object=]. - - 1. If [=default values for storage partition keys=][|key|] exists: - - 1. [=Set a property=] on |schema| named "default" to [=default values for storage partition keys=][|key|]. - - 1. Otherwise: - - 1. [=Set a property=] on |schema| named "required" to true. - - 1. [=Set a property=] on |keys| named |key| to |schema|. - -1. [=Set a property=] on |capabilities| named - "storagePartitionKeys" to |keys|. - -1. Return |capabilities|. - -
- ### Types ### {#module-session-types} #### The session.CapabilitiesRequest Type #### {#type-session-CapabilitiesRequest} @@ -1561,9 +1527,6 @@ This is a [=static command=]. ? socksVersion: 0..255, }, setWindowRect: bool, - storagePartitionKeys: { - Extensible - }, Extensible } } @@ -1582,7 +1545,7 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. Let |flags| be a [=/set=] containing "bidi". -1. Let |capabilities| be the result of [=trying=] to [=process BiDi capabilities=] +1. Let |capabilities| be the result of [=trying=] to [=process capabilities=] with |command parameters| and |flags|. 1. Let |session| be the result of [=trying=] to [=create a session=] with From bec7193f8d93c7c1454ff05ab4aca1df8c2a338a Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 19 Sep 2023 22:05:06 -0400 Subject: [PATCH 08/50] Relocate type definitions --- index.bs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 58edf709..87bcee35 100644 --- a/index.bs +++ b/index.bs @@ -8517,12 +8517,6 @@ events related to storage. ### Definition ### {#module-storage-definition} -[=Local end definition=] - -### Types ### {#module-storage-types} - -#### The storage.Cookie Type #### {#type-storage-Cookie} - [=Remote end definition=]
@@ -8542,6 +8536,10 @@ StorageResult = (
 )
 
+### Types ### {#module-storage-types} + +#### The storage.Cookie Type #### {#type-storage-Cookie} + [=Remote end definition=] and [=Local end definition=]

From 73830f8b71e95cc3f40fe97ed0f36f0dc117bb68 Mon Sep 17 00:00:00 2001
From: Mike Pennisi 
Date: Tue, 19 Sep 2023 22:42:55 -0400
Subject: [PATCH 09/50] Implement commands

---
 index.bs | 306 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 279 insertions(+), 27 deletions(-)

diff --git a/index.bs b/index.bs
index 87bcee35..dfba4900 100644
--- a/index.bs
+++ b/index.bs
@@ -37,6 +37,14 @@ spec: RFC6455; urlPrefix: https://tools.ietf.org/html/rfc6455
 spec: RFC8610; urlPrefix: https://tools.ietf.org/html/rfc8610
   type: dfn
     text: match a CDDL specification; url: appendix-C
+spec: RFC6265; urlPrefix: https://httpwg.org/specs/rfc6265.html
+  type: dfn
+    text: Cookie; url: section-5.3
+    text: Cookie store; url: section-5.3
+spec: RFC6265bis; urlPrefix: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-05
+  type: dfn
+    text: Lax; url: section-4.1.2.7
+    text: Strict; url: section-4.1.2.7
 spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
   type: dfn
     text: WebDriver new session algorithm; url: dfn-webdriver-new-session-algorithm
@@ -46,6 +54,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/
     text: additional capability deserialization algorithm; url: dfn-additional-capability-deserialization-algorithm
     text: capability name; url: dfn-capability-name
     text: close the session; url: dfn-close-the-session
+    text: create a cookie; url: dfn-creating-a-cookie
     text: create a session; url: dfn-create-a-session
     text: dispatch actions; url: dfn-dispatch-actions
     text: dispatch tick actions; url: dfn-dispatch-tick-actions
@@ -517,8 +526,14 @@ with the following additional codes:
   
no such script
Tried to remove an unknown [=preload script=]. +
no such storage partition +
Tried to access data in a non-existent storage partition. +
unable to close browser
Tried to close the browser, but failed to do so. + +
unable to set cookie +
Tried to create a cookie, but the user agent rejected it.
@@ -533,9 +548,11 @@ ErrorCode = "invalid argument" /
             "no such node" /
             "no such request" /
             "no such script" /
+            "no such storage partition" /
             "session not created" /
             "unable to capture screen" /
             "unable to close browser" /
+            "unable to set cookie" /
             "unknown command" /
             "unknown error" /
             "unsupported operation"
@@ -4281,7 +4298,7 @@ To get the request data given |request|:
 
   1. If |name| is a [=byte-case-insensitive=] match for "Cookie" then:
 
-    1. For each |cookie| in the user agent's cookie store that are included in
+    1. For each |cookie| in the user agent's [=cookie store=] that are included in
        |request|:
 
        Note: [[COOKIES]] defines some baseline requirements for which cookies in
@@ -8521,9 +8538,9 @@ events related to storage.
 
 
 StorageCommand = (
-  storage.GetCookie //
+  storage.GetCookies //
   storage.SetCookie //
-  storage.DeleteCookie
+  storage.DeleteCookies
 )
 
@@ -8531,72 +8548,234 @@ StorageCommand = (
 StorageResult = (
-  storage.GetCookieResult //
+  storage.GetCookiesResult //
   storage.SetCookieResult
 )
 
### Types ### {#module-storage-types} -#### The storage.Cookie Type #### {#type-storage-Cookie} +#### The storage.PartitionKey Type #### {#type-storage-PartitionKey} [=Remote end definition=] and [=Local end definition=]
-storage.Cookie = {
-    name: text;
-    value: text;
-    host: text;
-    ? partitionKey: {
-        Extensible
-    };
+storage.PartitionKey {
+    ? container: text,
+    ? sourceOrigin: text,
+    Extensible,
 }
 
-The storage.Cookie type provides details of a given cookie. +The storage.PartitionKey type describes namespaces within which the user agent may organize persistent data such as [=cookies=] and local storage. -Issue: Confirm if cookie type should be consolidated in one place storage.Cookie or Network.Cookie. +A [=remote end=] has a [=/set=] of storage partition key attributes which contains zero or more implementation-defined string values. -A [=remote end=] has a [=/set=] of storage partition keys which contains zero or more implementation-defined string values. +A [=remote end=] has a [=/map=] of default values for storage partition key attributes which contains zero or more implementation-defined entries. Each key must be a member of the [=storage partition key attributes=] which the [=remote end=] does not require as input to [=storage.getCookies=], [=storage.setCookie=], and [=storage.deleteCookies=]; the corresponding value is a the value which the [=remote end=] uses when one is not provided. -A [=remote end=] has a [=/map=] of default values for storage partition keys which contains zero or more implementation-defined entries. Each key must be a member of the [=storage partition keys=] which the [=remote end=] does not require as input to [=storage.getCookie=], [=storage.setCookie=], and [=storage.deleteCookie=]; the corresponding value is a the value which the [=remote end=] uses when one is not provided. +
+To expand a storage partition key spec given |partition key spec|: + +1. If |partition key spec| is null: + 1. Let |partition key| be an empty [=/map=]. +1. Otherwise: + 1. Let |partition key| be |partition key spec|. +1. For each |name| → |default value| in the [=default values for storage partition key attributes=]: + 1. If |partition key|[|name|] does not [=map/exist=]: + 1. [=map/Set=] |partition key|[|name|] to |default value|. +1. Return |partition key|. + +
+ +
+To get the cookie store given |storage partition key|: + +1. If a [=cookie store=] exists for |storage partition key|: + 1. Return the matching [=cookie store=]. +1. Return [=error=] with [=error code=] [=no such storage partition=]. + +
+ +

The following table for cookie conversion + defines the cookie concepts relevant to WebDriver BiDi, + how these are referred to in [[COOKIES]], + as well as what keys they map to in a [=serialized cookie=]. + +

For informational purposes, + the table includes a brief non-normative description of the field. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Concept + RFC 6265 Field + JSON Key + Description +
Cookie name + name + "name" + The name of the cookie. +
Cookie value + value + "value" + The cookie value. +
Cookie path + path + "path" + The cookie path. + Defaults to "/" + if omitted when [=storage.setCookie|setting a cookie=]. +
Cookie domain + domain + "domain" + The domain the cookie is visible to. +
Cookie secure only + secure-only-flag + "secure" + Whether the cookie is a secure cookie. + Defaults to false if omitted when [=storage.setCookie|setting a cookie=]. +
Cookie HTTP only + http-only-flag + "httpOnly" + Whether the cookie is an HTTP only cookie. + Defaults to false if omitted when [=storage.setCookie|setting a cookie=]. +
Cookie expiry time + expiry-time + "expires" + When the cookie expires, specified in seconds since + [=Unix Epoch=]. Must not be set if omitted when + [=storage.setCookie|setting a cookie=]. +
Cookie same site + samesite + "sameSite" + Whether the cookie applies to a SameSite policy. + Defaults to None if omitted when [=storage.setCookie|setting a cookie=]. + Can be set to either [=Lax=] or [=Strict=]. +
+ +

+To match cookie given |stored cookie| and |filter|: + +1. For each |name| → |value| in |filter|: + 1. If |name| is "value": + 1. Set |value| to [=deserialize protocol bytes=] with |value|. + 1. Let |field name| be the field name corresponding to the JSON key |name| in + the [=table for cookie conversion=]. + 1. If |stored cookie|[|field name|] does not equal |value|: + 1. Return false. +1. Return true. + +
+ +
+To get matching cookies given |cookie store| and |filter|: + +1. Let |cookies| be a new list. +1. For each |stored cookie| in |cookie store|: + 1. If [=match cookie=] with |stored cookie| and |filter| is true: + 1. Append the result of [=serialize cookie=] given |stored cookie| to |cookies|. +1. Return |cookies|. + +
### Commands ### {#module-storage-commands} -#### The storage.getCookie Command #### {#command-storage-getCookie} +#### The storage.getCookies Command #### {#command-storage-getCookies} -The storage.getCookie command specific cookie characteristics (e.g. ) on the given top-level browsing context. +The storage.getCookies command retrieves zero or more [=cookies=] which [=match cookie|match=] a set of provided parameters.
Command Type
-        storage.GetCookie = {
+        storage.GetCookies = {
+          method: "storage.getCookies",
+          params: storage.GetCookiesParameters
+        }
 
+        storage.CookieFilter = {
+          ? ~ network.Cookie
+        }
+
+        storage.GetCookiesParameters = {
+          cookie: storage.CookieFilter,
+          ? partitionKey: storage.PartitionKey,
         }
     
Result Type
-      storage.GetCookieResult = {
-        data: text
+      storage.GetCookiesResult = {
+        cookies: [*network.Cookie]
       }
     
+
+The [=remote end steps=] with session and |command parameters| are: + +1. Let |filter| be the value of the cookie field of |command parameters|. +1. Let |partition key spec| be the value of the partitionKey field of + |command parameters| if it is present or null if it isn't. +1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. +1. Let |store| be the result of [=trying=] to [=get the cookie store=] with + |partition key|. +1. Let |cookies| be the result of [=get matching cookies=] with |store| and |filter|. +1. Let |body| be a [=/map=] matching the storage.GetCookiesResult production, + with the cookies field set to |cookies|. +1. Return [=success=] with data |body|. + +
+ #### The storage.setCookie Command #### {#command-storage-setCookie} -The storage.setCookie command specific cookie characteristics (e.g. ) on the -given top-level browsing context. +The storage.setCookie command creates a new [=cookie=] in a cookie store, replacing any cookie in that store which matches according to [[COOKIES]].
Command Type
         storage.SetCookie = {
+          method: "storage.setCookie",
+          params: storage.SetCookieParameters,
+        }
+
+        storage.PartialCookie = {
+          name: text,
+          value: network.BytesValue,
+          domain: text,
+          ? ~ network.Cookie
+        }
 
+        storage.SetCookieParameters = {
+          cookie: storage.PartialCookie,
+          ? partitionKey: storage.PartitionKey,
         }
     
@@ -8604,27 +8783,100 @@ given top-level browsing context.
       storage.SetCookieResult = {
-        data: text
+        partitionKey: storage.partitionKey
       }
     
-#### The storage.deleteCookie Command #### {#command-storage-deleteCookie} +
+The [=remote end steps=] with session and |command parameters| are: + +1. Let |cookie spec| be the value of the cookie field of |command parameters|. +1. If |cookie spec|["size"] exists: + 1. Return an [=error=] with [=error code=] [=invalid argument=]. +1. Let |partition key spec| be the value of the partitionKey field of + |command parameters| if it is present or null if it isn't. +1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. +1. Let |store| be the result of [=trying=] to [=get the cookie store=] with + |partition key|. +1. Let |deserialized value| be [=deserialize protocol bytes=] with + |cookie spec|["value"]. +1. [=Create a cookie=] in |store| using [=cookie name=] |cookie spec|["name"], + [=cookie value=] |deserialized value|, [=cookie domain=] + |cookie spec|["domain"], and an attribute-value list of the + following cookie concepts listed in the [=table for cookie conversion=]: + +
+
[=Cookie path=] +

|cookie spec|["path"] if it exists, otherwise "/". -The storage.deleteCookie command removes the specified cookie. +

[=Cookie secure only=] +

|cookie spec|["secure"] if it exists, otherwise false. + +

[=Cookie HTTP only=] +

|cookie spec|["httpOnly"] if it exists, otherwise false. + +

[=Cookie expiry time=] +

|cookie spec|["expires"] if it exists, otherwise leave unset to + indicate that this is a session cookie. + +

[=Cookie same site=] +

|cookie spec|["sameSite"] if it exists, otherwise leave unset to + indicate that no same site policy is defined. +

+ + If this step is aborted without inserting a cookie into the cookie store, return + [=error=] with [=error code=] [=unable to set cookie=]. + +1. Let |body| be a [=/map=] matching the storage.SetCookieResult production, + with the partitionKey field set to |partition key|. +1. Return [=success=] with data |body|. + +
+ +#### The storage.deleteCookies Command #### {#command-storage-deleteCookies} + +The storage.deleteCookies command removes zero or more [=cookies=] which [=match cookie|match=] a set of provided parameters.
Command Type
-        storage.DeleteCookie = {
+        storage.DeleteCookies = {
+          method: "storage.deleteCookies",
+          params: storage.DeleteCookiesParameters,
+        }
 
+        storage.DeleteCookiesParameters = {
+          cookie: storage.CookieFilter,
+          ? partitionKey: storage.PartitionKey,
         }
     
+
Result Type
+
+
+        EmptyResult
+     
+
+
+The [=remote end steps=] with session and |command parameters| are: + +1. Let |filter| be the value of the cookie field of |command parameters|. +1. Let |partition key spec| be the value of the partitionKey field of + |command parameters| if it is present or null if it isn't. +1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. +1. Let |store| be the result of [=trying=] to [=get the cookie store=] with + |partition key|. +1. Let |cookies| be the result of [=get matching cookies=] with |store| and |filter|. +1. For each |cookie| in |cookies|: + 1. Remove |cookie| from |store|. +1. Return [=success=] with data null. + +
## The log Module ## {#module-log} From eb877469b20a41dc1a8c5bb7a0e3744adbc1689c Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Wed, 8 Nov 2023 13:56:54 -0500 Subject: [PATCH 10/50] Reformat according to document convention --- index.bs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/index.bs b/index.bs index dfba4900..d72bc60a 100644 --- a/index.bs +++ b/index.bs @@ -8577,12 +8577,19 @@ A [=remote end=] has a [=/map=] of default values for storage partition key To expand a storage partition key spec given |partition key spec|: 1. If |partition key spec| is null: + 1. Let |partition key| be an empty [=/map=]. + 1. Otherwise: + 1. Let |partition key| be |partition key spec|. + 1. For each |name| → |default value| in the [=default values for storage partition key attributes=]: + 1. If |partition key|[|name|] does not [=map/exist=]: + 1. [=map/Set=] |partition key|[|name|] to |default value|. + 1. Return |partition key|. @@ -8591,7 +8598,9 @@ To expand a storage partition key spec given |partition key spec|: To get the cookie store given |storage partition key|: 1. If a [=cookie store=] exists for |storage partition key|: + 1. Return the matching [=cookie store=]. + 1. Return [=error=] with [=error code=] [=no such storage partition=]. @@ -8681,12 +8690,18 @@ To get the cookie store given |storage partition key|: To match cookie given |stored cookie| and |filter|: 1. For each |name| → |value| in |filter|: + 1. If |name| is "value": + 1. Set |value| to [=deserialize protocol bytes=] with |value|. + 1. Let |field name| be the field name corresponding to the JSON key |name| in the [=table for cookie conversion=]. + 1. If |stored cookie|[|field name|] does not equal |value|: + 1. Return false. + 1. Return true. @@ -8695,9 +8710,13 @@ To match cookie given |stored cookie| and |filter|: To get matching cookies given |cookie store| and |filter|: 1. Let |cookies| be a new list. + 1. For each |stored cookie| in |cookie store|: + 1. If [=match cookie=] with |stored cookie| and |filter| is true: + 1. Append the result of [=serialize cookie=] given |stored cookie| to |cookies|. + 1. Return |cookies|. @@ -8741,14 +8760,20 @@ The storage.getCookies command retrieves zero or The [=remote end steps=] with session and |command parameters| are: 1. Let |filter| be the value of the cookie field of |command parameters|. + 1. Let |partition key spec| be the value of the partitionKey field of |command parameters| if it is present or null if it isn't. + 1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. + 1. Let |store| be the result of [=trying=] to [=get the cookie store=] with |partition key|. + 1. Let |cookies| be the result of [=get matching cookies=] with |store| and |filter|. + 1. Let |body| be a [=/map=] matching the storage.GetCookiesResult production, with the cookies field set to |cookies|. + 1. Return [=success=] with data |body|. @@ -8793,15 +8818,22 @@ The storage.setCookie command creates a new [=coo The [=remote end steps=] with session and |command parameters| are: 1. Let |cookie spec| be the value of the cookie field of |command parameters|. + 1. If |cookie spec|["size"] exists: + 1. Return an [=error=] with [=error code=] [=invalid argument=]. + 1. Let |partition key spec| be the value of the partitionKey field of |command parameters| if it is present or null if it isn't. + 1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. + 1. Let |store| be the result of [=trying=] to [=get the cookie store=] with |partition key|. + 1. Let |deserialized value| be [=deserialize protocol bytes=] with |cookie spec|["value"]. + 1. [=Create a cookie=] in |store| using [=cookie name=] |cookie spec|["name"], [=cookie value=] |deserialized value|, [=cookie domain=] |cookie spec|["domain"], and an attribute-value list of the @@ -8831,6 +8863,7 @@ The [=remote end steps=] with session and |command parameters| 1. Let |body| be a [=/map=] matching the storage.SetCookieResult production, with the partitionKey field set to |partition key|. + 1. Return [=success=] with data |body|. @@ -8866,14 +8899,21 @@ The storage.deleteCookies command removes zero or The [=remote end steps=] with session and |command parameters| are: 1. Let |filter| be the value of the cookie field of |command parameters|. + 1. Let |partition key spec| be the value of the partitionKey field of |command parameters| if it is present or null if it isn't. + 1. Let |partition key| be the result of [=expand a storage partition key spec|expanding=] |partition key spec|. + 1. Let |store| be the result of [=trying=] to [=get the cookie store=] with |partition key|. + 1. Let |cookies| be the result of [=get matching cookies=] with |store| and |filter|. + 1. For each |cookie| in |cookies|: + 1. Remove |cookie| from |store|. + 1. Return [=success=] with data null. From b252fc24fc2bb9c4cf0aaebba3527214bb9b75a5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Wed, 8 Nov 2023 13:58:41 -0500 Subject: [PATCH 11/50] Rename key in PartitionKey type --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index d72bc60a..7e9cf317 100644 --- a/index.bs +++ b/index.bs @@ -8561,7 +8561,7 @@ StorageResult = (
 storage.PartitionKey {
-    ? container: text,
+    ? userContext: text,
     ? sourceOrigin: text,
     Extensible,
 }

From bf0ec230f94db578963da2a202671eb40ed20ad7 Mon Sep 17 00:00:00 2001
From: Mike Pennisi 
Date: Wed, 8 Nov 2023 14:02:45 -0500
Subject: [PATCH 12/50] Duplicate field definitions

---
 index.bs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/index.bs b/index.bs
index 7e9cf317..10d1907b 100644
--- a/index.bs
+++ b/index.bs
@@ -8737,7 +8737,15 @@ The storage.getCookies command retrieves zero or
         }
 
         storage.CookieFilter = {
-          ? ~ network.Cookie
+          ? name: text,
+          ? value: network.BytesValue,
+          ? domain: text,
+          ? path: text,
+          ? size: js-uint,
+          ? httpOnly: bool,
+          ? secure: bool,
+          ? sameSite: "strict" / "lax" / "none",
+          ? expires: js-uint,
         }
 
         storage.GetCookiesParameters = {
@@ -8795,7 +8803,12 @@ The storage.setCookie command creates a new [=coo
           name: text,
           value: network.BytesValue,
           domain: text,
-          ? ~ network.Cookie
+          ? path: text,
+          ? size: js-uint,
+          ? httpOnly: bool,
+          ? secure: bool,
+          ? sameSite: "strict" / "lax" / "none",
+          ? expires: js-uint,
         }
 
         storage.SetCookieParameters = {

From c6ee09ae46ed3cb8dcdd0752b3ee82e5699aa439 Mon Sep 17 00:00:00 2001
From: Mike Pennisi 
Date: Wed, 8 Nov 2023 14:41:04 -0500
Subject: [PATCH 13/50] Add reminder to editors

---
 index.bs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/index.bs b/index.bs
index 10d1907b..46e45f52 100644
--- a/index.bs
+++ b/index.bs
@@ -3944,6 +3944,11 @@ Note: this takes a [=byte sequence=] and returns a network.BytesValue
+
+
 network.Cookie = {
     name: text,
     value: network.BytesValue,
@@ -4463,6 +4468,10 @@ To get the response data given |response|:
 [=Remote end definition=]
 
 
+
 network.SetCookieHeader = {
     name: text,
     value: network.BytesValue,
@@ -8736,6 +8745,10 @@ The storage.getCookies command retrieves zero or
           params: storage.GetCookiesParameters
         }
 
+        
         storage.CookieFilter = {
           ? name: text,
           ? value: network.BytesValue,
@@ -8799,6 +8812,10 @@ The storage.setCookie command creates a new [=coo
           params: storage.SetCookieParameters,
         }
 
+        
         storage.PartialCookie = {
           name: text,
           value: network.BytesValue,

From eca5072325df11f4a480dadf4827cdf598a726ac Mon Sep 17 00:00:00 2001
From: Mike Pennisi 
Date: Wed, 8 Nov 2023 14:46:09 -0500
Subject: [PATCH 14/50] Define type for sameSite value

---
 index.bs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/index.bs b/index.bs
index 46e45f52..d5eee020 100644
--- a/index.bs
+++ b/index.bs
@@ -3945,6 +3945,8 @@ Note: this takes a [=byte sequence=] and returns a network.BytesValue
 
+network.SameSite = "strict" / "lax" / "none"
+