send-sync-no-response-event-order.htm (2674B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: The send() method: event order when synchronous flag is set and there is no response entity body</title> 5 <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadstart" data-tested-assertations="../.." /> 6 <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadend" data-tested-assertations="../.." /> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadstart" 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/#the-send()-method" data-tested-assertations="following-sibling::ol[1]/li[9]" /> 10 <link rel="help" href="https://xhr.spec.whatwg.org/#same-origin-request-steps" data-tested-assertations="following::DL[1]/DT[1]"/> 11 <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[11] following::a[contains(@href,'#switch-done')]/.." /> 12 <link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[3] following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[7]" /> 13 <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::ol/li[3]" /> 14 <script src="/resources/testharness.js"></script> 15 <script src="/resources/testharnessreport.js"></script> 16 </head> 17 18 <body> 19 <div id="log"></div> 20 21 <script type="text/javascript"> 22 test(function () { 23 var xhr = new XMLHttpRequest(); 24 var expect = [4, "load", "loadend"]; 25 var actual = []; 26 27 xhr.onreadystatechange = function() 28 { 29 if (xhr.readyState == 4) 30 { 31 actual.push(xhr.readyState); 32 } 33 }; 34 35 xhr.onloadstart = function(e){ actual.push(e.type); }; 36 xhr.onload = function(e){ actual.push(e.type); }; 37 xhr.onloadend = function(e){ actual.push(e.type); }; 38 39 xhr.upload.onload = function(e){ actual.push("upload." + e.type); }; 40 xhr.upload.onloadstart = function(e){ actual.push("upload." + e.type); }; 41 xhr.upload.onloadend = function(e){ actual.push("upload." + e.type);}; 42 43 xhr.open("POST", "./resources/content.py", false); 44 xhr.send(); 45 46 assert_equals(xhr.response, ""); 47 assert_array_equals(actual, expect); 48 }); 49 </script> 50 </body> 51 </html>