| Austin James Ahlstrom | 90360fd | 2017-08-01 12:52:37 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Testing a basic asynchronous CORS XHR request</title> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | <script src="/common/get-host-info.sub.js"></script> |
| 8 | </head> |
| 9 | <body> |
| 10 | <script type="text/javascript"> |
| 11 | async_test(function(test) { |
| 12 | const xhr = new XMLHttpRequest; |
| 13 | |
| 14 | xhr.onreadystatechange = test.step_func(function() { |
| 15 | if (xhr.readyState == xhr.DONE) { |
| 16 | assert_equals(xhr.responseText, "PASS: Cross-domain access allowed."); |
| 17 | test.done(); |
| 18 | } |
| 19 | }); |
| 20 | |
| 21 | xhr.onerror = test.unreached_func("FAIL: Network error."); |
| 22 | |
| 23 | xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + |
| 24 | "/XMLHttpRequest/resources/access-control-basic-allow.py", true); |
| 25 | xhr.send(); |
| 26 | }, "Basic async cross-origin XHR request"); |
| 27 | </script> |
| 28 | </body> |
| 29 | </html> |