| 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) { | |
| 31 alert("Error " + e.target.status + " occurred while receiving the document."); | |
| 32 } | |
| 33 | |
| 34 var shouldNotify = false; | |
| 35 | |
| 36 if (window.testRunner) { | 30 if (window.testRunner) { |
| 37 testRunner.dumpAsText(); | 31 testRunner.dumpAsText(); |
| 38 testRunner.waitUntilDone(); | 32 testRunner.waitUntilDone(); |
| 39 } | 33 } |
| 40 | 34 |
| 41 var req = new XMLHttpRequest(); | 35 var req = new XMLHttpRequest(); |
| 36 req.responseType = "blob"; |
| 42 req.onprogress = onProgress; | 37 req.onprogress = onProgress; |
| 43 req.open("GET", "resources/1251.html", true); | 38 req.open("GET", "resources/get.txt", true); |
| 44 req.send(null); | 39 req.send(null); |
| 45 </script> | 40 </script> |
| 46 </body> | 41 </body> |
| 47 </html> | 42 </html> |
| OLD | NEW |