send-sync-no-response-event-load.htm (1554B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onload" data-tested-assertations="../.." /> 5 <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-load" data-tested-assertations="../.." /> 6 <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')]/.." /> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol/li[1] following::ol/li[6]" /> 8 <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="/following::ol/li[3]" /> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <title>XMLHttpRequest: The send() method: Fire an event named load (no response entity body and the synchronous flag is set)</title> 12 </head> 13 14 <body> 15 <div id="log"></div> 16 17 <script type="text/javascript"> 18 test(function() 19 { 20 var xhr = new XMLHttpRequest(); 21 var pass = false; 22 23 xhr.onload = function(e) 24 { 25 assert_true(e instanceof ProgressEvent); 26 assert_equals(e.type, "load"); 27 pass = true; 28 }; 29 30 xhr.open("POST", "./resources/content.py", false); 31 xhr.send(); 32 33 assert_equals(xhr.response, ""); 34 assert_true(pass); 35 }); 36 </script> 37 </body> 38 </html>