| OLD | NEW |
| (Empty) |
| 1 importScripts("worker-pre.js"); | |
| 2 | |
| 3 function log(message) { | |
| 4 postMessage("log " + message); | |
| 5 } | |
| 6 | |
| 7 function done() { | |
| 8 postMessage("DONE"); | |
| 9 } | |
| 10 | |
| 11 function eventHandler(e) { | |
| 12 log(e.type); | |
| 13 done(); | |
| 14 } | |
| 15 | |
| 16 function init() { | |
| 17 try { | |
| 18 var xhr = new XMLHttpRequest(); | |
| 19 xhr.ontimeout = eventHandler; | |
| 20 xhr.onabort = eventHandler; | |
| 21 xhr.onerror = eventHandler; | |
| 22 xhr.onload = eventHandler; | |
| 23 | |
| 24 xhr.timeout = 100000; | |
| 25 xhr.open("GET", "../../../resources/load-and-stall.php?name=../resources
/test.mp4&stallAt=0&stallFor=1000&mimeType=video/mp4", true); | |
| 26 | |
| 27 // Defer overriding timeout | |
| 28 setTimeout(function() { | |
| 29 xhr.timeout = 400; | |
| 30 }, 200); | |
| 31 | |
| 32 setTimeout(function() { | |
| 33 xhr.abort(); | |
| 34 }, 1000); | |
| 35 | |
| 36 xhr.send(); | |
| 37 } catch (e) { | |
| 38 log(e); | |
| 39 done(); | |
| 40 } | |
| 41 }; | |
| OLD | NEW |