abort-upload-event-loadend.any.js (971B)
1 var test = async_test("XMLHttpRequest: The abort() method: Fire a progress event named loadend on the XMLHttpRequestUpload object"); 2 3 test.step(function() 4 { 5 var xhr = new XMLHttpRequest(); 6 7 xhr.onloadstart = function() 8 { 9 test.step(function () 10 { 11 if (xhr.readyState == 1) 12 { 13 xhr.abort(); 14 } 15 }); 16 }; 17 18 xhr.upload.onloadend = function(e) 19 { 20 test.step(function() 21 { 22 assert_true(e instanceof ProgressEvent); 23 assert_equals(e.type, "loadend"); 24 assert_equals(e.target, xhr.upload); 25 test.done(); 26 }); 27 }; 28 29 xhr.open("POST", "./resources/content.py", true); 30 xhr.send("Test Message"); 31 });