| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password from interactive session</title> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 7 | <script src="/common/utils.js"></script> |
| Ms2ger | 91fef14 | 2014-11-01 09:24:37 | [diff] [blame] | 8 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 9 | </head> |
| 10 | <body> |
| 11 | <p>Please follow these steps to complete the test:</p> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 12 | <script>var user = token();</script> |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 13 | <ol> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 14 | <li>Load <a href="resources/auth3/auth.py">page</a> and authenticate with username "<script>document.write(user)</script>" and password "pass"</li> |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 15 | <li>Go back</li> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 16 | <li>Click <button onclick="location.href = location.href + '?dotest&user=' + user">complete test</button></li> |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 17 | </ol> |
| 18 | <div id="log"></div> |
| 19 | <script> |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 20 | if (location.search.indexOf('?dotest') != -1) { |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 21 | test(function() { |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 22 | var user = location.search.slice(location.search.indexOf('&user=') + 6), |
| 23 | client = new XMLHttpRequest(), |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 24 | urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 25 | client.open("GET", location.protocol+'//'+urlstart + "resources/auth3/auth.py", false) |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 26 | client.send(null) |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 27 | assert_equals(client.responseText, user + "\n" + 'pass') |
| Hallvord Reiar M. Steen | 210320d | 2013-05-23 10:51:23 | [diff] [blame] | 28 | assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') |
| 29 | }, document.title) |
| 30 | } |
| 31 | </script> |
| 32 | </body> |
| 33 | </html> |