abort-event-loadend.any.js (848B)
1 // META: title=XMLHttpRequest: The abort() method: Fire a progress event named loadend 2 3 var test = async_test(function(test) 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.onloadend = function(e) 19 { 20 test.step(function() 21 { 22 assert_true(e instanceof ProgressEvent); 23 assert_equals(e.type, "loadend"); 24 test.done(); 25 }); 26 }; 27 28 xhr.open("GET", "resources/content.py", true); 29 xhr.send(); 30 });