diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html')
-rw-r--r-- | testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html b/testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html new file mode 100644 index 0000000000..44776ca629 --- /dev/null +++ b/testing/web-platform/tests/cookies/domain/domain-attribute-missing.sub.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/cookies/resources/cookie-helper.sub.js"></script> +</head> +<body> + <script> + // + // Set-Cookie: domain-attribute-missing=b; Path=/ + // + const cookieName = "domain-attribute-missing"; + // Clean up cookie at the end to avoid interfering with subsequent tests. + add_completion_callback(tests => document.cookie = + `${cookieName}=0; Path=/; expires=01-jan-1970 00:00:00 GMT`); + + test(t => { + assert_dom_cookie(cookieName, "b", true); + }, "No domain attribute => available via `document.cookie`"); + + async_test(t => { + fetch("/cookies/resources/list.py", { credentials: "include" }) + .then(t.step_func(r => r.json())) + .then(t.step_func_done(r => { + assert_equals(r[cookieName], "b"); + })) + .catch(_ => assert_unreached); + }, "No domain attribute => sent with same-origin requests."); + + async_test(t => { + fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) + .then(t.step_func(r => r.json())) + .then(t.step_func_done(r => { + assert_equals(r[cookieName], undefined); + })) + .catch(_ => assert_unreached); + }, "No domain attribute => not sent with subdomain requests."); + </script> +</body> |