domain-attribute-host-with-and-without-leading-period.sub.https.html (1613B)
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-host-with-and-without-leading-period=b; Path=/; Domain=.{{host}} 11 // Set-Cookie: domain-attribute-host-with-and-without-leading-period=c; Path=/; Domain={{host}} 12 // 13 const cookieName = "domain-attribute-host-with-and-without-leading-period"; 14 // Clean up cookie at the end to avoid interfering with subsequent tests. 15 add_completion_callback(tests => document.cookie = 16 `${cookieName}=0; Path=/; Domain={{host}}; expires=01-jan-1970 00:00:00 GMT`); 17 18 test(t => { 19 assert_dom_cookie(cookieName, "c", true); 20 }, "Domain=.{{host}} => Second value available via `document.cookie`"); 21 22 async_test(t => { 23 fetch("/cookies/resources/list.py", { credentials: "include" }) 24 .then(t.step_func(r => r.json())) 25 .then(t.step_func_done(r => { 26 assert_equals(r[cookieName], "c"); 27 })) 28 .catch(_ => assert_unreached); 29 }, "Domain=.{{host}} => Second value sent with same-origin requests."); 30 31 async_test(t => { 32 fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) 33 .then(t.step_func(r => r.json())) 34 .then(t.step_func_done(r => { 35 assert_equals(r[cookieName], "c"); 36 })) 37 .catch(_ => assert_unreached); 38 }, "Domain=.{{host}} => Second value sent with subdomain requests."); 39 </script> 40 </body>