send-no-response-event-loadstart.htm (1749B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadstart" data-tested-assertations="/../.." /> 5 <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadstart" data-tested-assertations="/../.." /> 6 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="/following-sibling::ol/li[9]/ol/li[2]" /> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="/following-sibling::ol/li[1]" /> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <title>XMLHttpRequest: The send() method: Fire a progress event named loadstart (no response entity body and the state is LOADING)</title> 11 </head> 12 13 <body> 14 <div id="log"></div> 15 16 <script type="text/javascript"> 17 var test = async_test(); 18 19 test.step(function() 20 { 21 var xhr = new XMLHttpRequest(); 22 23 xhr.onreadystatechange = function() 24 { 25 test.step(function() 26 { 27 if (xhr.readyState == 3) 28 { 29 assert_equals(xhr.response, ""); 30 } 31 else if (xhr.readyState == 4) 32 { 33 assert_unreached("loadstart event did not fire in LOADING state!"); 34 } 35 }); 36 }; 37 38 xhr.onloadstart = function() 39 { 40 test.step(function() { test.done("Test done!"); }); 41 }; 42 43 xhr.open("POST", "./resources/content.py", true); 44 xhr.send(); 45 }); 46 </script> 47 </body> 48 </html>