script: initial CookieStore implementation (#37968)

This is a first draft at implementing the required infrastructure for
CookieStore, which requires setting up IPC between script and the
resource thread to allow for async/"in parallel" handling of cookie
changes that have a promise API.

Cookie Store also will need to receive change events when cookies for a
url are changed so the architecture needs to support that.

Expect this PR to be reworked once the architecture becomes more
settled, cookie change events will be implemented in follow up PRs

Testing: WPT tests exist for this API
Part of #37674

---------

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This commit is contained in:
Sebastian C 2025-08-20 20:00:24 -05:00 committed by GitHub
parent a75f3fd09b
commit b869b7eb96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 917 additions and 305 deletions

View file

@ -1,4 +0,0 @@
[cookieStore_delete.sub.https.html]
expected: TIMEOUT
[Async Cookies: cookieStore basic API across origins]
expected: TIMEOUT

View file

@ -1,57 +1,37 @@
[cookieStore_delete_arguments.https.any.html]
[cookieStore.delete with positional name]
expected: FAIL
[cookieStore.delete with name in options]
expected: FAIL
expected: TIMEOUT
[cookieStore.delete domain starts with "."]
expected: FAIL
[cookieStore.delete with domain that is not equal current host]
expected: FAIL
[cookieStore.delete with domain set to the current hostname]
expected: FAIL
[cookieStore.delete with domain set to a subdomain of the current hostname]
expected: FAIL
[cookieStore.delete with domain set to a non-domain-matching suffix of the current hostname]
expected: FAIL
[cookieStore.delete with path set to the current directory]
expected: FAIL
[cookieStore.delete with path set to subdirectory of the current directory]
expected: FAIL
[cookieStore.delete does not append / at the end of path]
expected: FAIL
[cookieStore.delete can delete a cookie set by document.cookie if document is defined]
expected: FAIL
[cookieStore.delete with path that does not start with /]
expected: FAIL
[cookieStore.delete with get result]
expected: FAIL
[cookieStore.delete with positional empty name]
expected: FAIL
expected: TIMEOUT
[cookieStore.delete with empty name in options]
expected: FAIL
expected: NOTRUN
[cookieStore.delete with maximum cookie name size]
expected: FAIL
expected: NOTRUN
[cookieStore.delete with a __Host- prefix should not have a domain]
expected: FAIL
expected: NOTRUN
[cookieStore.delete with whitespace]
expected: FAIL
expected: NOTRUN
[cookieStore_delete_arguments.https.any.serviceworker.html]

View file

@ -2,5 +2,3 @@
expected: ERROR
[cookieStore_delete_basic.https.any.html]
[cookieStore.delete return type is Promise<void>]
expected: FAIL

View file

@ -1,4 +1,4 @@
[cookieStore_event_basic.https.window.html]
expected: ERROR
expected: TIMEOUT
[cookieStore fires change event for cookie set by cookieStore.set()]
expected: FAIL
expected: TIMEOUT

View file

@ -1,7 +1,7 @@
[cookieStore_event_delete.https.window.html]
expected: ERROR
expected: TIMEOUT
[cookieStore fires change event for cookie deleted by cookieStore.delete()]
expected: FAIL
expected: TIMEOUT
[cookieStore does not fire change events for non-existing expired cookies]
expected: NOTRUN

View file

@ -1,4 +1,4 @@
[cookieStore_event_overwrite.https.window.html]
expected: ERROR
expected: TIMEOUT
[cookieStore fires change event for cookie overwritten by cookieStore.set()]
expected: FAIL
expected: TIMEOUT

View file

@ -8,27 +8,6 @@
[cookieStore.getAll with empty options]
expected: FAIL
[cookieStore.getAll with positional name]
expected: FAIL
[cookieStore.getAll with name in options]
expected: FAIL
[cookieStore.getAll with name in both positional arguments and options]
expected: FAIL
[cookieStore.getAll with absolute url in options]
expected: FAIL
[cookieStore.getAll with relative url in options]
expected: FAIL
[cookieStore.getAll with invalid url path in options]
expected: FAIL
[cookieStore.getAll with invalid url host in options]
expected: FAIL
[cookieStore.getAll with absolute url with fragment in options]
expected: FAIL

View file

@ -1,7 +1,4 @@
[cookieStore_getAll_set_basic.https.any.html]
[cookieStore.getAll returns the cookie written by cookieStore.set]
expected: FAIL
[cookieStore_getAll_set_basic.https.any.serviceworker.html]
expected: ERROR

View file

@ -2,33 +2,6 @@
expected: ERROR
[cookieStore_get_arguments.https.any.html]
[cookieStore.get with no arguments returns TypeError]
expected: FAIL
[cookieStore.get with empty options returns TypeError]
expected: FAIL
[cookieStore.get with positional name]
expected: FAIL
[cookieStore.get with name in options]
expected: FAIL
[cookieStore.get with name in both positional arguments and options]
expected: FAIL
[cookieStore.get with absolute url in options]
expected: FAIL
[cookieStore.get with relative url in options]
expected: FAIL
[cookieStore.get with invalid url path in options]
expected: FAIL
[cookieStore.get with invalid url host in options]
expected: FAIL
[cookieStore.get with absolute url with fragment in options]
expected: FAIL

View file

@ -1,7 +1,4 @@
[cookieStore_get_delete_basic.https.any.html]
[cookieStore.get returns null for a cookie deleted by cookieStore.delete]
expected: FAIL
[cookieStore_get_delete_basic.https.any.serviceworker.html]
expected: ERROR

View file

@ -1,13 +1,9 @@
[cookieStore_get_set_across_origins.sub.https.html]
expected: TIMEOUT
[cookieStore.get() sees cookieStore.set() in cross-origin frame]
expected: TIMEOUT
expected: FAIL
[cookieStore.get() in cross-origin frame sees cookieStore.set()]
expected: NOTRUN
[cookieStore.set() in cross-origin does not overwrite the __Host- cookie]
expected: NOTRUN
expected: FAIL
[__Host- cookies set via cookieStore.set() in same-site domains don't overwrite each other]
expected: NOTRUN
expected: FAIL

View file

@ -1,7 +1,4 @@
[cookieStore_get_set_basic.https.any.html]
[cookieStore.get returns the cookie written by cookieStore.set]
expected: FAIL
[cookieStore_get_set_basic.https.any.serviceworker.html]
expected: ERROR

View file

@ -1,3 +0,0 @@
[cookieStore_get_set_creation_url.https.any.html]
[cookieStore.set and cookieStore.get use the creation url]
expected: FAIL

View file

@ -1,7 +0,0 @@
[cookieStore_get_set_creation_url.sub.https.html]
expected: TIMEOUT
[cookieStore.get() option url ignores fragments]
expected: TIMEOUT
[cookieStore.get() option url + pushState()]
expected: NOTRUN

View file

@ -1,11 +1,4 @@
[cookieStore_get_set_ordering.https.any.html]
expected: ERROR
[Set three simple origin session cookies sequentially and ensure they all end up in the cookie jar in order.]
expected: FAIL
[Set three simple origin session cookies in undefined order using Promise.all and ensure they all end up in the cookie jar in any order. ]
expected: NOTRUN
[cookieStore_get_set_ordering.https.any.serviceworker.html]
expected: ERROR

View file

@ -1,3 +0,0 @@
[cookieStore_in_detached_frame.https.html]
[cookieStore on DOMWindow of detached iframe]
expected: FAIL

View file

@ -2,164 +2,159 @@
expected: ERROR
[cookieStore_set_arguments.https.any.html]
[cookieStore.set with positional name and value]
expected: FAIL
[cookieStore.set with name and value in options]
expected: FAIL
expected: TIMEOUT
[cookieStore.set fails with empty name and empty value]
expected: FAIL
expected: TIMEOUT
[cookieStore.set with empty name and an '=' in value]
expected: FAIL
expected: NOTRUN
[cookieStore.set with normal name and an '=' in value]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0000]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0001]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0002]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0003]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0004]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0005]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0006]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0007]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0008]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0010]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0011]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0012]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0013]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0014]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0015]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0016]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0017]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0018]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+0019]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001A]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001B]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001C]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001D]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001E]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+001F]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+003B]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if name or value contain invalid character U+007F]
expected: FAIL
expected: NOTRUN
[cookieStore.set with expires set to a future Date]
expected: FAIL
expected: NOTRUN
[cookieStore.set with expires set to a past Date]
expected: FAIL
expected: NOTRUN
[cookieStore.set with expires set to a future timestamp]
expected: FAIL
expected: NOTRUN
[cookieStore.set with expires set to a past timestamp]
expected: FAIL
expected: NOTRUN
[cookieStore.set domain starts with "."]
expected: FAIL
expected: NOTRUN
[cookieStore.set with domain that is not equal current host]
expected: FAIL
expected: NOTRUN
[cookieStore.set with domain set to the current hostname]
expected: FAIL
expected: NOTRUN
[cookieStore.set with domain set to a subdomain of the current hostname]
expected: FAIL
expected: NOTRUN
[cookieStore.set with domain set to a non-domain-matching suffix of the current hostname]
expected: FAIL
expected: NOTRUN
[cookieStore.set default domain is null and differs from current hostname]
expected: FAIL
expected: NOTRUN
[cookieStore.set with path set to the current directory]
expected: FAIL
expected: NOTRUN
[cookieStore.set with path set to a subdirectory of the current directory]
expected: FAIL
expected: NOTRUN
[cookieStore.set default path is /]
expected: FAIL
expected: NOTRUN
[cookieStore.set does not add / to path that does not end with /]
expected: FAIL
expected: NOTRUN
[cookieStore.set can modify a cookie set by document.cookie if document is defined]
expected: FAIL
expected: NOTRUN
[cookieStore.set with path that does not start with /]
expected: FAIL
expected: NOTRUN
[cookieStore.set with get result]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if the path is too long]
expected: FAIL
expected: NOTRUN
[cookieStore.set checks if the domain is too long]
expected: FAIL
expected: NOTRUN
[cookieStore.set with a __Host- prefix should not have a domain]
expected: FAIL
expected: NOTRUN
[cookieStore.set with whitespace only name and value]
expected: FAIL
expected: NOTRUN
[cookieStore.set with whitespace at begining or end]
expected: FAIL
expected: NOTRUN

