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