Chromium Code Reviews| 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 = 1000; | |
|
tyoshino (SeeGerritForStatus)
2014/05/12 09:21:17
ditto
| |
| 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(); | |
|
tyoshino (SeeGerritForStatus)
2014/05/12 09:21:17
4 space indentation
| |
| 34 }, 1000); | |
| 35 | |
| 36 xhr.send(); | |
| 37 | |
|
tyoshino (SeeGerritForStatus)
2014/05/12 09:21:17
remove this blank line
| |
| 38 } catch (e) { | |
| 39 log(e); | |
| 40 done(); | |
| 41 } | |
| 42 }; | |
| OLD | NEW |