diff --git a/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.https.any.js b/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.https.any.js index 5055a42e5d39..264b6b7a7f74 100644 --- a/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.https.any.js +++ b/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.https.any.js @@ -147,3 +147,39 @@ promise_test(async testCase => { 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'); diff --git a/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.https.any.js b/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.https.any.js index a56032f03e20..8507682f8ec6 100644 --- a/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.https.any.js +++ b/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.https.any.js @@ -100,3 +100,37 @@ promise_test(async testCase => { 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'); diff --git a/testing/web-platform/tests/cookie-store/cookieStore_get_set_creation_url.sub.https.html b/testing/web-platform/tests/cookie-store/cookieStore_get_set_creation_url.sub.https.html new file mode 100644 index 000000000000..216885298a58 --- /dev/null +++ b/testing/web-platform/tests/cookie-store/cookieStore_get_set_creation_url.sub.https.html @@ -0,0 +1,86 @@ + + +