domain-attribute-matches-host.sub.https.html (1423B)
1 <!DOCTYPE html> 2 <head> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/cookies/resources/cookie-helper.sub.js"></script> 6 </head> 7 <body> 8 <script> 9 // 10 // Set-Cookie: domain-attribute-matches-host=b; Path=/; Domain={{host}} 11 // 12 const cookieName = "domain-attribute-matches-host"; 13 // Clean up cookie at the end to avoid interfering with subsequent tests. 14 add_completion_callback(tests => document.cookie = 15 `${cookieName}=0; Path=/; Domain={{host}}; expires=01-jan-1970 00:00:00 GMT`); 16 17 test(t => { 18 assert_dom_cookie(cookieName, "b", true); 19 }, "Domain={{host}} => available via `document.cookie`"); 20 21 async_test(t => { 22 fetch("/cookies/resources/list.py", { credentials: "include" }) 23 .then(t.step_func(r => r.json())) 24 .then(t.step_func_done(r => { 25 assert_equals(r[cookieName], "b"); 26 })) 27 .catch(_ => assert_unreached); 28 }, "Domain={{host}} => sent with same-origin requests."); 29 30 async_test(t => { 31 fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) 32 .then(t.step_func(r => r.json())) 33 .then(t.step_func_done(r => { 34 assert_equals(r[cookieName], "b"); 35 })) 36 .catch(_ => assert_unreached); 37 }, "Domain={{host}} => sent with subdomain requests."); 38 </script> 39 </body>