Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head/> | 2 <head/> |
| 3 <body> | 3 <body> |
| 4 <p> Test case for bug 13596: Implement .onprogress handler on XMLHttpRequest obj ects to support progressive download content length information </p> | 4 <p> .onprogress handler on XMLHttpRequest objects with response type 'blob' work s to support progressive download content length information </p> |
| 5 <p> You should see type, bubble, cancelable, eventPhase, target and current targ et.</p> | 5 <p> You should see type, bubble, cancelable, eventPhase, target and current targ et.</p> |
| 6 <script type="text/javascript"> | 6 <script type="text/javascript"> |
| 7 function log (msg) | 7 function log (msg) |
| 8 { | 8 { |
| 9 document.body.appendChild(document.createTextNode(msg)); | 9 document.body.appendChild(document.createTextNode(msg)); |
| 10 insertNewLine(); | 10 insertNewLine(); |
| 11 } | 11 } |
| 12 | 12 |
| 13 function insertNewLine() | 13 function insertNewLine() |
| 14 { | 14 { |
| 15 document.body.appendChild(document.createElement("br")); | 15 document.body.appendChild(document.createElement("br")); |
| 16 } | 16 } |
| 17 | 17 |
| 18 function onProgress(e) { | 18 function onProgress(e) { |
| 19 log("Type: " + e.type); | 19 log("Type: " + e.type); |
| 20 log("Bubble: " + e.bubbles); | 20 log("Bubble: " + e.bubbles); |
| 21 log("Cancelable: " + e.cancelable); | 21 log("Cancelable: " + e.cancelable); |
| 22 log("EventPhase: " + e.eventPhase); | 22 log("EventPhase: " + e.eventPhase); |
| 23 log("Target: " + e.target); | 23 log("Target: " + e.target); |
| 24 log("Current target: " + e.currentTarget); | 24 log("Current target: " + e.currentTarget); |
| 25 e.currentTarget.onprogress = null; | 25 e.currentTarget.onprogress = null; |
| 26 if (window.testRunner) | 26 if (window.testRunner) |
| 27 testRunner.notifyDone(); | 27 testRunner.notifyDone(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function onError(e) { | 30 function onError(e) { |
| 31 alert("Error " + e.target.status + " occurred while receiving the document."); | 31 alert("Error " + e.target.status + " occurred while receiving the document."); |
| 32 } | 32 } |
|
tyoshino (SeeGerritForStatus)
2013/09/24 10:28:31
this is not used (original file doesn't use it, to
yusukesuzuki
2013/09/24 11:13:39
Done.
| |
| 33 | 33 |
| 34 var shouldNotify = false; | 34 var shouldNotify = false; |
|
tyoshino (SeeGerritForStatus)
2013/09/24 10:28:31
ditto
yusukesuzuki
2013/09/24 11:13:39
Done.
| |
| 35 | 35 |
| 36 if (window.testRunner) { | 36 if (window.testRunner) { |
| 37 testRunner.dumpAsText(); | 37 testRunner.dumpAsText(); |
| 38 testRunner.waitUntilDone(); | 38 testRunner.waitUntilDone(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 var req = new XMLHttpRequest(); | 41 var req = new XMLHttpRequest(); |
| 42 req.responseType = 'blob'; | |
| 42 req.onprogress = onProgress; | 43 req.onprogress = onProgress; |
| 43 req.open("GET", "resources/1251.html", true); | 44 req.open("GET", "resources/get.txt", true); |
| 44 req.send(null); | 45 req.send(null); |
| 45 </script> | 46 </script> |
| 46 </body> | 47 </body> |
| 47 </html> | 48 </html> |
| OLD | NEW |