| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <meta charset=utf-8> |
| 3 | <title>XMLHttpRequest: The send() method: Fire an event named load (synchronous flag is unset)</title> |
| 4 | <script src="/resources/testharness.js"></script> |
| 5 | <script src="/resources/testharnessreport.js"></script> |
| Ms2ger | 91fef14 | 2014-11-01 09:24:37 | [diff] [blame] | 6 | <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onload" data-tested-assertations="../.." /> |
| 7 | <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-load" data-tested-assertations="../.." /> |
| 8 | <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::a[contains(@href,'#switch-done')]/.." /> |
| 9 | <link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol/li[6]" /> |
| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 10 | <div id="log"></div> |
| 11 | |
| 12 | <script> |
| 13 | var test = async_test(); |
| 14 | test.step(function() { |
| 15 | var client = new XMLHttpRequest(); |
| 16 | client.onload = test.step_func(function(e) { |
| 17 | assert_true(e instanceof ProgressEvent); |
| 18 | assert_equals(e.type, "load"); |
| 19 | assert_equals(client.readyState, 4); |
| 20 | test.done(); |
| 21 | }); |
| 22 | client.onreadystatechange = test.step_func(function() { |
| 23 | if (client.readyState !== 4) return; |
| 24 | |
| 25 | setTimeout(test.step_func(function() { |
| 26 | assert_unreached("Didn't get load event within 4ms of readystatechange==4"); |
| 27 | }), 4); |
| 28 | }); |
| 29 | client.open("GET", "resources/well-formed.xml"); |
| 30 | client.send(null); |
| 31 | }); |
| Hallvord R. M. Steen | 6bb5305 | 2012-11-09 10:47:49 | [diff] [blame] | 32 | </script> |