OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Credential Manager: PasswordCredential same-registrable-domain fetching.<
/title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 // Move to a subdomain of `example.test` for testing: |
| 7 if (document.location.hostname == "127.0.0.1") { |
| 8 document.location.hostname = "subdomain.example.test"; |
| 9 } else { |
| 10 var c = new PasswordCredential({ |
| 11 id: 'id', |
| 12 password: 'pencil', |
| 13 name: 'name', |
| 14 iconURL: 'https://example.com/icon.png' |
| 15 }); |
| 16 |
| 17 promise_test(function() { |
| 18 var r1 = new Request('./resources/echo-post.php', { credentials: c, meth
od: "POST" }); |
| 19 return fetch(r1) |
| 20 .then(resp => resp.json()) |
| 21 .then(j => { |
| 22 assert_equals(j.username, 'id'); |
| 23 assert_equals(j.password, 'pencil'); |
| 24 }); |
| 25 }, "Same-origin fetch."); |
| 26 |
| 27 promise_test(function() { |
| 28 var r1 = new Request('http://example.test:8000/credentialmanager/resourc
es/echo-post.php', { credentials: c, method: "POST" }); |
| 29 return fetch(r1) |
| 30 .then(resp => resp.json()) |
| 31 .then(j => { |
| 32 assert_equals(j.username, 'id'); |
| 33 assert_equals(j.password, 'pencil'); |
| 34 }); |
| 35 }, "Fetch from `subdomain.example.test` => `example.test`."); |
| 36 |
| 37 promise_test(function() { |
| 38 var r1 = new Request('http://other.example.test:8000/credentialmanager/r
esources/echo-post.php', { credentials: c, method: "POST" }); |
| 39 return fetch(r1) |
| 40 .then(resp => resp.json()) |
| 41 .then(j => { |
| 42 assert_equals(j.username, 'id'); |
| 43 assert_equals(j.password, 'pencil'); |
| 44 }); |
| 45 }, "Fetch from `subdomain.example.test` => `other.example.test`."); |
| 46 |
| 47 promise_test(function() { |
| 48 var r1 = new Request('http://other.subdomain.example.test:8000/credentia
lmanager/resources/echo-post.php', { credentials: c, method: "POST" }); |
| 49 return fetch(r1) |
| 50 .then(resp => resp.json()) |
| 51 .then(j => { |
| 52 assert_equals(j.username, 'id'); |
| 53 assert_equals(j.password, 'pencil'); |
| 54 }); |
| 55 }, "Fetch from `subdomain.example.test` => `other.subdomain.example.test`.")
; |
| 56 } |
| 57 </script> |
| 58 |
| 59 |
OLD | NEW |