worker_bug1300552.js (675B)
1 function info(msg) { 2 postMessage({ type: "info", msg }); 3 } 4 5 function ok(a, msg) { 6 postMessage({ type: "check", what: !!a, msg }); 7 } 8 9 function finish() { 10 postMessage({ type: "finish" }); 11 } 12 13 info("Creating XHR..."); 14 var xhr = new XMLHttpRequest(); 15 xhr.open("POST", "echo.sjs"); 16 xhr.responseType = "arraybuffer"; 17 18 info("Sending some data..."); 19 var data = new Array(256).join("1234567890ABCDEF"); 20 xhr.send({ 21 toString() { 22 return data; 23 }, 24 }); 25 26 var aborted = false; 27 28 xhr.onprogress = function () { 29 info("Onprogress, we abort!"); 30 aborted = true; 31 xhr.abort(); 32 }; 33 34 xhr.onloadend = function () { 35 ok(aborted, "We are still alive after an abort()!"); 36 finish(); 37 };