View file

@ -1,6 +0,0 @@
[cookieStore_set_domain_parsing.sub.https.html]
[cookieStore.set with domain on a IDNA host]
expected: FAIL
[cookieStore.set with domain set to the current hostname but differently cased]
expected: FAIL

View file

@ -1,3 +0,0 @@
[cookieStore_set_domain_parsing.tentative.sub.https.html]
[cookieStore.set with domain on an IP address host]
expected: FAIL

View file

@ -2,14 +2,12 @@
expected: ERROR
[cookieStore_set_limit.https.any.html]
[Set max-size cookie with largest possible name and value (4096 bytes)]
expected: FAIL
[Set max-size value-less cookie]
expected: FAIL
[Set max-size cookie with largest possible value (4095 bytes)]
expected: FAIL
expected: TIMEOUT
[Set max-size name-less cookie]
expected: FAIL
expected: TIMEOUT
[Ignore name-less cookie with value larger than 4096 bytes]
expected: NOTRUN
[Ignore name-less cookie (without leading =) with value larger than 4096 bytes]
expected: NOTRUN

View file

@ -1,40 +1,5 @@
[cookieStore_special_names.https.any.html]
[cookieStore.set with __Secure- name on secure origin]
expected: FAIL
[cookieStore.set of expired __Secure- cookie name on secure origin]
expected: FAIL
[cookieStore.delete with __Secure- name on secure origin]
expected: FAIL
[cookieStore.set with __secure- name on secure origin]
expected: FAIL
[cookieStore.set of expired __secure- cookie name on secure origin]
expected: FAIL
[cookieStore.delete with __secure- name on secure origin]
expected: FAIL
[cookieStore.set with __Host- name on secure origin]
expected: FAIL
[cookieStore.set of expired __Host- cookie name on secure origin]
expected: FAIL
[cookieStore.delete with __Host- name on secure origin]
expected: FAIL
[cookieStore.set with __host- name on secure origin]
expected: FAIL
[cookieStore.set of expired __host- cookie name on secure origin]
expected: FAIL
[cookieStore.delete with __host- name on secure origin]
expected: FAIL
expected: TIMEOUT
[cookieStore.set with __Host- prefix and a domain option]
expected: FAIL
@ -75,34 +40,34 @@
expected: FAIL
[cookieStore.set a nameless cookie cannot have __Host- prefix]
expected: FAIL
expected: TIMEOUT
[cookieStore.set a nameless cookie cannot have __Secure- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __HostHttp- prefix]
expected: FAIL
[cookieStore.set a nameless cookie cannot have __Host- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have \t__Host- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __Secure- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have \t__Secure- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have \t__Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __HostHttp- prefix]
expected: FAIL
@ -123,13 +88,13 @@
expected: FAIL
[cookieStore.set a nameless cookie cannot have __Host-Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have __Host-Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore.set a nameless cookie cannot have \t__Host-Http- prefix]
expected: FAIL
expected: NOTRUN
[cookieStore_special_names.https.any.serviceworker.html]

