Truly independent web browser
Tests: Import Cookie Store WPT tests
Shannon Booth866c2175f735
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex a03ad898473..10d5d973439 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1303,6 +1303,7 @@ Text/input/SiteIsolation/iframe/beforeunload-consulted-in-remote-iframe-on-navigText/input/SiteIsolation/iframe/beforeunload-consulted-in-remote-iframe-on-back.htmlText/input/shared-worker-is-not-shared-across-top-level-sites.htmlText/input/wpt-import/cookies/samesite/+Text/input/wpt-import/cookiestore/[CapFrameRate]; Ends a smooth scroll once 20 frames see no change, which frames faster than the compositor's ticks dodiff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.txtnew file mode 100644index 00000000000..65f4febb4a8--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass CookieStore setting already-expired cookie should not be observed+Pass CookieStore setting already-expired partitioned cookie should not be observed\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.txtnew file mode 100644index 00000000000..6cb946b8526--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.txt@@ -0,0 +1,10 @@+Harness status: OK++Found 5 tests++5 Pass+Pass CookieStore change of expires only should be observed+Pass CookieStore change of sameSite only should be observed+Pass document.cookie change of Secure only should be observed+Pass CookieStore change from no expires to expires should be observed+Pass CookieStore change from expires to no expires should be observed\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.txtnew file mode 100644index 00000000000..ed3198e81c9--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 6 tests++6 Pass+Pass document.cookie set/overwrite/delete observed by CookieStore+Pass document.cookie set already-expired cookie should not be observed by CookieStore+Pass document.cookie duplicate cookie should not be observed by CookieStore+Pass CookieStore set/overwrite/delete observed by document.cookie+Pass CookieStore agrees with document.cookie on encoding non-ASCII cookies+Pass document.cookie agrees with CookieStore on encoding non-ASCII cookies\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.txtnew file mode 100644index 00000000000..45f6f9e00b0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.txt@@ -0,0 +1,12 @@+Harness status: OK++Found 7 tests++7 Pass+Pass HTTP set/overwrite/delete observed in CookieStore+Pass HTTP set already-expired cookie should not be observed by CookieStore+Pass HTTP duplicate cookie should not be observed by CookieStore+Pass CookieStore agreed with HTTP headers agree on encoding non-ASCII cookies+Pass CookieStore set/overwrite/delete observed in HTTP headers+Pass HTTP headers agreed with CookieStore on encoding non-ASCII cookies+Pass Binary HTTP set/overwrite/delete observed in CookieStore\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.txtnew file mode 100644index 00000000000..e96d8a4232f--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass CookieStore duplicate cookie should not be observed+Pass CookieStore duplicate partitioned cookie should not be observed\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.txtnew file mode 100644index 00000000000..e2b11c34881--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass Verify behavior of no-name and no-value cookies.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.txtnew file mode 100644index 00000000000..202900983c5--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass Verify that attempting to set a cookie with no name and with '=' in the value does not work.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.txtnew file mode 100644index 00000000000..7d99b3efdf1--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass Verify behavior of multiple no-name cookies\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.txtnew file mode 100644index 00000000000..91859d4b517--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.txt@@ -0,0 +1,23 @@+Harness status: OK++Found 18 tests++18 Pass+Pass cookieStore.delete with positional name+Pass cookieStore.delete with name in options+Pass cookieStore.delete domain starts with "."+Pass cookieStore.delete with domain that is not equal current host+Pass cookieStore.delete with domain set to the current hostname+Pass cookieStore.delete with domain set to a subdomain of the current hostname+Pass cookieStore.delete with domain set to a non-domain-matching suffix of the current hostname+Pass cookieStore.delete with path set to the current directory+Pass cookieStore.delete with path set to subdirectory of the current directory+Pass cookieStore.delete does not append / at the end of path+Pass cookieStore.delete can delete a cookie set by document.cookie if document is defined+Pass cookieStore.delete with path that does not start with /+Pass cookieStore.delete with get result+Pass cookieStore.delete with positional empty name+Pass cookieStore.delete with empty name in options+Pass cookieStore.delete with maximum cookie name size+Pass cookieStore.delete with a __Host- prefix should not have a domain+Pass cookieStore.delete with whitespace\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_basic.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_basic.https.any.txtnew file mode 100644index 00000000000..df7fbd6af74--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_delete_basic.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.delete return type is Promise<void>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_arguments.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_arguments.https.window.txtnew file mode 100644index 00000000000..072691d5e38--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_arguments.https.window.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass CookieChangeEvent construction with default arguments+Pass CookieChangeEvent construction with changed cookie list+Pass CookieChangeEvent construction with deleted cookie list+Pass CookieChangeEvent construction with changed and deleted cookie lists\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_basic.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_basic.https.window.txtnew file mode 100644index 00000000000..84733a3d2d1--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_basic.https.window.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore fires change event for cookie set by cookieStore.set()\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_delete.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_delete.https.window.txtnew file mode 100644index 00000000000..b6a12fd97ac--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_delete.https.window.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass cookieStore fires change event for cookie deleted by cookieStore.delete()+Pass cookieStore does not fire change events for non-existing expired cookies\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.txtnew file mode 100644index 00000000000..00871dea1f6--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore fires change event for cookie overwritten by cookieStore.set()\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.txtnew file mode 100644index 00000000000..ff83cb5ab3d--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.txt@@ -0,0 +1,17 @@+Harness status: OK++Found 12 tests++12 Pass+Pass cookieStore.getAll with no arguments+Pass cookieStore.getAll with empty options+Pass cookieStore.getAll with positional name+Pass cookieStore.getAll with name in options+Pass cookieStore.getAll with name in both positional arguments and options+Pass cookieStore.getAll with absolute url in options+Pass cookieStore.getAll with relative url in options+Pass cookieStore.getAll with invalid url path in options+Pass cookieStore.getAll with invalid url host in options+Pass cookieStore.getAll with absolute url with fragment in options+Pass cookieStore.getAll with absolute different url in options+Pass cookieStore.getAll with whitespace\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.txtnew file mode 100644index 00000000000..d4260a2f7e5--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.getAll returns multiple cookies written by cookieStore.set\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.txtnew file mode 100644index 00000000000..9761d32a9c8--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.getAll returns the cookie written by cookieStore.set\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.txtnew file mode 100644index 00000000000..7628dcb743b--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.set and cookieStore.getAll use the creation url\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_arguments.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_arguments.https.any.txtnew file mode 100644index 00000000000..29e2c19d630--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_arguments.https.any.txt@@ -0,0 +1,17 @@+Harness status: OK++Found 12 tests++12 Pass+Pass cookieStore.get with no arguments returns TypeError+Pass cookieStore.get with empty options returns TypeError+Pass cookieStore.get with positional name+Pass cookieStore.get with name in options+Pass cookieStore.get with name in both positional arguments and options+Pass cookieStore.get with absolute url in options+Pass cookieStore.get with relative url in options+Pass cookieStore.get with invalid url path in options+Pass cookieStore.get with invalid url host in options+Pass cookieStore.get with absolute url with fragment in options+Pass cookieStore.get with absolute different url in options+Pass cookieStore.get with whitespace\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.txtnew file mode 100644index 00000000000..3def014f421--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.get returns null for a cookie deleted by cookieStore.delete\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.txtnew file mode 100644index 00000000000..c181f900957--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Fail+Fail cookieStore.get() sees cookieStore.set() in frame+Fail cookieStore.get() in frame sees cookieStore.set()\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.txtnew file mode 100644index 00000000000..e61c3a60716--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.get returns the cookie written by cookieStore.set\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.txtnew file mode 100644index 00000000000..884ba00e504--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore.set and cookieStore.get use the creation url\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.txtnew file mode 100644index 00000000000..9481e7bd454--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass Set three simple origin session cookies sequentially and ensure they all end up in the cookie jar in order.+Pass 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.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_in_detached_frame.https.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_in_detached_frame.https.txtnew file mode 100644index 00000000000..82aa930fa51--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_in_detached_frame.https.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass cookieStore on DOMWindow of detached iframe\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_opaque_origin.https.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_opaque_origin.https.txtnew file mode 100644index 00000000000..7cd2ba309cb--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_opaque_origin.https.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 3 tests++3 Pass+Pass cookieStore in non-sandboxed iframe should not throw+Pass cookieStore in sandboxed iframe should throw SecurityError+Pass cookieStore in sandboxed iframe --- listener access\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_arguments.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_arguments.https.any.txtnew file mode 100644index 00000000000..277a286a2bb--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_arguments.https.any.txt@@ -0,0 +1,59 @@+Harness status: OK++Found 54 tests++54 Pass+Pass cookieStore.set with positional name and value+Pass cookieStore.set with name and value in options+Pass cookieStore.set fails with empty name and empty value+Pass cookieStore.set with empty name and an '=' in value+Pass cookieStore.set with normal name and an '=' in value+Pass cookieStore.set checks if name or value contain invalid character U+0000+Pass cookieStore.set checks if name or value contain invalid character U+0001+Pass cookieStore.set checks if name or value contain invalid character U+0002+Pass cookieStore.set checks if name or value contain invalid character U+0003+Pass cookieStore.set checks if name or value contain invalid character U+0004+Pass cookieStore.set checks if name or value contain invalid character U+0005+Pass cookieStore.set checks if name or value contain invalid character U+0006+Pass cookieStore.set checks if name or value contain invalid character U+0007+Pass cookieStore.set checks if name or value contain invalid character U+0008+Pass cookieStore.set checks if name or value contain invalid character U+0010+Pass cookieStore.set checks if name or value contain invalid character U+0011+Pass cookieStore.set checks if name or value contain invalid character U+0012+Pass cookieStore.set checks if name or value contain invalid character U+0013+Pass cookieStore.set checks if name or value contain invalid character U+0014+Pass cookieStore.set checks if name or value contain invalid character U+0015+Pass cookieStore.set checks if name or value contain invalid character U+0016+Pass cookieStore.set checks if name or value contain invalid character U+0017+Pass cookieStore.set checks if name or value contain invalid character U+0018+Pass cookieStore.set checks if name or value contain invalid character U+0019+Pass cookieStore.set checks if name or value contain invalid character U+001A+Pass cookieStore.set checks if name or value contain invalid character U+001B+Pass cookieStore.set checks if name or value contain invalid character U+001C+Pass cookieStore.set checks if name or value contain invalid character U+001D+Pass cookieStore.set checks if name or value contain invalid character U+001E+Pass cookieStore.set checks if name or value contain invalid character U+001F+Pass cookieStore.set checks if name or value contain invalid character U+003B+Pass cookieStore.set checks if name or value contain invalid character U+007F+Pass cookieStore.set with expires set to a future Date+Pass cookieStore.set with expires set to a past Date+Pass cookieStore.set with expires set to a future timestamp+Pass cookieStore.set with expires set to a past timestamp+Pass cookieStore.set domain starts with "."+Pass cookieStore.set with domain that is not equal current host+Pass cookieStore.set with domain set to the current hostname+Pass cookieStore.set with domain set to a subdomain of the current hostname+Pass cookieStore.set with domain set to a non-domain-matching suffix of the current hostname+Pass cookieStore.set default domain is null and differs from current hostname+Pass cookieStore.set with path set to the current directory+Pass cookieStore.set with path set to a subdirectory of the current directory+Pass cookieStore.set default path is /+Pass cookieStore.set does not add / to path that does not end with /+Pass cookieStore.set can modify a cookie set by document.cookie if document is defined+Pass cookieStore.set with path that does not start with /+Pass cookieStore.set with get result+Pass cookieStore.set checks if the path is too long+Pass cookieStore.set checks if the domain is too long+Pass cookieStore.set with a __Host- prefix should not have a domain+Pass cookieStore.set with whitespace only name and value+Pass cookieStore.set with whitespace at begining or end\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_limit.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_limit.https.any.txtnew file mode 100644index 00000000000..3902e4e7c17--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_limit.https.any.txt@@ -0,0 +1,15 @@+Harness status: OK++Found 10 tests++10 Pass+Pass Set max-size cookie with largest possible name and value (4096 bytes)+Pass Ignore cookie with name larger than 4096 and 1 byte value+Pass Set max-size value-less cookie+Pass Ignore value-less cookie with name larger than 4096 bytes+Pass Set max-size cookie with largest possible value (4095 bytes)+Pass Ignore named cookie (with non-zero length) and value larger than 4095 bytes+Pass Ignore named cookie with length larger than 4095 bytes, and a non-zero value+Pass Set max-size name-less cookie+Pass Ignore name-less cookie with value larger than 4096 bytes+Pass Ignore name-less cookie (without leading =) with value larger than 4096 bytes\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.txtnew file mode 100644index 00000000000..71b57395e6d--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.txt@@ -0,0 +1,10 @@+Harness status: OK++Found 4 tests++1 Pass+3 Fail+Pass cookieStore.set with maxAge set to a positive value+Fail cookieStore.set with maxAge set to a negative value+Fail cookieStore.set with maxAge set to zero, cookie change event not dispatched+Fail cookieStore.set fails with both maxAge and expires\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_special_names.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_special_names.https.any.txtnew file mode 100644index 00000000000..7da21a71a72--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/cookieStore_special_names.https.any.txt@@ -0,0 +1,42 @@+Harness status: OK++Found 37 tests++37 Pass+Pass cookieStore.set with __Secure- name on secure origin+Pass cookieStore.set of expired __Secure- cookie name on secure origin+Pass cookieStore.delete with __Secure- name on secure origin+Pass cookieStore.set with __secure- name on secure origin+Pass cookieStore.set of expired __secure- cookie name on secure origin+Pass cookieStore.delete with __secure- name on secure origin+Pass cookieStore.set with __Host- name on secure origin+Pass cookieStore.set of expired __Host- cookie name on secure origin+Pass cookieStore.delete with __Host- name on secure origin+Pass cookieStore.set with __host- name on secure origin+Pass cookieStore.set of expired __host- cookie name on secure origin+Pass cookieStore.delete with __host- name on secure origin+Pass cookieStore.set with __Host- prefix and a domain option+Pass cookieStore.set with __Host- prefix a path option+Pass cookieStore.set with __host- prefix and a domain option+Pass cookieStore.set with __host- prefix a path option+Pass cookieStore.set with __Host-Http- prefix rejects+Pass cookieStore.set with __host-http- prefix rejects+Pass cookieStore.set with __Http- prefix rejects+Pass cookieStore.set with __http- prefix rejects+Pass cookieStore.set with __Http- prefix rejects+Pass cookieStore.set with __Http- prefix rejects+Pass cookieStore.set with __Host-Http- prefix rejects+Pass cookieStore.set with __Host-Http- prefix rejects+Pass cookieStore.set with malformed name.+Pass cookieStore.set a nameless cookie cannot have __Host- prefix+Pass cookieStore.set a nameless cookie cannot have __Secure- prefix+Pass cookieStore.set a nameless cookie cannot have __Http- prefix+Pass cookieStore.set a nameless cookie cannot have __Host-Http- prefix+Pass cookieStore.set a nameless cookie cannot have __Host- prefix+Pass cookieStore.set a nameless cookie cannot have __Host- prefix+Pass cookieStore.set a nameless cookie cannot have __Secure- prefix+Pass cookieStore.set a nameless cookie cannot have __Secure- prefix+Pass cookieStore.set a nameless cookie cannot have __Http- prefix+Pass cookieStore.set a nameless cookie cannot have __Http- prefix+Pass cookieStore.set a nameless cookie cannot have __Host-Http- prefix+Pass cookieStore.set a nameless cookie cannot have __Host-Http- prefix\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/encoding.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/encoding.https.any.txtnew file mode 100644index 00000000000..c51c424bd29--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/encoding.https.any.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Pass+Pass BOM not stripped from name+Pass BOM not stripped from value\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/httponly_cookies.https.window.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/httponly_cookies.https.window.txtnew file mode 100644index 00000000000..3756a185dfe--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/httponly_cookies.https.window.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass HttpOnly cookies are not observed+Pass HttpOnly cookies can not be set by document.cookie+Pass HttpOnly cookies can not be set by CookieStore+Pass HttpOnly cookies are not deleted/overwritten\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/cookiestore/idlharness.https.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/idlharness.https.any.worker.txtnew file mode 100644index 00000000000..d8adf5f5e9c--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/cookiestore/idlharness.https.any.worker.txt@@ -0,0 +1,27 @@+Harness status: OK++Found 22 tests++22 Pass+Pass idl_test setup+Pass idl_test validation+Pass Partial interface ServiceWorkerRegistration: original interface defined+Pass Partial interface ServiceWorkerRegistration: valid exposure set+Pass Partial interface ServiceWorkerRegistration: member names are unique+Pass Partial interface Window: original interface defined+Pass Partial interface Window: member names are unique+Pass Partial interface ServiceWorkerGlobalScope: original interface defined+Pass Partial interface ServiceWorkerGlobalScope: member names are unique+Pass Partial interface Window[2]: member names are unique+Pass Window includes GlobalEventHandlers: member names are unique+Pass Window includes WindowEventHandlers: member names are unique+Pass Window includes WindowOrWorkerGlobalScope: member names are unique+Pass WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique+Pass Window includes AnimationFrameProvider: member names are unique+Pass Window includes WindowSessionStorage: member names are unique+Pass Window includes WindowLocalStorage: member names are unique+Pass CookieStore interface: existence and properties of interface object+Pass CookieStoreManager interface: existence and properties of interface object+Pass CookieChangeEvent interface: existence and properties of interface object+Pass ExtendableCookieChangeEvent interface: existence and properties of interface object+Pass ServiceWorkerRegistration interface: member cookies\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.htmlnew file mode 100644index 00000000000..ef2725ff57b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Test that setting an already-expired cookie does not trigger an event.</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_already_expired.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.jsnew file mode 100644index 00000000000..f3bbe0ea560--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_already_expired.https.window.js@@ -0,0 +1,41 @@+// META: title=Cookie Store API: Test that setting an already-expired cookie does not trigger an event.+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'ALREADY-EXPIRED',+ expires: new Date(new Date() - 10_000),+ });+ await cookieStore.set('alt-cookie', 'IGNORE');+ assert_equals(+ await getCookieString(),+ 'alt-cookie=IGNORE',+ 'Already-expired cookie not included in CookieStore');+ await verifyCookieChangeEvent(+ eventPromise,+ {deleted: [], changed: [{name: 'alt-cookie', value: 'IGNORE'}]},+ 'Deletion not observed after document.cookie sets already-expired cookie');+}, 'CookieStore setting already-expired cookie should not be observed');++cookie_test(async t => {+ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'ALREADY-EXPIRED',+ expires: new Date(new Date() - 10_000),+ partitioned: true,+ });+ await cookieStore.set('alt-cookie', 'IGNORE');+ assert_equals(+ await getCookieString(),+ 'alt-cookie=IGNORE',+ 'Already-expired cookie not included in CookieStore');+ await verifyCookieChangeEvent(+ eventPromise,+ {deleted: [], changed: [{name: 'alt-cookie', value: 'IGNORE'}]},+ 'Deletion not observed after document.cookie sets already-expired cookie');+}, 'CookieStore setting already-expired partitioned cookie should not be observed');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.htmlnew file mode 100644index 00000000000..39f1179d409--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Test that changing only a cookie's attributes fires an event.</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_attribute_change.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.jsnew file mode 100644index 00000000000..611d19113f1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_attribute_change.https.window.js@@ -0,0 +1,83 @@+// META: title=Cookie Store API: Test that changing only a cookie's attributes fires an event.+// META: script=resources/cookie-test-helpers.js++'use strict';++// Changing a cookie is web-observable even when its value stays the same. These+// complement change_eventhandler_for_no_change.https.window.js, which covers a+// cookie whose value and attributes are all unchanged.+//+// See https://github.com/httpwg/http-extensions/issues/3501.+//+// HttpOnly is not covered here as it cannot be set through CookieStore or+// document.cookie; cookies/attributes/httponly-overwrite.https.html covers it+// at the level of the cookie store instead.++cookie_test(async t => {+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ expires: new Date(Date.now() + 100_000_000),+ });++ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ expires: new Date(Date.now() + 200_000_000),+ });+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Change of expiry time is observed');+}, 'CookieStore change of expires only should be observed');++cookie_test(async t => {+ await cookieStore.set({name: 'cookie', value: 'VALUE', sameSite: 'strict'});++ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({name: 'cookie', value: 'VALUE', sameSite: 'lax'});+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Change of same-site is observed');+}, 'CookieStore change of sameSite only should be observed');++// CookieStore always sets Secure, so document.cookie is used to vary it.+cookie_test(async t => {+ await setCookieStringDocument('cookie=VALUE; path=/; secure');++ const eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('cookie=VALUE; path=/');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Change of secure is observed');+}, 'document.cookie change of Secure only should be observed');++// An expiry time of null (a session cookie) and an expiry time in the future+// are distinct, in both directions.+cookie_test(async t => {+ await cookieStore.set({name: 'cookie', value: 'VALUE'});++ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ expires: new Date(Date.now() + 100_000_000),+ });+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Gaining an expiry time is observed');+}, 'CookieStore change from no expires to expires should be observed');++cookie_test(async t => {+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ expires: new Date(Date.now() + 100_000_000),+ });++ const eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({name: 'cookie', value: 'VALUE'});+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Losing an expiry time is observed');+}, 'CookieStore change from expires to no expires should be observed');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.htmlnew file mode 100644index 00000000000..cfb62cd7168--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Observing 'change' events in document when cookies set via document.cookie</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_document_cookie.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.jsnew file mode 100644index 00000000000..1937ebdae35--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_document_cookie.https.window.js@@ -0,0 +1,191 @@+// META: title=Cookie Store API: Observing 'change' events in document when cookies set via document.cookie+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-cookie=value; path=/');+ assert_equals(+ await getCookieString(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using document.cookie in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using document.cookie in HTTP cookie jar');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using document.cookie in document.cookie');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'value'}]},+ 'Cookie we wrote using document.cookie is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-cookie=new-value; path=/');+ assert_equals(+ await getCookieString(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using document.cookie in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using document.cookie in HTTP cookie jar');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using document.cookie in document.cookie');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'new-value'}]},+ 'Cookie we overwrote using document.cookie is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-cookie=DELETED; path=/; max-age=0');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after document.cookie' ++ ' cookie-clearing using max-age=0');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after document.cookie' ++ ' cookie-clearing using max-age=0');+ assert_equals(+ await getCookieStringDocument(),+ undefined,+ 'Empty document.cookie cookie jar after document.cookie' ++ ' cookie-clearing using max-age=0');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'DOCUMENT-cookie'}]},+ 'Deletion observed after document.cookie cookie-clearing' ++ ' using max-age=0');+}, 'document.cookie set/overwrite/delete observed by CookieStore');+++cookie_test(async t => {+ const eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-cookie=ALREADY-EXPIRED; path=/; max-age=0');+ await setCookieStringDocument('DOCUMENT-alt-cookie=IGNORE; path=/; max-age=10');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-alt-cookie=IGNORE',+ 'Already-expired cookie not included in document.cookie');+ await verifyCookieChangeEvent(+ eventPromise,+ {deleted: [], changed: [{name: 'DOCUMENT-alt-cookie', value: 'IGNORE'}]},+ 'Deletion not observed after document.cookie sets already-expired cookie');+}, 'document.cookie set already-expired cookie should not be observed by CookieStore');++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-cookie=VALUE; path=/');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'VALUE'}]},+ 'Original cookie is observed.');++ eventPromise = observeNextCookieChangeEvent();+ // Overwrite the original cookie with a duplicate, this should not dispatch an event.+ await setCookieStringDocument('DOCUMENT-cookie=VALUE; path=/');+ await setCookieStringDocument('DOCUMENT-alt-cookie=IGNORE; path=/');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-alt-cookie', value: 'IGNORE'}]},+ 'Duplicate cookie is not observed.');+}, 'document.cookie duplicate cookie should not be observed by CookieStore');++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('DOCUMENT-cookie', 'value');+ assert_equals(+ await getCookieString(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using CookieStore in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using CookieStore in HTTP cookie jar');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-cookie=value',+ 'Cookie we wrote using CookieStore in document.cookie');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'value'}]},+ 'Cookie we wrote using CookieStore is observed');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('DOCUMENT-cookie', 'new-value');+ assert_equals(+ await getCookieString(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using CookieStore in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using CookieStore in HTTP cookie jar');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-cookie=new-value',+ 'Cookie we overwrote using CookieStore in document.cookie');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'new-value'}]},+ 'Cookie we overwrote using CookieStore is observed');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.delete('DOCUMENT-cookie');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after CookieStore delete');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after CookieStore delete');+ assert_equals(+ await getCookieStringDocument(),+ undefined,+ 'Empty document.cookie cookie jar after CookieStore delete');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'DOCUMENT-cookie'}]},+ 'Deletion observed after CookieStore delete');+}, 'CookieStore set/overwrite/delete observed by document.cookie');+++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-🍪=🔵; path=/');+ assert_equals(+ await getCookieString(),+ 'DOCUMENT-🍪=🔵',+ 'Cookie we wrote using document.cookie in cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'DOCUMENT-🍪', value: '🔵'}]},+ 'Cookie we wrote using document.cookie is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringDocument('DOCUMENT-🍪=DELETED; path=/; max-age=0');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after document.cookie' ++ ' cookie-clearing using max-age=0');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'DOCUMENT-🍪'}]},+ 'Deletion observed after document.cookie cookie-clearing' ++ ' using max-age=0');+}, 'CookieStore agrees with document.cookie on encoding non-ASCII cookies');+++cookie_test(async t => {+ await cookieStore.set('DOCUMENT-🍪', '🔵');+ assert_equals(+ await getCookieStringDocument(),+ 'DOCUMENT-🍪=🔵',+ 'Cookie we wrote using CookieStore in document.cookie');++ await cookieStore.delete('DOCUMENT-🍪');+ assert_equals(+ await getCookieStringDocument(),+ undefined,+ 'Empty cookie jar after CookieStore delete');+}, 'document.cookie agrees with CookieStore on encoding non-ASCII cookies');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.htmlnew file mode 100644index 00000000000..f3077cef0b7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Observing 'change' events in document when cookies set via Set-Cookie header</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.jsnew file mode 100644index 00000000000..8517995acfe--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_http_cookie_and_set_cookie_headers.https.window.js@@ -0,0 +1,237 @@+// META: title=Cookie Store API: Observing 'change' events in document when cookies set via Set-Cookie header+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-cookie=value; path=/');+ assert_equals(+ await getCookieString(),+ 'HTTP-cookie=value',+ 'Cookie we wrote using HTTP in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTP-cookie=value',+ 'Cookie we wrote using HTTP in HTTP cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-cookie', value: 'value'}]},+ 'Cookie we wrote using HTTP is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-cookie=new-value; path=/');+ assert_equals(+ await getCookieString(),+ 'HTTP-cookie=new-value',+ 'Cookie we overwrote using HTTP in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTP-cookie=new-value',+ 'Cookie we overwrote using HTTP in HTTP cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-cookie', value: 'new-value'}]},+ 'Cookie we overwrote using HTTP is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-cookie=DELETED; path=/; max-age=0');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after HTTP cookie-clearing using max-age=0');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after HTTP cookie-clearing using max-age=0');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'HTTP-cookie'}]},+ 'Deletion observed after HTTP cookie-clearing using max-age=0');+}, 'HTTP set/overwrite/delete observed in CookieStore');+++cookie_test(async t => {+ const eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-cookie=ALREADY-EXPIRED; path=/; max-age=0');+ await setCookieStringHttp('HTTP-alt-cookie=IGNORE; path=/; max-age=10');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTP-alt-cookie=IGNORE',+ 'Already-expired cookie not included in HTTP');+ await verifyCookieChangeEvent(+ eventPromise,+ {deleted: [], changed: [{name: 'HTTP-alt-cookie', value: 'IGNORE'}]},+ 'Deletion not observed after HTTP sets already-expired cookie');+}, 'HTTP set already-expired cookie should not be observed by CookieStore');++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-cookie=VALUE; path=/');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-cookie', value: 'VALUE'}]},+ 'Original cookie is observed.');++ eventPromise = observeNextCookieChangeEvent();+ // Overwrite the original cookie with a duplicate, this should not dispatch an event.+ await setCookieStringHttp('HTTP-cookie=VALUE; path=/');+ await setCookieStringHttp('HTTP-alt-cookie=IGNORE; path=/');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-alt-cookie', value: 'IGNORE'}]},+ 'Duplicate cookie is not observed.');+}, 'HTTP duplicate cookie should not be observed by CookieStore');+++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-🍪=🔵; path=/');+ assert_equals(+ await getCookieString(),+ 'HTTP-🍪=🔵',+ 'Cookie we wrote using HTTP in cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-🍪', value: '🔵'}]},+ 'Cookie we wrote using HTTP is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTP-🍪=DELETED; path=/; max-age=0');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after HTTP cookie-clearing using max-age=0');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'HTTP-🍪'}]},+ 'Deletion observed after HTTP cookie-clearing using max-age=0');++}, 'CookieStore agreed with HTTP headers agree on encoding non-ASCII cookies');+++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('TEST', 'value0');+ assert_equals(+ await getCookieString(),+ 'TEST=value0',+ 'Cookie jar contains only cookie we set');+ assert_equals(+ await getCookieStringHttp(),+ 'TEST=value0',+ 'HTTP cookie jar contains only cookie we set');+ await verifyCookieChangeEvent(+ eventPromise,+ {changed: [{name: 'TEST', value: 'value0'}]},+ 'Observed value that was set');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('TEST', 'value');+ assert_equals(+ await getCookieString(),+ 'TEST=value',+ 'Cookie jar contains only cookie we set');+ assert_equals(+ await getCookieStringHttp(),+ 'TEST=value',+ 'HTTP cookie jar contains only cookie we set');+ await verifyCookieChangeEvent(+ eventPromise,+ {changed: [{name: 'TEST', value: 'value'}]},+ 'Observed value that was overwritten');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.delete('TEST');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Cookie jar does not contain cookie we deleted');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'HTTP cookie jar does not contain cookie we deleted');+ await verifyCookieChangeEvent(+ eventPromise,+ {deleted: [{name: 'TEST'}]},+ 'Observed cookie that was deleted');+}, 'CookieStore set/overwrite/delete observed in HTTP headers');+++cookie_test(async t => {+ await cookieStore.set('🍪', '🔵');+ assert_equals(+ await getCookieStringHttp(),+ '🍪=🔵',+ 'HTTP cookie jar contains only cookie we set');++ await cookieStore.delete('🍪');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'HTTP cookie jar does not contain cookie we deleted');+}, 'HTTP headers agreed with CookieStore on encoding non-ASCII cookies');+++cookie_test(async t => {+ // Non-UTF-8 byte sequences cause the Set-Cookie to be dropped.+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieBinaryHttp(+ unescape(encodeURIComponent('HTTP-cookie=value')) + '\xef\xbf\xbd; path=/');+ assert_equals(+ await getCookieString(),+ 'HTTP-cookie=value\ufffd',+ 'Binary cookie we wrote using HTTP in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTP-cookie=value\ufffd',+ 'Binary cookie we wrote using HTTP in HTTP cookie jar');+ assert_equals(+ decodeURIComponent(escape(await getCookieBinaryHttp())),+ 'HTTP-cookie=value\ufffd',+ 'Binary cookie we wrote in binary HTTP cookie jar');+ assert_equals(+ await getCookieBinaryHttp(),+ unescape(encodeURIComponent('HTTP-cookie=value')) + '\xef\xbf\xbd',+ 'Binary cookie we wrote in binary HTTP cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-cookie', value: 'value\ufffd'}]},+ 'Binary cookie we wrote using HTTP is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieBinaryHttp(+ unescape(encodeURIComponent('HTTP-cookie=new-value')) + '\xef\xbf\xbd; path=/');+ assert_equals(+ await getCookieString(),+ 'HTTP-cookie=new-value\ufffd',+ 'Binary cookie we overwrote using HTTP in cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTP-cookie=new-value\ufffd',+ 'Binary cookie we overwrote using HTTP in HTTP cookie jar');+ assert_equals(+ decodeURIComponent(escape(await getCookieBinaryHttp())),+ 'HTTP-cookie=new-value\ufffd',+ 'Binary cookie we overwrote in binary HTTP cookie jar');+ assert_equals(+ await getCookieBinaryHttp(),+ unescape(encodeURIComponent('HTTP-cookie=new-value')) + '\xef\xbf\xbd',+ 'Binary cookie we overwrote in binary HTTP cookie jar');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'HTTP-cookie', value: 'new-value\ufffd'}]},+ 'Binary cookie we overwrote using HTTP is observed');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieBinaryHttp(+ unescape(encodeURIComponent('HTTP-cookie=DELETED; path=/; max-age=0')));+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after binary HTTP cookie-clearing using max-age=0');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after' ++ ' binary HTTP cookie-clearing using max-age=0');+ assert_equals(+ await getCookieBinaryHttp(),+ undefined,+ 'Empty binary HTTP cookie jar after' ++ ' binary HTTP cookie-clearing using max-age=0');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: 'HTTP-cookie'}]},+ 'Deletion observed after binary HTTP cookie-clearing using max-age=0');+}, 'Binary HTTP set/overwrite/delete observed in CookieStore');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.htmlnew file mode 100644index 00000000000..c83db675613--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Test that setting a duplicate cookie does not fire a second event.</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_no_change.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.jsnew file mode 100644index 00000000000..5f9c2927433--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_change.https.window.js@@ -0,0 +1,43 @@+// META: title=Cookie Store API: Test that setting a duplicate cookie does not fire a second event.+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('cookie', 'VALUE');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'cookie', value: 'VALUE'}]},+ 'Original cookie is observed.');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('cookie', 'VALUE');+ await cookieStore.set('alt-cookie', 'IGNORE');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'alt-cookie', value: 'IGNORE'}]},+ 'Duplicate cookie is not observed.');+}, 'CookieStore duplicate cookie should not be observed');++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ partitioned: true,+ });+ await verifyCookieChangeEvent(+ eventPromise,+ {changed: [{name: 'cookie', value: 'VALUE', partitioned: true}]},+ 'Original cookie is observed.');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set({+ name: 'cookie',+ value: 'VALUE',+ partitioned: true,+ });+ await cookieStore.set('alt-cookie', 'IGNORE');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'alt-cookie', value: 'IGNORE'}]},+ 'Duplicate cookie is not observed.');+}, 'CookieStore duplicate partitioned cookie should not be observed');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.htmlnew file mode 100644index 00000000000..83325a4ebb0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Observing 'change' events in document when modifications API is called with blank arguments</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.jsnew file mode 100644index 00000000000..4498caf5968--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_and_no_value.https.window.js@@ -0,0 +1,58 @@+// META: title=Cookie Store API: Observing 'change' events in document when modifications API is called with blank arguments+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('', 'first-value');+ const actual1 =+ (await cookieStore.getAll('')).map(({ value }) => value).join(';');+ const expected1 = 'first-value';+ assert_equals(actual1, expected1);+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: '', value: 'first-value'}]},+ 'Observed no-name change');++ await promise_rejects_js(+ t,+ TypeError,+ cookieStore.set('', ''),+ 'Expected promise rejection when setting a cookie with' ++ ' no name and no value');++ await promise_rejects_js(+ t,+ TypeError,+ cookieStore.set({name: '', value: ''}),+ 'Expected promise rejection when setting a cookie with' ++ ' no name and no value');++ const cookies = await cookieStore.getAll('');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, '');+ assert_equals(cookies[0].value, 'first-value',+ 'Cookie with no name should still have previous value.');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.delete('');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: ''}]},+ 'Observed no-name deletion');++ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar');+ if (kHasDocument) {+ assert_equals(+ await getCookieStringDocument(),+ undefined,+ 'Empty document.cookie cookie jar');+ }++}, 'Verify behavior of no-name and no-value cookies.');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.htmlnew file mode 100644index 00000000000..f910c9ee2c6--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Observing 'change' events in document when setting a cookie value containing "="</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.jsnew file mode 100644index 00000000000..13d721786c9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_equals_in_value.https.window.js@@ -0,0 +1,46 @@+// META: title=Cookie Store API: Observing 'change' events in document when setting a cookie value containing "="+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('', 'first-value');+ const initialCookies = await cookieStore.getAll('');+ assert_equals(initialCookies.length, 1);+ assert_equals(initialCookies[0].name, '');+ assert_equals(initialCookies[0].value, 'first-value');++ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: '', value: 'first-value'}]},+ 'Observed no-name change');++ await promise_rejects_js(+ t,+ TypeError,+ cookieStore.set('', 'suspicious-value=resembles-name-and-value'),+ 'Expected promise rejection when setting a cookie with' ++ ' no name and "=" in value (via arguments)');++ await promise_rejects_js(+ t,+ TypeError,+ cookieStore.set(+ {name: '', value: 'suspicious-value=resembles-name-and-value'}),+ 'Expected promise rejection when setting a cookie with' ++ ' no name and "=" in value (via options)');++ const cookies = await cookieStore.getAll('');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, '');+ assert_equals(cookies[0].value, 'first-value',+ 'Cookie with no name should still have previous value.');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.delete('');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: ''}]},+ 'Observed no-name deletion');++}, "Verify that attempting to set a cookie with no name and with '=' in" ++ " the value does not work.");diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.htmlnew file mode 100644index 00000000000..021f7ec20bc--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Observing 'change' events in document when modifications API is called multiple times with a blank name</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.jsnew file mode 100644index 00000000000..60c6c16518a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/change_eventhandler_for_no_name_multiple_values.https.window.js@@ -0,0 +1,41 @@+// META: title=Cookie Store API: Observing 'change' events in document when modifications API is called multiple times with a blank name+// META: script=resources/cookie-test-helpers.js++'use strict';++cookie_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('', 'first-value');+ let actual1 =+ (await cookieStore.getAll('')).map(({ value }) => value).join(';');+ let expected1 = 'first-value';+ assert_equals(actual1, expected1);+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: '', value: 'first-value'}]},+ 'Observed no-name change');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set('', 'second-value');+ let actual2 =+ (await cookieStore.getAll('')).map(({ value }) => value).join(';');+ let expected2 = 'second-value';+ assert_equals(actual2, expected2);+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: '', value: 'second-value'}]},+ 'Observed no-name change');++ eventPromise = observeNextCookieChangeEvent();+ await cookieStore.delete('');+ await verifyCookieChangeEvent(+ eventPromise, {deleted: [{name: ''}]},+ 'Observed no-name change');++ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after testNoNameMultipleValues');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after testNoNameMultipleValues');+}, 'Verify behavior of multiple no-name cookies');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.htmlnew file mode 100644index 00000000000..4067db17073--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.delete() arguments</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/cookieStore_delete_arguments.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.jsnew file mode 100644index 00000000000..757eef7ade4--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_arguments.https.any.js@@ -0,0 +1,231 @@+// META: title=Cookie Store API: cookieStore.delete() arguments+// META: script=resources/cookie-test-helpers.js+// META: global=window,serviceworker++'use strict';+const MAX_COOKIE_NAME_SIZE = 4096;++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ await cookieStore.delete('cookie-name');+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with positional name');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });++ await cookieStore.delete({ name: 'cookie-name' });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with name in options');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value',+ domain: `.${currentDomain}` }));+}, 'cookieStore.delete domain starts with "."');++promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: 'example.com' }));+}, 'cookieStore.delete with domain that is not equal current host');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: currentDomain });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Domain=${currentDomain}; Max-Age=0`);+ });++ await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with domain set to the current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ const subDomain = `sub.${currentDomain}`;++ await promise_rejects_js(testCase, TypeError, cookieStore.delete(+ { name: 'cookie-name', domain: subDomain }));+}, 'cookieStore.delete with domain set to a subdomain of the current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ assert_not_equals(currentDomain[0] === '.',+ 'this test assumes that the current hostname does not start with .');+ const domainSuffix = currentDomain.substr(1);++ await promise_rejects_js(testCase, TypeError, cookieStore.delete(+ { name: 'cookie-name', domain: domainSuffix }));+}, 'cookieStore.delete with domain set to a non-domain-matching suffix of ' ++ 'the current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });++ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with path set to the current directory');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ const subDirectory = currentDirectory + "subdir/";+ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });++ await cookieStore.delete({ name: 'cookie-name', path: subDirectory });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.delete with path set to subdirectory of the current directory');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/'));+ await setCookieStringHttp(`cookie-name=cookie-value; Path=${currentDirectory};`);++ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });++ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete does not append / at the end of path');++promise_test(async testCase => {+ if (typeof self.document === 'undefined') {+ // The test is being run from a service worker context where document is undefined+ testCase.done();+ return;+ }+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/'));+ await setCookieStringDocument('cookie-name=cookie-value; path=' + currentDirectory);+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete can delete a cookie set by document.cookie if document is defined');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ const invalidPath = currentDirectory.substr(1);++ await promise_rejects_js(testCase, TypeError, cookieStore.delete(+ { name: 'cookie-name', path: invalidPath }));+}, 'cookieStore.delete with path that does not start with /');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });++ const cookie_attributes = await cookieStore.get('cookie-name');+ assert_equals(cookie_attributes.name, 'cookie-name');+ assert_equals(cookie_attributes.value, 'cookie-value');++ await cookieStore.delete(cookie_attributes.name);+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with get result');++promise_test(async testCase => {+ await cookieStore.set('', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`=deleted; Max-Age=0`);+ });++ await cookieStore.delete('');+ const cookie = await cookieStore.get('');+ assert_equals(cookie, null);+}, 'cookieStore.delete with positional empty name');++promise_test(async testCase => {+ await cookieStore.set('', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`=deleted; Max-Age=0`);+ });++ await cookieStore.delete({ name: '' });+ const cookie = await cookieStore.get('');+ assert_equals(cookie, null);+}, 'cookieStore.delete with empty name in options');++promise_test(async testCase => {+ const cookieName = 't'.repeat(MAX_COOKIE_NAME_SIZE);+ await cookieStore.set(cookieName, '');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(cookieName + '=; Max-Age=0');+ });++ await cookieStore.delete({name: cookieName});+ const cookie = await cookieStore.get(cookieName);+ assert_equals(cookie, null);+}, 'cookieStore.delete with maximum cookie name size');++promise_test(async testCase => {+ // Cookies having a __Host- prefix are not allowed to specify a domain+ await cookieStore.delete('cookie-name');++ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;++ await promise_rejects_js(testCase, TypeError, cookieStore.delete(+ { name: '__Host-cookie-name',+ value: 'cookie-value',+ domain: currentDomain }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.delete with a __Host- prefix should not have a domain');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ const cookie = await cookieStore.delete(' cookie-name \t');+ assert_equals(cookie, undefined);+}, 'cookieStore.delete with whitespace');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.htmlnew file mode 100644index 00000000000..56ea4d1bcbc--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.delete() return type</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_delete_basic.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.jsnew file mode 100644index 00000000000..08a1fac5afe--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_delete_basic.https.any.js@@ -0,0 +1,13 @@+// META: title=Cookie Store API: cookieStore.delete() return type+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ const p = cookieStore.delete('cookie-name');+ assert_true(p instanceof Promise,+ 'cookieStore.delete() returns a promise');+ const result = await p;+ assert_equals(result, undefined,+ 'cookieStore.delete() promise resolves to undefined');+}, 'cookieStore.delete return type is Promise<void>');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.htmlnew file mode 100644index 00000000000..8762f4dd7e0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_event_arguments.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.jsnew file mode 100644index 00000000000..bcb698eeb0d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_arguments.https.window.js@@ -0,0 +1,65 @@+'use strict';++test(() => {+ const event = new CookieChangeEvent('change');+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 0);+ assert_equals(event.deleted.length, 0);+}, 'CookieChangeEvent construction with default arguments');++test(() => {+ const event = new CookieChangeEvent('change', {+ changed: [+ { name: 'changed-name1', value: 'changed-value1' },+ { name: 'changed-name2', value: 'changed-value2' },+ ],+ });+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 2);+ assert_equals(event.changed[0].name, 'changed-name1');+ assert_equals(event.changed[0].value, 'changed-value1');+ assert_equals(event.changed[1].name, 'changed-name2');+ assert_equals(event.changed[1].value, 'changed-value2');+ assert_equals(event.deleted.length, 0);+}, 'CookieChangeEvent construction with changed cookie list');++test(() => {+ const event = new CookieChangeEvent('change', {+ deleted: [+ { name: 'deleted-name1', value: 'deleted-value1' },+ { name: 'deleted-name2', value: 'deleted-value2' },+ ],+ });+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 0);+ assert_equals(event.deleted.length, 2);+ assert_equals(event.deleted[0].name, 'deleted-name1');+ assert_equals(event.deleted[0].value, 'deleted-value1');+ assert_equals(event.deleted[1].name, 'deleted-name2');+ assert_equals(event.deleted[1].value, 'deleted-value2');+}, 'CookieChangeEvent construction with deleted cookie list');++test(() => {+ const event = new CookieChangeEvent('change', {+ changed: [+ { name: 'changed-name1', value: 'changed-value1' },+ { name: 'changed-name2', value: 'changed-value2' },+ ],+ deleted: [+ { name: 'deleted-name1', value: 'deleted-value1' },+ ],+ });+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 2);+ assert_equals(event.changed[0].name, 'changed-name1');+ assert_equals(event.changed[0].value, 'changed-value1');+ assert_equals(event.changed[1].name, 'changed-name2');+ assert_equals(event.changed[1].value, 'changed-value2');+ assert_equals(event.deleted.length, 1);+ assert_equals(event.deleted[0].name, 'deleted-name1');+ assert_equals(event.deleted[0].value, 'deleted-value1');+}, 'CookieChangeEvent construction with changed and deleted cookie lists');\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.htmlnew file mode 100644index 00000000000..0e52f8ebdeb--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_event_basic.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.jsnew file mode 100644index 00000000000..c0075d6adcd--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_basic.https.window.js@@ -0,0 +1,24 @@+'use strict';++promise_test(async testCase => {+ const eventPromise = new Promise((resolve) => {+ cookieStore.onchange = resolve;+ });++ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const event = await eventPromise;+ assert_true(event instanceof CookieChangeEvent);++ assert_equals(event.changed, event.changed);+ assert_equals(event.deleted, event.deleted);++ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 1);+ assert_equals(event.changed[0].name, 'cookie-name');+ assert_equals(event.changed[0].value, 'cookie-value');+ assert_equals(event.deleted.length, 0);+}, 'cookieStore fires change event for cookie set by cookieStore.set()');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.htmlnew file mode 100644index 00000000000..4dcd0171c01--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_event_delete.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.jsnew file mode 100644index 00000000000..d0fee1ab1d0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_delete.https.window.js@@ -0,0 +1,75 @@+'use strict';++promise_test(async testCase => {+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ // The events are asynchronously dispatched. Let's wait for both in the+ // expected order to avoid race conditions.++ {+ const eventPromise = new Promise((resolve) => {+ cookieStore.onchange = resolve;+ });+ await cookieStore.set('cookie-name', 'cookie-value');++ const event = await eventPromise;+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 1);+ assert_equals(event.changed[0].name, 'cookie-name');+ }++ {+ const eventPromise = new Promise((resolve) => {+ cookieStore.onchange = resolve;+ });+ await cookieStore.delete('cookie-name');+ const event = await eventPromise;+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.deleted.length, 1);+ assert_equals(event.deleted[0].name, 'cookie-name');+ assert_equals(+ event.deleted[0].value, undefined,+ 'Cookie change events for deletions should not have cookie values');+ assert_equals(event.changed.length, 0);+ }+}, 'cookieStore fires change event for cookie deleted by cookieStore.delete()');++promise_test(async testCase => {+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const eventPromise = new Promise((resolve) => {+ const events = [];+ cookieStore.onchange = event => {+ events.push(event);+ if (event.type === 'change' &&+ event.deleted.length === 1 &&+ event.deleted[0].name === 'cookie-name') {+ resolve(events);+ }+ }+ });++ await cookieStore.delete('cookie-unknown');+ await cookieStore.set('cookie-name', 'cookie-value');+ await cookieStore.delete('cookie-another-unknown');+ await cookieStore.delete('cookie-name');++ const events = await eventPromise;++ assert_equals(events.length, 2);+ assert_true(events[0] instanceof CookieChangeEvent);+ assert_equals(events[0].type, 'change');+ assert_equals(events[0].changed.length, 1);+ assert_equals(events[0].changed[0].name, 'cookie-name');++ assert_true(events[1] instanceof CookieChangeEvent);+ assert_equals(events[1].type, 'change');+ assert_equals(events[1].deleted.length, 1);+ assert_equals(events[1].deleted[0].name, 'cookie-name');+}, 'cookieStore does not fire change events for non-existing expired cookies');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.htmlnew file mode 100644index 00000000000..257a7d9c828--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_event_overwrite.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.jsnew file mode 100644index 00000000000..427e7dcbb7c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_event_overwrite.https.window.js@@ -0,0 +1,37 @@+'use strict';++promise_test(async testCase => {+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ // The events are asynchronously dispatched. Let's wait for both in the+ // expected order to avoid race conditions.+ {+ const eventPromise = new Promise((resolve) => {+ cookieStore.onchange = resolve;+ });+ await cookieStore.set('cookie-name', 'cookie-value');++ const event = await eventPromise;+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 1);+ assert_equals(event.changed[0].name, 'cookie-name');+ }++ {+ const eventPromise = new Promise((resolve) => {+ cookieStore.onchange = resolve;+ });+ await cookieStore.set('cookie-name', 'new-cookie-value');++ const event = await eventPromise;+ assert_true(event instanceof CookieChangeEvent);+ assert_equals(event.type, 'change');+ assert_equals(event.changed.length, 1);+ assert_equals(event.changed[0].name, 'cookie-name');+ assert_equals(event.changed[0].value, 'new-cookie-value');+ assert_equals(event.deleted.length, 0);+ }+}, 'cookieStore fires change event for cookie overwritten by cookieStore.set()');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.htmlnew file mode 100644index 00000000000..7faefbee610--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.getAll() arguments</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_getAll_arguments.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.jsnew file mode 100644index 00000000000..fecd2945a87--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_arguments.https.any.js@@ -0,0 +1,207 @@+// META: title=Cookie Store API: cookieStore.getAll() arguments+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });++ const cookies = await cookieStore.getAll();+ cookies.sort((a, b) => a.name.localeCompare(b.name));+ assert_equals(cookies.length, 2);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+ assert_equals(cookies[1].name, 'cookie-name-2');+ assert_equals(cookies[1].value, 'cookie-value-2');+}, 'cookieStore.getAll with no arguments');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });++ const cookies = await cookieStore.getAll({});+ cookies.sort((a, b) => a.name.localeCompare(b.name));+ assert_equals(cookies.length, 2);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+ assert_equals(cookies[1].name, 'cookie-name-2');+ assert_equals(cookies[1].value, 'cookie-value-2');+}, 'cookieStore.getAll with empty options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });++ const cookies = await cookieStore.getAll('cookie-name');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with positional name');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });++ const cookies = await cookieStore.getAll({ name: 'cookie-name' });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with name in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });++ const cookies = await cookieStore.getAll('cookie-name',+ { name: 'wrong-cookie-name' });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with name in both positional arguments and options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_url = self.location.href;+ if (self.GLOBAL.isWorker()) {+ target_url = target_url + '/path/within/scope';+ }++ const cookies = await cookieStore.getAll({ url: target_url });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with absolute url in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_path = self.location.pathname;+ if (self.GLOBAL.isWorker()) {+ target_path = target_path + '/path/within/scope';+ }++ const cookies = await cookieStore.getAll({ url: target_path });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with relative url in options');++if (!self.GLOBAL.isWorker()) {+ promise_test(async testCase => {+ const invalid_url =+ `${self.location.protocol}//${self.location.host}/different/path`;+ await promise_rejects_js(testCase, TypeError, cookieStore.getAll(+ { url: invalid_url }));+ }, 'cookieStore.getAll with invalid url path in options');+} else {+ promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const sameorigin_url =+ `${self.location.protocol}//${self.location.host}/different/path`;+ const cookies = await cookieStore.getAll({ url: sameorigin_url });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+ }, 'cookieStore.getAll with same-origin url path in options');+}++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const invalid_url =+ `${self.location.protocol}//www.example.com${self.location.pathname}`;+ await promise_rejects_js(testCase, TypeError, cookieStore.getAll(+ { url: invalid_url }));+}, 'cookieStore.getAll with invalid url host in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_url = self.location.href;+ if (self.GLOBAL.isWorker()) {+ target_url = target_url + '/path/within/scope';+ }++ target_url = target_url + "#foo";++ const cookies = await cookieStore.getAll({ url: target_url });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with absolute url with fragment in options');++promise_test(async testCase => {+ if (!self.GLOBAL.isWorker()) {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ self.location = "#foo";+ let target_url = self.location.href;++ const cookies = await cookieStore.getAll({ url: target_url });+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+ }+}, 'cookieStore.getAll with absolute different url in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ const cookies = await cookieStore.getAll(' cookie-name \t');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll with whitespace');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.htmlnew file mode 100644index 00000000000..5aed828dc40--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.getAll() with multiple cookies</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_getAll_multiple.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.jsnew file mode 100644index 00000000000..10dcacbd688--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_multiple.https.any.js@@ -0,0 +1,29 @@+// META: title=Cookie Store API: cookieStore.getAll() with multiple cookies+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.set('cookie-name-2', 'cookie-value-2');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-2');+ });+ await cookieStore.set('cookie-name-3', 'cookie-value-3');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name-3');+ });++ const cookies = await cookieStore.getAll();+ cookies.sort((a, b) => a.name.localeCompare(b.name));+ assert_equals(cookies.length, 3);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+ assert_equals(cookies[1].name, 'cookie-name-2');+ assert_equals(cookies[1].value, 'cookie-value-2');+ assert_equals(cookies[2].name, 'cookie-name-3');+ assert_equals(cookies[2].value, 'cookie-value-3');+}, 'cookieStore.getAll returns multiple cookies written by cookieStore.set');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.htmlnew file mode 100644index 00000000000..7fe5ba3ec6f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Interaction between cookieStore.set() and cookieStore.getAll()</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_getAll_set_basic.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.jsnew file mode 100644index 00000000000..dee78e1867c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_basic.https.any.js@@ -0,0 +1,16 @@+// META: title=Cookie Store API: Interaction between cookieStore.set() and cookieStore.getAll()+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ const cookies = await cookieStore.getAll('cookie-name');++ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.getAll returns the cookie written by cookieStore.set');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.htmlnew file mode 100644index 00000000000..c9f846c1c85--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.set()/getAll() with Document URL changing</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_getAll_set_creation_url.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.jsnew file mode 100644index 00000000000..d09c4aad4f8--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_getAll_set_creation_url.https.any.js@@ -0,0 +1,33 @@+// META: title=Cookie Store API: cookieStore.set()/getAll() with Document URL changing+// META: global=window++'use strict';++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);++ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ });++ // This changes the Document's current URL to this different URL.+ // The Document's creation URL does not change.+ // If set() and getAll() use Document's current URL, the cookie will be set+ // using the original URL above, and the get below will fail since it looks+ // for cookies with this different URL. If they both use the creation URL,+ // the get will succeed since it won't use this different URL to search.+ let different_url = `${self.location.protocol}//${self.location.host}/different/path`;+ history.pushState({}, "", different_url);++ const cookies = await cookieStore.getAll();+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-value');+}, 'cookieStore.set and cookieStore.getAll use the creation url');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.htmlnew file mode 100644index 00000000000..68a6a360128--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.get() arguments</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_get_arguments.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.jsnew file mode 100644index 00000000000..a6bbc1a2f15--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_arguments.https.any.js@@ -0,0 +1,154 @@+// META: title=Cookie Store API: cookieStore.get() arguments+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ await promise_rejects_js(testCase, TypeError, cookieStore.get());+}, 'cookieStore.get with no arguments returns TypeError');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ await promise_rejects_js(testCase, TypeError, cookieStore.get({}));+},'cookieStore.get with empty options returns TypeError');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with positional name');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const cookie = await cookieStore.get({ name: 'cookie-name' });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with name in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const cookie = await cookieStore.get('cookie-name',+ { name: 'wrong-cookie-name' });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with name in both positional arguments and options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_url = self.location.href;+ if (self.GLOBAL.isWorker()) {+ target_url = target_url + '/path/within/scope';+ }++ const cookie = await cookieStore.get({ url: target_url });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with absolute url in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_path = self.location.pathname;+ if (self.GLOBAL.isWorker()) {+ target_path = target_path + '/path/within/scope';+ }++ const cookie = await cookieStore.get({ url: target_path });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with relative url in options');++if (!self.GLOBAL.isWorker()) {+ promise_test(async testCase => {+ const invalid_url =+ `${self.location.protocol}//${self.location.host}/different/path`;+ await promise_rejects_js(testCase, TypeError, cookieStore.get(+ { url: invalid_url }));+ }, 'cookieStore.get with invalid url path in options');+} else {+ promise_test(async testCase => {+ const sameorigin_url =+ `${self.location.protocol}//${self.location.host}/different/path`;+ assert_true(await cookieStore.get({ url: sameorigin_url }) === null);+ }, 'cookieStore.get with same-origin url path in options');+}++promise_test(async testCase => {+ const invalid_url =+ `${self.location.protocol}//www.example.com${self.location.pathname}`;+ await promise_rejects_js(testCase, TypeError, cookieStore.get(+ { url: invalid_url }));+}, 'cookieStore.get with invalid url host in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ let target_url = self.location.href;+ if (self.GLOBAL.isWorker()) {+ target_url = target_url + '/path/within/scope';+ }++ target_url = target_url + "#foo";++ const cookie = await cookieStore.get({ url: target_url });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with absolute url with fragment in options');++promise_test(async testCase => {+ if (!self.GLOBAL.isWorker()) {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ self.location = "#foo";+ let target_url = self.location.href;++ const cookie = await cookieStore.get({ url: target_url });+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+ }+}, 'cookieStore.get with absolute different url in options');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ const cookie = await cookieStore.get(' cookie-name \t');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get with whitespace');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.htmlnew file mode 100644index 00000000000..262b3227866--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Interaction between cookieStore.set() and cookieStore.delete()</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_get_delete_basic.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.jsnew file mode 100644index 00000000000..9337669afd5--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_delete_basic.https.any.js@@ -0,0 +1,14 @@+// META: title=Cookie Store API: Interaction between cookieStore.set() and cookieStore.delete()+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ await cookieStore.delete('cookie-name');+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.get returns null for a cookie deleted by cookieStore.delete');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.htmlnew file mode 100644index 00000000000..d1d6f78b9e1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_across_frames.https.html@@ -0,0 +1,46 @@+<!doctype html>+<meta charset='utf-8'>+<title>Async Cookies: cookieStore basic API across frames</title>+<link rel='help' href='https://cookiestore.spec.whatwg.org/'>+<link rel='author' href='[email protected]' title='Jarryd Goodman'>+<script src='../resources/testharness.js'></script>+<script src='../resources/testharnessreport.js'></script>+<style>iframe { display: none; }</style>+<iframe id='iframe'></iframe>+<script>+'use strict';++promise_test(async t => {+ const iframe = document.getElementById('iframe');+ const frameCookieStore = iframe.contentWindow.cookieStore;++ const oldCookie = await frameCookieStore.get('cookie-name');+ assert_equals(oldCookie, null,+ 'Precondition not met: cookie store should be empty');++ await cookieStore.set('cookie-name', 'cookie-value');+ t.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });++ const frameCookie = await frameCookieStore.get('cookie-name');+ assert_equals(frameCookie.value, 'cookie-value');+}, 'cookieStore.get() sees cookieStore.set() in frame');++promise_test(async t => {+ const iframe = document.getElementById('iframe');+ const frameCookieStore = iframe.contentWindow.cookieStore;++ const oldCookie = await frameCookieStore.get('cookie-name');+ assert_equals(oldCookie, null,+ 'Precondition not met: cookie store should be empty');++ await frameCookieStore.set('cookie-name', 'cookie-value');+ t.add_cleanup(async () => {+ await frameCookieStore.delete('cookie-name');+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get() in frame sees cookieStore.set()')+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.htmlnew file mode 100644index 00000000000..e142227d77c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Interaction between cookieStore.set() and cookieStore.get()</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_get_set_basic.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.jsnew file mode 100644index 00000000000..127f758f5f0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_basic.https.any.js@@ -0,0 +1,15 @@+// META: title=Cookie Store API: Interaction between cookieStore.set() and cookieStore.get()+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await cookieStore.delete('cookie-name');+ });+ const cookie = await cookieStore.get('cookie-name');++ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.get returns the cookie written by cookieStore.set');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.htmlnew file mode 100644index 00000000000..00f59d6f020--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.set()/get() with Document URL changing</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_get_set_creation_url.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.jsnew file mode 100644index 00000000000..71f8108095f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_creation_url.https.any.js@@ -0,0 +1,32 @@+// META: title=Cookie Store API: cookieStore.set()/get() with Document URL changing+// META: global=window++'use strict';++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);++ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ });++ // This changes the Document's current URL to this different URL.+ // The Document's creation URL does not change.+ // If set() and get() use Document's current URL, the cookie will be set+ // using the original URL above, and the get below will fail since it looks+ // for cookies with this different URL. If they both use the creation URL,+ // the get will succeed since it won't use this different URL to search.+ let different_url = `${self.location.protocol}//${self.location.host}/different/path`;+ history.pushState({}, "", different_url);++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set and cookieStore.get use the creation url');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.htmlnew file mode 100644index 00000000000..d76a7eee4c9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: Cookie ordering</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_get_set_ordering.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.jsnew file mode 100644index 00000000000..fe564e55fc4--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_get_set_ordering.https.any.js@@ -0,0 +1,54 @@+// META: title=Cookie Store API: Cookie ordering+// META: global=window,serviceworker++'use strict';++promise_test(async t => {+ t.add_cleanup(async () => {+ await cookieStore.delete('ordered-1');+ await cookieStore.delete('ordered-2');+ await cookieStore.delete('ordered-3');+ });++ await cookieStore.set('ordered-1', 'cookie-value1');+ await cookieStore.set('ordered-2', 'cookie-value2');+ await cookieStore.set('ordered-3', 'cookie-value3');+ // NOTE: this assumes no concurrent writes from elsewhere; it also+ // uses three separate cookie jar read operations where a single getAll+ // would be more efficient, but this way the CookieStore does the filtering+ // for us.+ const matchingValues = await Promise.all(['1', '2', '3'].map(+ async suffix => (await cookieStore.get('ordered-' + suffix)).value));+ const actual = matchingValues.join(';');+ const expected = 'cookie-value1;cookie-value2;cookie-value3';+ assert_equals(actual, expected);+}, 'Set three simple origin session cookies sequentially and ensure ' ++ 'they all end up in the cookie jar in order.');++promise_test(async t => {+ t.add_cleanup(async () => {+ await cookieStore.delete('ordered-unordered1');+ await cookieStore.delete('ordered-unordered2');+ await cookieStore.delete('ordered-unordered3');+ });++ await Promise.all([+ cookieStore.set('ordered-unordered1', 'unordered-cookie-value1'),+ cookieStore.set('ordered-unordered2', 'unordered-cookie-value2'),+ cookieStore.set('ordered-unordered3', 'unordered-cookie-value3')+ ]);+ // NOTE: this assumes no concurrent writes from elsewhere; it also+ // uses three separate cookie jar read operations where a single getAll+ // would be more efficient, but this way the CookieStore does the filtering+ // for us and we do not need to sort.+ const matchingCookies = await Promise.all(['1', '2', '3'].map(+ suffix => cookieStore.get('ordered-unordered' + suffix)));+ const actual = matchingCookies.map(({ value }) => value).join(';');+ const expected =+ 'unordered-cookie-value1;' ++ 'unordered-cookie-value2;' ++ 'unordered-cookie-value3';+ assert_equals(actual, expected);+}, '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. ');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_in_detached_frame.https.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_in_detached_frame.https.htmlnew file mode 100644index 00000000000..2e191e5d053--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_in_detached_frame.https.html@@ -0,0 +1,21 @@+<!doctype html>+<meta charset="utf-8">+<title>cookieStore on DOMWindow of detached iframe</title>+<link rel="help" href="https://cookiestore.spec.whatwg.org/">+<link rel="author" href="[email protected]" title="Victor Costan">+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<iframe id="iframe"></iframe>+<script>+'use strict';++test(() => {+ const iframe = document.getElementById('iframe');+ const frameWindow = iframe.contentWindow;++ iframe.parentNode.removeChild(iframe);++ // By spec, window.cookieStore isn't nullable.+ assert_true(frameWindow.cookieStore != null);+});+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_opaque_origin.https.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_opaque_origin.https.htmlnew file mode 100644index 00000000000..90d5011a963--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_opaque_origin.https.html@@ -0,0 +1,85 @@+<!DOCTYPE html>+<meta charset=utf-8>+<title>Cookie Store API: Opaque origins for cookieStore</title>+<link rel=help href="https://cookiestore.spec.whatwg.org/">+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script>++const apiCalls = {+ 'get': 'cookieStore.get("cookie-name")',+ 'getAll': 'cookieStore.getAll()',+ 'set': 'cookieStore.set("cookie-name", "cookie-value")',+ 'delete': 'cookieStore.delete("cookie-name")'+};++const script = `+<script>+ "use strict";+ window.onmessage = async () => {+ try {+ await %s;+ window.parent.postMessage({result: "no exception"}, "*");+ } catch (ex) {+ window.parent.postMessage({result: ex.name}, "*");+ };+ };+<\/script>+`;++function load_iframe(apiCall, sandbox) {+ return new Promise(resolve => {+ const iframe = document.createElement('iframe');+ iframe.onload = () => { resolve(iframe); };+ if (sandbox)+ iframe.sandbox = sandbox;+ iframe.srcdoc = script.replace('%s', apiCall);+ iframe.style.display = 'none';+ document.documentElement.appendChild(iframe);+ });+}++function wait_for_message(iframe) {+ return new Promise(resolve => {+ self.addEventListener('message', function listener(e) {+ if (e.source === iframe.contentWindow) {+ resolve(e.data);+ self.removeEventListener('message', listener);+ }+ });+ });+}++promise_test(async t => {+ for (apiCall in apiCalls) {+ const iframe = await load_iframe(apiCalls[apiCall]);+ iframe.contentWindow.postMessage({}, '*');+ const message = await wait_for_message(iframe);+ assert_equals(message.result, 'no exception',+ 'cookieStore ${apiCall} should not throw');+ }+}, 'cookieStore in non-sandboxed iframe should not throw');++promise_test(async t => {+ for (apiCall in apiCalls) {+ const iframe = await load_iframe(apiCalls[apiCall], 'allow-scripts');+ iframe.contentWindow.postMessage({}, '*');+ const message = await wait_for_message(iframe);+ assert_equals(message.result, 'SecurityError',+ 'cookieStore ${apiCall} should throw SecurityError');+ }+}, 'cookieStore in sandboxed iframe should throw SecurityError');++promise_test(async t => {+ const apiCall = 'cookieStore.addEventListener("change", e => {})';++ // Adding a listener in sandboxed iframe doesn't throw, since that would not+ // be consistent with how EventTarget is spec'd.+ const iframe = await load_iframe(apiCall, 'allow-scripts');+ iframe.contentWindow.postMessage({}, '*');+ const message = await wait_for_message(iframe);+ assert_equals(message.result, 'no exception',+ 'cookieStore.addEventListener should not throw');+}, 'cookieStore in sandboxed iframe --- listener access');++</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.htmlnew file mode 100644index 00000000000..8ac894e92bc--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.set() arguments</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/cookieStore_set_arguments.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.jsnew file mode 100644index 00000000000..fe1d1451b13--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_arguments.https.any.js@@ -0,0 +1,418 @@+// META: title=Cookie Store API: cookieStore.set() arguments+// META: script=resources/cookie-test-helpers.js+// META: global=window,serviceworker++'use strict';++promise_test(async testCase => {+ await cookieStore.delete('cookie-name');++ await cookieStore.set('cookie-name', 'cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with positional name and value');++promise_test(async testCase => {+ await cookieStore.delete('cookie-name');++ await cookieStore.set({ name: 'cookie-name', value: 'cookie-value' });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with name and value in options');++promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set('', ''));+}, "cookieStore.set fails with empty name and empty value");++promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set('', 'suspicious-value=resembles-name-and-value'));+}, "cookieStore.set with empty name and an '=' in value");++promise_test(async testCase => {+ await cookieStore.delete('cookie-name');+ cookieStore.set('cookie-name', 'suspicious-value=resembles-name-and-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'suspicious-value=resembles-name-and-value');+}, "cookieStore.set with normal name and an '=' in value");++let invalidCharacters = [ '\u0000', '\u0001', '\u0002'+ , '\u0003', '\u0004', '\u0005'+ , '\u0006', '\u0007', '\u0008'+ , '\u0010', '\u0011'+ , '\u0012', '\u0013', '\u0014'+ , '\u0015', '\u0016', '\u0017'+ , '\u0018', '\u0019', '\u001A'+ , '\u001B', '\u001C', '\u001D'+ , '\u001E', '\u001F'+ , '\u003B', '\u007F'];++invalidCharacters.forEach(invalidCharacter => {+ let invalidCookieName = 'cookie' + invalidCharacter + 'name';+ let invalidCookieValue = 'cookie' + invalidCharacter + 'value';+ promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set(invalidCookieName, 'cookie-value'));+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set('cookie-name', invalidCookieValue));+ }, `cookieStore.set checks if name or value contain invalid character U+${invalidCharacter.charCodeAt(0).toString(16).padStart(4, "0").toUpperCase()}`);+});++promise_test(async testCase => {+ const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;+ const tenYearsFromNow = Date.now() + tenYears;+ await cookieStore.delete('cookie-name');++ await cookieStore.set(+ { name: 'cookie-name',+ value: 'cookie-value',+ expires: new Date(tenYearsFromNow) });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with expires set to a future Date');++promise_test(async testCase => {+ const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;+ const tenYearsAgo = Date.now() - tenYears;+ await cookieStore.delete('cookie-name');++ await cookieStore.set(+ { name :'cookie-name',+ value: 'cookie-value',+ expires: new Date(tenYearsAgo) });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with expires set to a past Date');++promise_test(async testCase => {+ const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;+ const tenYearsFromNow = Date.now() + tenYears;+ await cookieStore.delete('cookie-name');++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', expires: tenYearsFromNow });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with expires set to a future timestamp');++promise_test(async testCase => {+ const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;+ const tenYearsAgo = Date.now() - tenYears;+ await cookieStore.delete('cookie-name');++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', expires: tenYearsAgo });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with expires set to a past timestamp');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name',+ value: 'cookie-value',+ domain: `.${currentDomain}` }));+}, 'cookieStore.set domain starts with "."');++promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: 'example.com' }));+}, 'cookieStore.set with domain that is not equal current host');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: currentDomain });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Domain=${currentDomain}; Path=/; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with domain set to the current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ const subDomain = `sub.${currentDomain}`;++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: subDomain }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with domain set to a subdomain of the current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ assert_not_equals(currentDomain[0] === '.',+ 'this test assumes that the current hostname does not start with .');+ const domainSuffix = currentDomain.substr(1);++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', domain: domainSuffix }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with domain set to a non-domain-matching suffix of the ' ++ 'current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ await cookieStore.delete('cookie-name');++ await cookieStore.set('cookie-name', 'cookie-value1');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=/; Max-Age=0`);+ });+ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value2', domain: currentDomain });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Domain=${currentDomain}; Path=/; Max-Age=0`);+ });++ const cookies = await cookieStore.getAll('cookie-name');+ assert_equals(cookies.length, 2);++ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[1].name, 'cookie-name');++ const values = cookies.map((cookie) => cookie.value);+ values.sort();+ assert_array_equals(values, ['cookie-value1', 'cookie-value2']);+}, 'cookieStore.set default domain is null and differs from current hostname');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with path set to the current directory');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ const subDirectory = currentDirectory + "subdir/";+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });+ await cookieStore.delete({ name: 'cookie-name', path: subDirectory });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: subDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${subDirectory}; Max-Age=0`);+ });+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with path set to a subdirectory of the current directory');++promise_test(async testCase => {+ await cookieStore.delete('cookie-name');++ await cookieStore.set('cookie-name', 'cookie-old-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-new-value', path: '/' });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=/; Max-Age=0`);+ });++ const cookies = await cookieStore.getAll('cookie-name');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'cookie-new-value');+}, 'cookieStore.set default path is /');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/'));+ await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });++ await cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set does not add / to path that does not end with /');++promise_test(async testCase => {+ if (typeof self.document === 'undefined') {+ // The test is being run from a service worker context where document is undefined+ testCase.done();+ return;+ }+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory = currentPath.substr(0, currentPath.lastIndexOf('/'));+ await setCookieStringDocument('cookie-name=cookie-value; path=' + currentDirectory);+ await cookieStore.set(+ { name: 'cookie-name', value: 'new-cookie-value', path: currentDirectory });+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}; Max-Age=0`);+ await setCookieStringHttp(`cookie-name=deleted; Path=${currentDirectory}/; Max-Age=0`);+ });+ const cookies = await cookieStore.getAll('cookie-name');+ assert_equals(cookies.length, 1);+ assert_equals(cookies[0].name, 'cookie-name');+ assert_equals(cookies[0].value, 'new-cookie-value');+}, 'cookieStore.set can modify a cookie set by document.cookie if document is defined');++promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentPath = currentUrl.pathname;+ const currentDirectory =+ currentPath.substr(0, currentPath.lastIndexOf('/') + 1);+ const invalidPath = currentDirectory.substr(1);++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name', value: 'cookie-value', path: invalidPath }));+}, 'cookieStore.set with path that does not start with /');++promise_test(async testCase => {+ await cookieStore.set('cookie-name', 'old-cookie-value');+ testCase.add_cleanup(async () => {+ await setCookieStringHttp(`cookie-name=deleted; Max-Age=0`);+ });++ const cookie_attributes = await cookieStore.get('cookie-name');+ assert_equals(cookie_attributes.name, 'cookie-name');+ assert_equals(cookie_attributes.value, 'old-cookie-value');++ cookie_attributes.value = 'new-cookie-value';+ await cookieStore.set(cookie_attributes.name, cookie_attributes.value);+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'new-cookie-value');+}, 'cookieStore.set with get result');++promise_test(async testCase => {+ // The maximum attribute value size is specified as 1024 bytes at https://cookiestore.spec.whatwg.org/#cookie-maximum-attribute-value-size.+ await cookieStore.delete('cookie-name');++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name',+ value: 'cookie-value',+ path: '/' + 'a'.repeat(1023) + '/' }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set checks if the path is too long');++promise_test(async testCase => {+ // The maximum attribute value size is specified as 1024 bytes at https://cookiestore.spec.whatwg.org/#cookie-maximum-attribute-value-size.+ await cookieStore.delete('cookie-name');++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: 'cookie-name',+ value: 'cookie-value',+ domain: 'a'.repeat(1025) }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set checks if the domain is too long');++promise_test(async testCase => {+ // Cookies having a __Host- prefix are not allowed to specify a domain+ await cookieStore.delete('cookie-name');++ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: '__Host-cookie-name',+ value: 'cookie-value',+ domain: currentDomain }));+ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with a __Host- prefix should not have a domain');++promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: '',+ value: ' ' }));++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: ' ',+ value: '' }));++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: ' ',+ value: ' ' }));+}, 'cookieStore.set with whitespace only name and value');++promise_test(async testCase => {+ const tests = [+ { set: ['a b', 'x y'], get: ['a b', 'x y'] },+ { set: ['a ', 'x'], get: ['a', 'x'] },+ { set: ['a\t', 'x'], get: ['a', 'x'] },+ { set: [' a', 'x'], get: ['a', 'x'] },+ { set: [' \t a', 'x'], get: ['a', 'x'] },+ { set: [' \t a \t\t', 'x'], get: ['a', 'x'] },+ { set: ['a', 'x '], get: ['a', 'x'] },+ { set: ['a', 'x\t'], get: ['a', 'x'] },+ { set: ['a', ' x'], get: ['a', 'x'] },+ { set: ['a', ' \t x'], get: ['a', 'x'] },+ { set: ['a', ' \t x \t\t'], get: ['a', 'x'] },+ ];++ for (const t of tests) {+ await cookieStore.set(t.set[0], t.set[1]);+ let cookie = await cookieStore.get(t.get[0]);+ assert_equals(cookie.value, t.get[1]);++ await cookieStore.delete(t.get[0]);++ cookie = await cookieStore.get(t.get[0]);+ assert_equals(cookie, null);+ }++}, 'cookieStore.set with whitespace at begining or end');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.htmlnew file mode 100644index 00000000000..8631faf2bee--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.delete() return type</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_set_limit.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.jsnew file mode 100644index 00000000000..0bd9ceec08d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_limit.https.any.js@@ -0,0 +1,69 @@+// META: title=Cookie Store API: cookieStore.delete() return type+// META: global=window,serviceworker++'use strict';++function cookieParamsWithNameAndValueLengths(nameLength, valueLength) {+ return { name: "t".repeat(nameLength), value: "1".repeat(valueLength) }+}++const scenarios = [+ {+ cookie: cookieParamsWithNameAndValueLengths(2048, 2048),+ expected: cookieParamsWithNameAndValueLengths(2048, 2048),+ name: "Set max-size cookie with largest possible name and value (4096 bytes)",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(4097, 1),+ name: "Ignore cookie with name larger than 4096 and 1 byte value",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(4096, 0),+ expected: cookieParamsWithNameAndValueLengths(4096, 0),+ name: "Set max-size value-less cookie",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(4097, 0),+ name: "Ignore value-less cookie with name larger than 4096 bytes",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(1, 4095),+ expected: cookieParamsWithNameAndValueLengths(1, 4095),+ name: "Set max-size cookie with largest possible value (4095 bytes)",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(1, 4096),+ name: "Ignore named cookie (with non-zero length) and value larger than 4095 bytes",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(4096, 1),+ name: "Ignore named cookie with length larger than 4095 bytes, and a non-zero value",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(0, 4096),+ expected: cookieParamsWithNameAndValueLengths(0, 4096),+ name: "Set max-size name-less cookie",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(0, 4097),+ name: "Ignore name-less cookie with value larger than 4096 bytes",+ },+ {+ cookie: cookieParamsWithNameAndValueLengths(0, 4097),+ name: "Ignore name-less cookie (without leading =) with value larger than 4096 bytes",+ },+];++for (const scenario of scenarios) {+ promise_test(async testCase => {+ let value = "";+ try {+ await cookieStore.set(scenario.cookie.name, scenario.cookie.value);+ value = (await cookieStore.get(scenario.cookie.name))?.value;+ assert_equals(value, scenario.expected.value);+ await cookieStore.delete({ name: scenario.cookie.name });+ } catch(e) {+ assert_equals(scenario.expected, undefined);+ }+ }, scenario.name);+}diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.htmlnew file mode 100644index 00000000000..9a8c5cfa01a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.set() maxAge</title>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/cookieStore_set_maxAge.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.jsnew file mode 100644index 00000000000..eb9b6d2069f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_set_maxAge.https.window.js@@ -0,0 +1,57 @@+// META: title=Cookie Store API: cookieStore.set() maxAge+// META: script=resources/cookie-test-helpers.js+// META: global=window,serviceworker+cookie_test(async testCase => {+ await cookieStore.set(+ {+ name: 'cookie-name',+ value: 'cookie-value',+ maxAge: 60+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie.name, 'cookie-name');+ assert_equals(cookie.value, 'cookie-value');+}, 'cookieStore.set with maxAge set to a positive value');++cookie_test(async testCase => {+ await cookieStore.set(+ {+ name: 'cookie-name',+ value: 'cookie-value',+ maxAge: -60+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+}, 'cookieStore.set with maxAge set to a negative value');++cookie_test(async testCase => {+ let eventPromise = observeNextCookieChangeEvent();+ await cookieStore.set(+ {+ name: 'cookie-name',+ value: 'cookie-value',+ maxAge: 0+ });++ const cookie = await cookieStore.get('cookie-name');+ assert_equals(cookie, null);+ await cookieStore.set('alt-cookie', 'IGNORE');+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'alt-cookie', value: 'IGNORE'}]},+ 'Already expired cookie is not observed.');+}, 'cookieStore.set with maxAge set to zero, cookie change event not dispatched');++cookie_test(async testCase => {+ const oneDay = 24 * 60 * 60 * 1000;+ const tomorrow = Date.now() + oneDay ;++ await promise_rejects_js(testCase, TypeError,+ cookieStore.set({+ name: 'cookie-name',+ value: 'cookie-value',+ expires: tomorrow,+ maxAge: 60+ }));+}, 'cookieStore.set fails with both maxAge and expires');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.htmlnew file mode 100644index 00000000000..5b981f2391c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookieStore.set()/get()/delete() for cookies with special names</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>++<div id=log></div>+<script src="../cookiestore/cookieStore_special_names.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.jsnew file mode 100644index 00000000000..7431609df6e--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/cookieStore_special_names.https.any.js@@ -0,0 +1,94 @@+// META: title=Cookie Store API: cookieStore.set()/get()/delete() for cookies with special names+// META: global=window,serviceworker++'use strict';++['__Secure-', '__secure-', '__Host-', '__host-'].forEach(prefix => {+ promise_test(async testCase => {+ await cookieStore.set(`${prefix}cookie-name`, `secure-cookie-value`);+ assert_equals(+ (await cookieStore.get(`${prefix}cookie-name`)).value,+ 'secure-cookie-value',+ `Setting ${prefix} cookies should not fail in secure context`);++ try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}+ }, `cookieStore.set with ${prefix} name on secure origin`);++ promise_test(async testCase => {+ // This test is for symmetry with the non-secure case. In non-secure+ // contexts, the set() should fail even if the expiration date makes+ // the operation a no-op.+ await cookieStore.set(+ { name: `${prefix}cookie-name`, value: `secure-cookie-value`,+ expires: Date.now() - (24 * 60 * 60 * 1000)});+ assert_equals(await cookieStore.get(`${prefix}cookie-name`), null);+ try { await cookieStore.delete(`${prefix}cookie-name`); } catch (e) {}+ }, `cookieStore.set of expired ${prefix} cookie name on secure origin`);++ promise_test(async testCase => {+ assert_equals(+ await cookieStore.delete(`${prefix}cookie-name`), undefined,+ `Deleting ${prefix} cookies should not fail in secure context`);+ }, `cookieStore.delete with ${prefix} name on secure origin`);+});++['__Host-', '__host-'].forEach(prefix => {+ promise_test(async testCase => {+ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set({ name: `${prefix}cookie-name`, value: 'cookie-value',+ domain: currentDomain }));+ }, `cookieStore.set with ${prefix} prefix and a domain option`);++ promise_test(async testCase => {+ await cookieStore.set({ name: `${prefix}cookie-name`, value: 'cookie-value',+ path: "/" });++ assert_equals(+ (await cookieStore.get(`${prefix}cookie-name`)).value, "cookie-value");++ await promise_rejects_js(testCase, TypeError,+ cookieStore.set( { name: `${prefix}cookie-name`, value: 'cookie-value',+ path: "/path" }));++ await cookieStore.delete({ name: `${prefix}cookie-name`});+ }, `cookieStore.set with ${prefix} prefix a path option`);+});++['__Host-Http-', '__host-http-', '__Http-', '__http-', ' __Http-', '\t__Http-',+ ' __Host-Http-', '\t__Host-Http-'].forEach(prefix => {+ promise_test(async testCase => {+ await promise_rejects_js(testCase, TypeError,+ cookieStore.set({ name: `${prefix}cookie-name`, value: 'cookie-value'}));+ }, `cookieStore.set with ${prefix} prefix rejects`);+});++promise_test(async testCase => {+ let exceptionThrown = false;+ try {+ await cookieStore.set(unescape('cookie-name%0D1'), 'cookie-value');+ } catch (e) {+ assert_equals (e.name, "TypeError", "cookieStore thrown an incorrect exception -");+ exceptionThrown = true;+ }+ assert_true(exceptionThrown, "No exception thrown.");+}, 'cookieStore.set with malformed name.');++['__Host-', '__Secure-', '__Http-', '__Host-Http-', ' __Host-', '\t__Host-', ' __Secure-',+ '\t__Secure-', ' __Http-', '\t__Http-', ' __Host-Http-', '\t__Host-Http-'].forEach(prefix => {+ promise_test(async testCase => {+ // Nameless cookies cannot have special prefixes+ await cookieStore.delete('');++ const currentUrl = new URL(self.location.href);+ const currentDomain = currentUrl.hostname;++ await promise_rejects_js(testCase, TypeError, cookieStore.set(+ { name: '',+ value: `${prefix}nameless-cookie`,+ domain: `.${currentDomain}` }));+ const cookie = await cookieStore.get('');+ assert_equals(cookie, null);+ }, `cookieStore.set a nameless cookie cannot have ${prefix} prefix`);+});diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.htmlnew file mode 100644index 00000000000..3f5930ab31c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>+<title>Cookie Store API: cookie encoding</title>+<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/encoding.https.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.jsnew file mode 100644index 00000000000..f5d2ca15e71--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/encoding.https.any.js@@ -0,0 +1,25 @@+// META: title=Cookie Store API: cookie encoding+// META: global=window,serviceworker+// META: script=resources/cookie-test-helpers.js++'use strict';++promise_test(async t => {+ await setCookieStringHttp('\uFEFFcookie=value; path=/');+ t.add_cleanup(async () => {+ await setCookieStringHttp('\uFEFFcookie=value; path=/; Max-Age=0');+ });+ const cookie = await cookieStore.get('\uFEFFcookie');+ assert_equals(cookie.name, '\uFEFFcookie');+ assert_equals(cookie.value, 'value');+}, 'BOM not stripped from name');++promise_test(async t => {+ await setCookieStringHttp('cookie=\uFEFFvalue; path=/');+ t.add_cleanup(async () => {+ await setCookieStringHttp('cookie=\uFEFFvalue; path=/; Max-Age=0');+ });+ const cookie = await cookieStore.get('cookie');+ assert_equals(cookie.name, 'cookie');+ assert_equals(cookie.value, '\uFEFFvalue');+}, 'BOM not stripped from value');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.htmlnew file mode 100644index 00000000000..f4838480a99--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.html@@ -0,0 +1,8 @@+<!doctype html>+<meta charset=utf-8>++<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<script src="resources/cookie-test-helpers.js"></script>+<div id=log></div>+<script src="../cookiestore/httponly_cookies.https.window.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.jsnew file mode 100644index 00000000000..f8e0861f0a9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/httponly_cookies.https.window.js@@ -0,0 +1,108 @@+// META: script=resources/cookie-test-helpers.js++'use strict';++promise_test(async t => {+ let eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp('HTTPONLY-cookie=value; path=/; httponly');+ t.add_cleanup(async () => {+ await setCookieStringHttp(`HTTPONLY-cookie=DELETED; path=/; httponly; Max-Age=0`);+ });+ assert_equals(+ await getCookieString(),+ undefined,+ 'HttpOnly cookie we wrote using HTTP in cookie jar' ++ ' is invisible to script');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTPONLY-cookie=value',+ 'HttpOnly cookie we wrote using HTTP in HTTP cookie jar');++ await setCookieStringHttp('HTTPONLY-cookie=new-value; path=/; httponly');+ assert_equals(+ await getCookieString(),+ undefined,+ 'HttpOnly cookie we overwrote using HTTP in cookie jar' ++ ' is invisible to script');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTPONLY-cookie=new-value',+ 'HttpOnly cookie we overwrote using HTTP in HTTP cookie jar');++ eventPromise = observeNextCookieChangeEvent();+ await setCookieStringHttp(+ 'HTTPONLY-cookie=DELETED; path=/; max-age=0; httponly');+ assert_equals(+ await getCookieString(),+ undefined,+ 'Empty cookie jar after HTTP cookie-clearing using max-age=0');+ assert_equals(+ await getCookieStringHttp(),+ undefined,+ 'Empty HTTP cookie jar after HTTP cookie-clearing using max-age=0');++ // HTTPONLY cookie changes should not have been observed; perform+ // a dummy change to verify that nothing else was queued up.+ await cookieStore.set('TEST', 'dummy');+ t.add_cleanup(async () => {+ await cookieStore.delete('TEST');+ });+ await verifyCookieChangeEvent(+ eventPromise, {changed: [{name: 'TEST', value: 'dummy'}]},+ 'HttpOnly cookie deletion was not observed');+}, 'HttpOnly cookies are not observed');+++cookie_test(async t => {+ document.cookie = 'cookie1=value1; path=/';+ document.cookie = 'cookie2=value2; path=/; httponly';+ document.cookie = 'cookie3=value3; path=/';+ assert_equals(+ await getCookieStringHttp(), 'cookie1=value1; cookie3=value3',+ 'Trying to store an HttpOnly cookie with document.cookie fails');+}, 'HttpOnly cookies can not be set by document.cookie');+++// Historical: Early iterations of the proposal included an httpOnly option.+cookie_test(async t => {+ await cookieStore.set('cookie1', 'value1');+ await cookieStore.set('cookie2', 'value2', {httpOnly: true});+ await cookieStore.set('cookie3', 'value3');+ assert_equals(+ await getCookieStringHttp(),+ 'cookie1=value1; cookie2=value2; cookie3=value3',+ 'httpOnly is not an option for CookieStore.set()');+}, 'HttpOnly cookies can not be set by CookieStore');++promise_test(async t => {+ await setCookieStringHttp('HTTPONLY-cookie=value; path=/; httponly');+ t.add_cleanup(async () => {+ await setCookieStringHttp(`HTTPONLY-cookie=DELETED; path=/; httponly; Max-Age=0`);+ });+ assert_equals(+ await getCookieString(),+ undefined,+ 'HttpOnly cookie we wrote using HTTP in cookie jar' ++ ' is invisible to script');+ assert_equals(+ await getCookieStringHttp(),+ 'HTTPONLY-cookie=value',+ 'HttpOnly cookie we wrote using HTTP in HTTP cookie jar');++ try {+ await cookieStore.set('HTTPONLY-cookie', 'dummy');+ } catch(e) {}++ assert_equals(+ await getCookieString(),+ undefined,+ 'HttpOnly cookie is not overwritten');++ try {+ await cookieStore.delete('HTTPONLY-cookie');+ } catch(e) {}++ assert_equals(await getCookieString(), undefined, 'HttpOnly cookie is not overwritten');++ assert_equals(await getCookieStringHttp(), 'HTTPONLY-cookie=value', 'HttpOnly cookie is not deleted');+}, 'HttpOnly cookies are not deleted/overwritten');diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.jsnew file mode 100644index 00000000000..2ffa714420b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.js@@ -0,0 +1,45 @@+// META: global=window,worker+// META: timeout=long+// META: script=/resources/WebIDLParser.js+// META: script=/resources/idlharness.js+// META: script=/service-workers/service-worker/resources/test-helpers.sub.js+'use strict';++// https://cookiestore.spec.whatwg.org/++idl_test(+ ['cookiestore'],+ ['service-workers', 'html', 'dom'],+ async (idl_array, t) => {+ const isServiceWorker = 'ServiceWorkerGlobalScope' in self+ && self instanceof ServiceWorkerGlobalScope;++ if (isServiceWorker) {+ idl_array.add_objects({+ ExtendableCookieChangeEvent: [+ 'new ExtendableCookieChangeEvent("cookiechange")'],+ ServiceWorkerGlobalScope: ['self'],+ });+ } else if (self.GLOBAL.isWindow()) {+ const registration = await service_worker_unregister_and_register(+ t, 'resources/empty_sw.js', 'resources/does/not/exist');+ t.add_cleanup(() => registration.unregister());++ // Global property referenced by idl_array.add_objects().+ self.registration = registration;++ idl_array.add_objects({+ CookieChangeEvent: ['new CookieChangeEvent("change")'],+ Window: ['self'],+ });+ }++ if (isServiceWorker || self.GLOBAL.isWindow()) {+ idl_array.add_objects({+ CookieStore: ['self.cookieStore'],+ CookieStoreManager: ['self.registration.cookies'],+ ServiceWorkerRegistration: ['self.registration'],+ });+ }+ }+);diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.html b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.htmlnew file mode 100644index 00000000000..930df6ba71a--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.html@@ -0,0 +1,9 @@+<!doctype html>+<meta charset=utf-8>+<meta name="timeout" content="long">+<script src="../resources/testharness.js"></script>+<script src="../resources/testharnessreport.js"></script>+<div id=log></div>+<script>+fetch_tests_from_worker(new Worker("../cookiestore/idlharness.https.any.worker.js"));+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.jsnew file mode 100644index 00000000000..06a07f53bc9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/idlharness.https.any.worker.js@@ -0,0 +1,12 @@++self.GLOBAL = {+ isWindow: function() { return false; },+ isWorker: function() { return true; },+ isShadowRealm: function() { return false; },+};+importScripts("/resources/testharness.js");+importScripts("/resources/WebIDLParser.js")+importScripts("/resources/idlharness.js")+importScripts("/service-workers/service-worker/resources/test-helpers.sub.js")+importScripts("/cookiestore/idlharness.https.any.js");+done();diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie-test-helpers.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie-test-helpers.jsnew file mode 100644index 00000000000..ac1edce9ca3--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie-test-helpers.js@@ -0,0 +1,231 @@+'use strict';++// TODO(jsbell): Once ServiceWorker is supported, add arbitrary path coverage.+const kPath = location.pathname.replace(/[^/]+$/, '');++// True when running in a document context as opposed to a worker context+const kHasDocument = typeof document !== 'undefined';++// True when running on unsecured 'http:' rather than secured 'https:'.+const kIsUnsecured = location.protocol !== 'https:';++const kCookieHelperCgi = 'resources/cookie_helper.py';++// Approximate async equivalent to the document.cookie getter but with+// important differences: optional additional getAll arguments are+// forwarded, and an empty cookie jar returns undefined.+//+// This is intended primarily for verification against expected cookie+// jar contents. It should produce more readable messages using+// assert_equals in failing cases than assert_object_equals would+// using parsed cookie jar contents and also allows expectations to be+// written more compactly.+async function getCookieString(...args) {+ const cookies = await cookieStore.getAll(...args);+ return cookies.length+ ? cookies.map(({name, value}) =>+ (name ? (name + '=') : '') + value).join('; ')+ : undefined;+}++// Approximate async equivalent to the document.cookie getter but from+// the server's point of view. Returns UTF-8 interpretation. Allows+// sub-path to be specified.+//+// Unlike document.cookie, this returns undefined when no cookies are+// present.+async function getCookieStringHttp(extraPath = null) {+ const url =+ kCookieHelperCgi + ((extraPath == null) ? '' : ('/' + extraPath));+ const response = await fetch(url, { credentials: 'include' });+ const text = await response.text();+ assert_equals(+ response.ok,+ true,+ 'CGI should have succeeded in getCookieStringHttp\n' + text);+ assert_equals(+ response.headers.get('content-type'),+ 'text/plain; charset=utf-8',+ 'CGI did not return UTF-8 text in getCookieStringHttp');+ if (text === '')+ return undefined;+ assert_equals(+ text.indexOf('cookie='),+ 0,+ 'CGI response did not begin with "cookie=" and was not empty: ' + text);+ return decodeURIComponent(text.replace(/^cookie=/, ''));+}++// Approximate async equivalent to the document.cookie getter but from+// the server's point of view. Returns binary string+// interpretation. Allows sub-path to be specified.+//+// Unlike document.cookie, this returns undefined when no cookies are+// present.+async function getCookieBinaryHttp(extraPath = null) {+ const url =+ kCookieHelperCgi ++ ((extraPath == null) ?+ '' :+ ('/' + extraPath)) + '?charset=iso-8859-1';+ const response = await fetch(url, { credentials: 'include' });+ const text = await response.text();+ assert_equals(+ response.ok,+ true,+ 'CGI should have succeeded in getCookieBinaryHttp\n' + text);+ assert_equals(+ response.headers.get('content-type'),+ 'text/plain; charset=iso-8859-1',+ 'CGI did not return ISO 8859-1 text in getCookieBinaryHttp');+ if (text === '')+ return undefined;+ assert_equals(+ text.indexOf('cookie='),+ 0,+ 'CGI response did not begin with "cookie=" and was not empty: ' + text);+ return unescape(text.replace(/^cookie=/, ''));+}++// Approximate async equivalent to the document.cookie setter but from+// the server's point of view.+async function setCookieStringHttp(setCookie) {+ const encodedSetCookie = encodeURIComponent(setCookie);+ const url = kCookieHelperCgi;+ const headers = new Headers();+ headers.set(+ 'content-type',+ 'application/x-www-form-urlencoded; charset=utf-8');+ const response = await fetch(+ url,+ {+ credentials: 'include',+ method: 'POST',+ headers: headers,+ body: 'set-cookie=' + encodedSetCookie,+ });+ const text = await response.text();+ assert_equals(+ response.ok,+ true,+ 'CGI should have succeeded in setCookieStringHttp set-cookie: ' ++ setCookie + '\n' + text);+ assert_equals(+ response.headers.get('content-type'),+ 'text/plain; charset=utf-8',+ 'CGI did not return UTF-8 text in setCookieStringHttp');+ assert_equals(+ text,+ 'set-cookie=' + encodedSetCookie,+ 'CGI did not faithfully echo the set-cookie value');+}++// Approximate async equivalent to the document.cookie setter but from+// the server's point of view. This version sets a binary cookie rather+// than a UTF-8 one.+async function setCookieBinaryHttp(setCookie) {+ const encodedSetCookie = escape(setCookie).split('/').join('%2F');+ const url = kCookieHelperCgi + '?charset=iso-8859-1';+ const headers = new Headers();+ headers.set(+ 'content-type',+ 'application/x-www-form-urlencoded; charset=iso-8859-1');+ const response = await fetch(url, {+ credentials: 'include',+ method: 'POST',+ headers: headers,+ body: 'set-cookie=' + encodedSetCookie+ });+ const text = await response.text();+ assert_equals(+ response.ok,+ true,+ 'CGI should have succeeded in setCookieBinaryHttp set-cookie: ' ++ setCookie + '\n' + text);+ assert_equals(+ response.headers.get('content-type'),+ 'text/plain; charset=iso-8859-1',+ 'CGI did not return Latin-1 text in setCookieBinaryHttp');+ assert_equals(+ text,+ 'set-cookie=' + encodedSetCookie,+ 'CGI did not faithfully echo the set-cookie value');+}++// Async document.cookie getter; converts '' to undefined which loses+// information in the edge case where a single ''-valued anonymous+// cookie is visible.+async function getCookieStringDocument() {+ if (!kHasDocument)+ throw 'document.cookie not available in this context';+ return String(document.cookie || '') || undefined;+}++// Async document.cookie setter+async function setCookieStringDocument(setCookie) {+ if (!kHasDocument)+ throw 'document.cookie not available in this context';+ document.cookie = setCookie;+}++// Observe the next 'change' event on the cookieStore. Typical usage:+//+// const eventPromise = observeNextCookieChangeEvent();+// await /* something that modifies cookies */+// await verifyCookieChangeEvent(+// eventPromise, {changed: [{name: 'name', value: 'value'}]});+//+function observeNextCookieChangeEvent() {+ if (!kHasDocument)+ throw 'cookiestore.onchange not available in this context';+ return new Promise(resolve => {+ cookieStore.addEventListener('change', e => resolve(e), {once: true});+ });+}++async function verifyCookieChangeEvent(eventPromise, expected, description) {+ description = description ? description + ': ' : '';+ expected = Object.assign({changed:[], deleted:[]}, expected);+ const event = await eventPromise;+ assert_equals(event.changed.length, expected.changed.length,+ description + 'number of changed cookies');+ for (let i = 0; i < event.changed.length; ++i) {+ assert_equals(event.changed[i].name, expected.changed[i].name,+ description + 'changed cookie name');+ assert_equals(event.changed[i].value, expected.changed[i].value,+ description + 'changed cookie value');+ }+ assert_equals(event.deleted.length, expected.deleted.length,+ description + 'number of deleted cookies');+ for (let i = 0; i < event.deleted.length; ++i) {+ assert_equals(event.deleted[i].name, expected.deleted[i].name,+ description + 'deleted cookie name');+ assert_equals(event.deleted[i].value, expected.deleted[i].value,+ description + 'deleted cookie value');+ }+}++// Helper function for promise_test with cookies; cookies+// named in these tests are cleared before/after the test+// body function is executed.+async function cookie_test(func, description) {++ // Wipe cookies used by tests before and after the test.+ async function deleteAllCookies() {+ const cookies = await cookieStore.getAll();+ await Promise.all(cookies.flatMap(+ ({name}) =>+ [cookieStore.delete(name),+ cookieStore.delete({name, partitioned: true}),+ ]));+ }++ return promise_test(async t => {+ await deleteAllCookies();+ try {+ return await func(t);+ } finally {+ await deleteAllCookies();+ }+ }, description);+}diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie_helper.py b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie_helper.pynew file mode 100644index 00000000000..71dd8b82ee7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/cookie_helper.py@@ -0,0 +1,84 @@+# -*- coding: utf-8 -*-++# Active wptserve handler for cookie operations.+#+# This must support the following requests:+#+# - GET with the following query parameters:+# - charset: (optional) character set for response (default: utf-8)+# A cookie: request header (if present) is echoed in the body with a+# cookie= prefix followed by the urlencoded bytes from the header.+# Used to inspect the cookie jar from an HTTP request header context.+# - POST with form-data in the body and the following query-or-form parameters:+# - set-cookie: (optional; repeated) echoed in the set-cookie: response+# header and also echoed in the body with a set-cookie= prefix+# followed by the urlencoded bytes from the parameter; multiple occurrences+# are CRLF-delimited.+# Used to set cookies from an HTTP response header context.+#+# The response has 200 status and content-type: text/plain; charset=<charset>+import encodings, re++from urllib.parse import parse_qs, quote++from wptserve.utils import isomorphic_decode, isomorphic_encode++# NOTE: These are intentionally very lax to permit testing+DISALLOWED_IN_COOKIE_NAME_RE = re.compile(br'[;\0-\x1f\x7f]')+DISALLOWED_IN_HEADER_RE = re.compile(br'[\0-\x1f\x7f]')++# Ensure common charset names do not end up with different+# capitalization or punctuation+CHARSET_OVERRIDES = {+ encodings.codecs.lookup(charset).name: charset+ for charset in (u'utf-8', u'iso-8859-1',)+}++def quote_str(cookie_str):+ return isomorphic_encode(quote(isomorphic_decode(cookie_str), u'', encoding=u'iso-8859-1'))++def parse_qs_str(query_str):+ args = parse_qs(isomorphic_decode(query_str), keep_blank_values=True, encoding=u'iso-8859-1')+ binary_args = {}+ for key, val in args.items():+ binary_args[isomorphic_encode(key)] = [isomorphic_encode(x) for x in val]+ return binary_args++def main(request, response):+ assert request.method in (+ u'GET',+ u'POST',+ ), u'request method was neither GET nor POST: %r' % request.method+ qd = (isomorphic_encode(request.url).split(b'#')[0].split(b'?', 1) + [b''])[1]+ if request.method == u'POST':+ qd += b'&' + request.body+ args = parse_qs_str(qd)++ charset = encodings.codecs.lookup([isomorphic_decode(x) for x in args.get(b'charset', [u'utf-8'])][-1]).name+ charset = CHARSET_OVERRIDES.get(charset, charset)+ headers = [(b'content-type', b'text/plain; charset=' + isomorphic_encode(charset))]+ body = []+ if request.method == u'POST':+ for set_cookie in args.get(b'set-cookie', []):+ if b'=' in set_cookie.split(b';', 1)[0]:+ name, rest = set_cookie.split(b'=', 1)+ assert re.search(+ DISALLOWED_IN_COOKIE_NAME_RE,+ name+ ) is None, b'name had disallowed characters: %r' % name+ else:+ rest = set_cookie+ assert re.search(+ DISALLOWED_IN_HEADER_RE,+ rest+ ) is None, b'rest had disallowed characters: %r' % rest+ headers.append((b'set-cookie', set_cookie))+ body.append(b'set-cookie=' + quote_str(set_cookie))++ else:+ cookie = request.headers.get(b'cookie')+ if cookie is not None:+ body.append(b'cookie=' + quote_str(cookie))+ body = b'\r\n'.join(body)+ headers.append((b'content-length', len(body)))+ return 200, headers, bodydiff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/empty_sw.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/empty_sw.jsnew file mode 100644index 00000000000..2b0ae226121--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/empty_sw.js@@ -0,0 +1 @@+// Empty service worker script.diff --git a/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/helpers.js b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/helpers.jsnew file mode 100644index 00000000000..8d5dddef657--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/cookiestore/resources/helpers.js@@ -0,0 +1,72 @@+/**+ * Promise based helper function who's return promise will resolve+ * once the iframe src has been loaded+ * @param {string} url the url to set the iframe src+ * @param {test} t a test object to add a cleanup function to+ * @return {Promise} when resolved, will return the iframe+ */+self.createIframe = (url, t) => new Promise(resolve => {+ const iframe = document.createElement('iframe');+ iframe.addEventListener('load', () => {resolve(iframe);}, {once: true});+ iframe.src = url;+ document.documentElement.appendChild(iframe);+ t.add_cleanup(() => iframe.remove());+});++/**+ * @description - Function unregisters any service workers in this scope+ * and then creates a new registration. The function returns+ * a promise that resolves when the registered service worker+ * becomes activated. The resolved promise yields the+ * service worker registration+ * @param {testCase} t - test case to add cleanup functions to+ */+self.createServiceWorker = async (t, sw_registration_name, scope_url) => {+ let registration = await navigator.serviceWorker.getRegistration(scope_url);+ if (registration)+ await registration.unregister();++ registration = await navigator.serviceWorker.register(sw_registration_name,+ {scope_url});+ t.add_cleanup(() => registration.unregister());++ return new Promise(resolve => {+ const serviceWorker = registration.installing || registration.active ||+ registration.waiting;+ serviceWorker.addEventListener('statechange', event => {+ if (event.target.state === 'activated') {+ resolve(serviceWorker);+ }+ });+ })+}++/**+ * Function that will return a promise that resolves when a message event+ * is fired. Returns a promise that resolves to the message that was received+ */+self.waitForMessage = () => new Promise(resolve => {+ window.addEventListener('message', event => {+ resolve(event.data);+ }, {once: true});+});++/**+ * Sends a message via MessageChannel and waits for the response+ * @param {*} message+ * @returns {Promise} resolves with the response payload+ */+self.sendMessageOverChannel = (message, target) => {+ return new Promise(function(resolve, reject) {+ const messageChannel = new MessageChannel();+ messageChannel.port1.onmessage = event => {+ if (event.data.error) {+ reject(event.data.error);+ } else {+ resolve(event.data);+ }+ };++ target.postMessage(message, [messageChannel.port2]);+ })+};diff --git a/Tests/LibWeb/Text/input/wpt-import/interfaces/cookiestore.idl b/Tests/LibWeb/Text/input/wpt-import/interfaces/cookiestore.idlnew file mode 100644index 00000000000..f059c9f9804--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/interfaces/cookiestore.idl@@ -0,0 +1,108 @@+// GENERATED CONTENT - DO NOT EDIT+// Content was automatically extracted by Reffy into webref+// (https://github.com/w3c/webref)+// Source: Cookie Store API Standard (https://cookiestore.spec.whatwg.org/)++[Exposed=(ServiceWorker,Window),+ SecureContext]+interface CookieStore : EventTarget {+ Promise<CookieListItem?> get(USVString name);+ Promise<CookieListItem?> get(optional CookieStoreGetOptions options = {});++ Promise<CookieList> getAll(USVString name);+ Promise<CookieList> getAll(optional CookieStoreGetOptions options = {});++ Promise<undefined> set(USVString name, USVString value);+ Promise<undefined> set(CookieInit options);++ Promise<undefined> delete(USVString name);+ Promise<undefined> delete(CookieStoreDeleteOptions options);++ [Exposed=Window]+ attribute EventHandler onchange;+};++dictionary CookieStoreGetOptions {+ USVString name;+ USVString url;+};++enum CookieSameSite {+ "strict",+ "lax",+ "none"+};++dictionary CookieInit {+ required USVString name;+ required USVString value;+ DOMHighResTimeStamp? expires = null;+ USVString? domain = null;+ USVString path = "/";+ CookieSameSite sameSite = "strict";+ boolean partitioned = false;+ long long? maxAge = null;+};++dictionary CookieStoreDeleteOptions {+ required USVString name;+ USVString? domain = null;+ USVString path = "/";+ boolean partitioned = false;+};++dictionary CookieListItem {+ USVString name;+ USVString value;+};++typedef sequence<CookieListItem> CookieList;++[Exposed=(ServiceWorker,Window),+ SecureContext]+interface CookieStoreManager {+ Promise<undefined> subscribe(sequence<CookieStoreGetOptions> subscriptions);+ Promise<sequence<CookieStoreGetOptions>> getSubscriptions();+ Promise<undefined> unsubscribe(sequence<CookieStoreGetOptions> subscriptions);+};++[Exposed=(ServiceWorker,Window)]+partial interface ServiceWorkerRegistration {+ [SameObject] readonly attribute CookieStoreManager cookies;+};++[Exposed=Window,+ SecureContext]+interface CookieChangeEvent : Event {+ constructor(DOMString type, optional CookieChangeEventInit eventInitDict = {});+ [SameObject] readonly attribute FrozenArray<CookieListItem> changed;+ [SameObject] readonly attribute FrozenArray<CookieListItem> deleted;+};++dictionary CookieChangeEventInit : EventInit {+ CookieList changed;+ CookieList deleted;+};++[Exposed=ServiceWorker]+interface ExtendableCookieChangeEvent : ExtendableEvent {+ constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict = {});+ [SameObject] readonly attribute FrozenArray<CookieListItem> changed;+ [SameObject] readonly attribute FrozenArray<CookieListItem> deleted;+};++dictionary ExtendableCookieChangeEventInit : ExtendableEventInit {+ CookieList changed;+ CookieList deleted;+};++[SecureContext]+partial interface Window {+ [SameObject] readonly attribute CookieStore cookieStore;+};++partial interface ServiceWorkerGlobalScope {+ [SameObject] readonly attribute CookieStore cookieStore;++ attribute EventHandler oncookiechange;+};