| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Credential Manager: PasswordCredential basics.</title> | 2 <title>Credential Manager: PasswordCredential basics.</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="/serviceworker/resources/interfaces.js"></script> | 5 <script src="/serviceworker/resources/interfaces.js"></script> |
| 6 <body> | 6 <body> |
| 7 <input type=hidden id=thing value=sekrit> | 7 <input type=hidden id=thing value=sekrit> |
| 8 <script> | 8 <script> |
| 9 add_completion_callback(() => { | 9 add_completion_callback(() => { |
| 10 if (window.testRunner) | 10 if (window.testRunner) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 var r = new Request('/', { credentials: c, method: 'POST' }); | 32 var r = new Request('/', { credentials: c, method: 'POST' }); |
| 33 var clone = r.clone(); | 33 var clone = r.clone(); |
| 34 assert_equals(r.credentials, "password"); | 34 assert_equals(r.credentials, "password"); |
| 35 assert_equals(clone.credentials, "password"); | 35 assert_equals(clone.credentials, "password"); |
| 36 return Promise.all([ | 36 return Promise.all([ |
| 37 r.text().then(t => assert_equals(t, "")), | 37 r.text().then(t => assert_equals(t, "")), |
| 38 clone.text().then(t => assert_equals(t, "")) | 38 clone.text().then(t => assert_equals(t, "")) |
| 39 ]); | 39 ]); |
| 40 }, "Creating/cloning a 'Request' does not expose the credential."); | 40 }, "Creating/cloning a 'Request' does not expose the credential."); |
| 41 | 41 |
| 42 promise_test(_ => { | 42 test(_ => { |
| 43 assert_throws(new TypeError(), _ => new Request("https://cross-origin.exampl
e.test/", { credentials: c, method: 'POST' })); | 43 assert_throws(new TypeError(), _ => new Request("https://cross-origin.exampl
e.test/", { credentials: c, method: 'POST' })); |
| 44 assert_throws(new TypeError(), _ => new Request("/", { credentials: c, metho
d: 'GET' })); | 44 assert_throws(new TypeError(), _ => new Request("/", { credentials: c, metho
d: 'GET' })); |
| 45 assert_throws(new TypeError(), _ => new Request("/", { credentials: c, metho
d: 'HEAD' })); | 45 assert_throws(new TypeError(), _ => new Request("/", { credentials: c, metho
d: 'HEAD' })); |
| 46 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', method: 'POST' })); | 46 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', method: 'POST' })); |
| 47 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', method: 'GET' })); | 47 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', method: 'GET' })); |
| 48 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', body: "Body", method: 'GET' })); | 48 assert_throws(new TypeError(), _ => new Request("/", { credentials: 'passwor
d', body: "Body", method: 'GET' })); |
| 49 }, "Creating a 'Request' throws in various ways."); | 49 }, "Creating a 'Request' throws in various ways."); |
| 50 | 50 |
| 51 promise_test(function() { | 51 promise_test(function() { |
| 52 return fetch("./resources/echo-post.php", { credentials: c, method: "POST" }
) | 52 return fetch("./resources/echo-post.php", { credentials: c, method: "POST" }
) |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 return fetch("./resources/echo-post.php", { credentials: c, method:
"POST" }) | 401 return fetch("./resources/echo-post.php", { credentials: c, method:
"POST" }) |
| 402 .then(resp => resp.json()) | 402 .then(resp => resp.json()) |
| 403 .then(j => { | 403 .then(j => { |
| 404 assert_equals(j.username, 'id'); | 404 assert_equals(j.username, 'id'); |
| 405 assert_equals(j.password, 'pencil') | 405 assert_equals(j.password, 'pencil') |
| 406 assert_equals(j.csrf_token, 'sekrit') | 406 assert_equals(j.csrf_token, 'sekrit') |
| 407 }); | 407 }); |
| 408 }); | 408 }); |
| 409 }, 'fetch() after get() with additionalData from DOM'); | 409 }, 'fetch() after get() with additionalData from DOM'); |
| 410 </script> | 410 </script> |
| OLD | NEW |