OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="/resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <script src="/resources/testharnessreport.js"></script> | 3 <script src="/resources/testharnessreport.js"></script> |
4 <script src="/cookies/resources/testharness-helpers.js"></script> | 4 <script src="/cookies/resources/testharness-helpers.js"></script> |
5 <script> | 5 <script> |
6 // Set cookies on ORIGINAL_HOST, then move ourselves to TEST_ROOT so | 6 // Set cookies on ORIGINAL_HOST, then move ourselves to TEST_ROOT so |
7 // we can verify registrable domain and cross-origin behavior. | 7 // we can verify registrable domain and cross-origin behavior. |
8 if (window.location.hostname == ORIGINAL_HOST) { | 8 if (window.location.hostname == "127.0.0.1") { |
| 9 window.location.hostname = ORIGINAL_HOST; |
| 10 } else if (window.location.hostname == ORIGINAL_HOST) { |
9 clearKnownCookies(); | 11 clearKnownCookies(); |
10 document.cookie = STRICT_DOM + "=1; SameSite=Strict; Max-Age=100; path=/"; | 12 document.cookie = STRICT_DOM + "=1; SameSite=Strict; Max-Age=100; path=/"; |
11 document.cookie = LAX_DOM + "=1; SameSite=Lax; Max-Age=100; path=/"; | 13 document.cookie = LAX_DOM + "=1; SameSite=Lax; Max-Age=100; path=/"; |
12 document.cookie = NORMAL_DOM + "=1; Max-Age=100; path=/"; | 14 document.cookie = NORMAL_DOM + "=1; Max-Age=100; path=/"; |
13 window.location.hostname = TEST_HOST; | 15 window.location.hostname = TEST_HOST; |
14 } else { | 16 } else { |
15 test(_ => { | 17 test(_ => { |
16 clearKnownCookies(); | 18 clearKnownCookies(); |
17 assert_equals(document.cookie, ""); | 19 assert_equals(document.cookie, ""); |
18 | 20 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return fetch("http://" + ORIGINAL_HOST + ":8000/cookies/resources/echo-j
son.php", {"credentials": "include"}) | 68 return fetch("http://" + ORIGINAL_HOST + ":8000/cookies/resources/echo-j
son.php", {"credentials": "include"}) |
67 .then(r => r.json()) | 69 .then(r => r.json()) |
68 .then(j => { | 70 .then(j => { |
69 assert_equals(j[STRICT_DOM], undefined, "strict"); | 71 assert_equals(j[STRICT_DOM], undefined, "strict"); |
70 assert_equals(j[LAX_DOM], undefined, "lax"); | 72 assert_equals(j[LAX_DOM], undefined, "lax"); |
71 assert_equals(j[NORMAL_DOM], "1", "normal"); | 73 assert_equals(j[NORMAL_DOM], "1", "normal"); |
72 }); | 74 }); |
73 }, "'" + ORIGINAL_HOST + "' is not same-site with '" + TEST_HOST + "', so sa
mesite cookies are not sent."); | 75 }, "'" + ORIGINAL_HOST + "' is not same-site with '" + TEST_HOST + "', so sa
mesite cookies are not sent."); |
74 } | 76 } |
75 </script> | 77 </script> |
OLD | NEW |