| <!DOCTYPE html> |
| <title>Credential Manager: PasswordCredential basics.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| var c = new PasswordCredential({ |
| id: 'id', |
| password: 'pencil', |
| name: 'name', |
| iconURL: 'https://example.com/icon.png' |
| }); |
| |
| promise_test(function() { |
| return fetch("./resources/redirect-to-echo-post.php", { credentials: c, method: "POST" }) |
| .then(resp => { |
| assert_equals(resp.url, 'http://127.0.0.1:8000/credentialmanager/resources/redirect-to-echo-post.php'); |
| assert_equals(resp.type, 'opaqueredirect'); |
| assert_equals(resp.status, 0); |
| return resp.text() |
| }) |
| .then(t => assert_equals(t, '')); |
| }, "Same-origin redirect"); |
| |
| promise_test(function() { |
| return fetch("./resources/redirect-to-echo-post.php?origin=http://example.test:8000", { credentials: c, method: "POST" }) |
| .then(resp => { |
| assert_equals(resp.url, 'http://127.0.0.1:8000/credentialmanager/resources/redirect-to-echo-post.php?origin=http://example.test:8000'); |
| assert_equals(resp.type, 'opaqueredirect'); |
| assert_equals(resp.status, 0); |
| return resp.text() |
| }) |
| .then(t => assert_equals(t, '')); |
| }, "Cross-origin redirect"); |
| </script> |