| 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 <script> | 6 <script> |
| 7 var c = new PasswordCredential({ | 7 var c = new PasswordCredential({ |
| 8 id: 'id', | 8 id: 'id', |
| 9 password: 'pencil', | 9 password: 'pencil', |
| 10 name: 'name', | 10 name: 'name', |
| 11 iconURL: 'https://example.com/icon.png' | 11 iconURL: 'https://example.com/icon.png' |
| 12 }); | 12 }); |
| 13 | 13 |
| 14 promise_test(_ => { | 14 promise_test(_ => { |
| 15 var r = new Request('/', { credentials: c, body: 'this is a body', method: '
POST' }); |
| 16 return r.text().then(t => assert_equals(t, "")); |
| 17 }, "Body ignored in presence of a PasswordCredential"); |
| 18 |
| 19 promise_test(_ => { |
| 20 var r = new Request('/', { credentials: 'include', body: 'this is a body', m
ethod: 'POST' }); |
| 21 return r.text().then(t => assert_equals(t, "this is a body")); |
| 22 }, "Body present if 'credentials' is not a PasswordCredential"); |
| 23 |
| 24 promise_test(_ => { |
| 15 var r = new Request('/', { credentials: c, method: 'POST' }); | 25 var r = new Request('/', { credentials: c, method: 'POST' }); |
| 16 var clone = r.clone(); | 26 var clone = r.clone(); |
| 17 assert_equals(r.credentials, "password"); | 27 assert_equals(r.credentials, "password"); |
| 18 assert_equals(clone.credentials, "password"); | 28 assert_equals(clone.credentials, "password"); |
| 19 return Promise.all([ | 29 return Promise.all([ |
| 20 r.text().then(t => assert_equals(t, "")), | 30 r.text().then(t => assert_equals(t, "")), |
| 21 clone.text().then(t => assert_equals(t, "")) | 31 clone.text().then(t => assert_equals(t, "")) |
| 22 ]); | 32 ]); |
| 23 }, "Creating/cloning a 'Request' does not expose the credential."); | 33 }, "Creating/cloning a 'Request' does not expose the credential."); |
| 24 | 34 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 285 |
| 276 return fetch("./resources/echo-raw-post.php", { credentials: credential, met
hod: "POST" }) | 286 return fetch("./resources/echo-raw-post.php", { credentials: credential, met
hod: "POST" }) |
| 277 .then(function (r) { | 287 .then(function (r) { |
| 278 return r.text(); | 288 return r.text(); |
| 279 }) | 289 }) |
| 280 .then(function (t) { | 290 .then(function (t) { |
| 281 assert_equals(t, 'a=1&a=2&a=3&username=id&password=pencil'); | 291 assert_equals(t, 'a=1&a=2&a=3&username=id&password=pencil'); |
| 282 }); | 292 }); |
| 283 }, "'additionalData': URLSearchParams properties are properly injected (ordering
matters)."); | 293 }, "'additionalData': URLSearchParams properties are properly injected (ordering
matters)."); |
| 284 </script> | 294 </script> |
| OLD | NEW |