View file

@ -1,10 +1,4 @@
[encoding.https.any.html]
[BOM not stripped from name]
expected: FAIL
[BOM not stripped from value]
expected: FAIL
[encoding.https.any.serviceworker.html]
expected: ERROR

View file

@ -1,5 +1,4 @@
[httponly_cookies.https.window.html]
expected: ERROR
[HttpOnly cookies are not observed]
expected: FAIL

View file

@ -5,48 +5,6 @@
[idl_test setup]
expected: FAIL
[CookieStore interface: existence and properties of interface object]
expected: FAIL
[CookieStore interface object length]
expected: FAIL
[CookieStore interface object name]
expected: FAIL
[CookieStore interface: existence and properties of interface prototype object]
expected: FAIL
[CookieStore interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[CookieStore interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[CookieStore interface: operation get(USVString)]
expected: FAIL
[CookieStore interface: operation get(optional CookieStoreGetOptions)]
expected: FAIL
[CookieStore interface: operation getAll(USVString)]
expected: FAIL
[CookieStore interface: operation getAll(optional CookieStoreGetOptions)]
expected: FAIL
[CookieStore interface: operation set(USVString, USVString)]
expected: FAIL
[CookieStore interface: operation set(CookieInit)]
expected: FAIL
[CookieStore interface: operation delete(USVString)]
expected: FAIL
[CookieStore interface: operation delete(CookieStoreDeleteOptions)]
expected: FAIL
[CookieStore interface: attribute onchange]
expected: FAIL
@ -104,9 +62,6 @@
[ServiceWorkerRegistration interface: attribute cookies]
expected: FAIL
[Window interface: attribute cookieStore]
expected: FAIL
[idlharness.https.any.serviceworker.html]
expected: ERROR