send-response-upload-event-loadend.htm (1568B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadend" data-tested-assertations="../.." /> 5 <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadend" data-tested-assertations="../.." /> 6 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::a[contains(@href,'#make-upload-progress-notifications')]/.. following::ol[1]/li[8]" /> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#make-upload-progress-notifications" data-tested-assertations="following::ul[1]/li[2]/ol[1]/li[4]" /> 8 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <title>XMLHttpRequest: The send() method: Fire a progress event named loadend on the XMLHttpRequestUpload (synchronous flag is unset)</title> 12 </head> 13 14 <body> 15 <div id="log"></div> 16 17 <script type="text/javascript"> 18 var test = async_test(); 19 20 test.step(function() 21 { 22 var xhr = new XMLHttpRequest(); 23 24 xhr.upload.onloadend = function(e) 25 { 26 test.step(function() 27 { 28 assert_true(e instanceof ProgressEvent); 29 assert_equals(e.type, "loadend"); 30 assert_equals(e.target, xhr.upload); 31 test.done(); 32 }); 33 }; 34 35 xhr.open("POST", "./resources/content.py", true); 36 xhr.send("Test Message"); 37 }); 38 </script> 39 </body> 40 </html>