OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script> |
| 6 |
| 7 var xhrCount = 0; |
| 8 |
| 9 function testFunction() |
| 10 { |
| 11 setTimeout(timeout, 0); |
| 12 } |
| 13 |
| 14 function timeout() |
| 15 { |
| 16 sendSyncXHR(); |
| 17 sendAsyncXHR(); |
| 18 } |
| 19 |
| 20 function sendAsyncXHR() { sendXHR(true); } |
| 21 function sendSyncXHR() { sendXHR(false); } |
| 22 |
| 23 function sendXHR(async) |
| 24 { |
| 25 var xhr = new XMLHttpRequest(); |
| 26 xhr.onreadystatechange = function() |
| 27 { |
| 28 if (xhr.readyState == 4) { |
| 29 xhr.onreadystatechange = null; |
| 30 debugger; |
| 31 } |
| 32 }; |
| 33 function downloadEnd() |
| 34 { |
| 35 xhr.removeEventListener("loadend", downloadEnd, false); |
| 36 debugger; |
| 37 } |
| 38 function uploadEnd() |
| 39 { |
| 40 xhr.upload.removeEventListener("loadend", uploadEnd, false); |
| 41 debugger; |
| 42 } |
| 43 function downloadProgress() |
| 44 { |
| 45 debugger; |
| 46 xhr.removeEventListener("progress", downloadProgress, false); |
| 47 } |
| 48 function uploadProgress() |
| 49 { |
| 50 debugger; |
| 51 xhr.upload.removeEventListener("progress", uploadProgress, false); |
| 52 } |
| 53 xhr.addEventListener("loadend", downloadEnd, false); |
| 54 if (async) { |
| 55 xhr.upload.addEventListener("loadend", uploadEnd, false); |
| 56 xhr.addEventListener("progress", downloadProgress, false); |
| 57 xhr.upload.addEventListener("progress", uploadProgress, false); |
| 58 } |
| 59 xhr.open("POST", "/foo?count=" + (++xhrCount) + "&now=" + Date.now(), async)
; |
| 60 xhr.send(String(sendXHR)); |
| 61 } |
| 62 |
| 63 var test = function() |
| 64 { |
| 65 var totalDebuggerStatements = 7; |
| 66 var maxAsyncCallStackDepth = 4; |
| 67 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); |
| 68 } |
| 69 |
| 70 </script> |
| 71 </head> |
| 72 |
| 73 <body onload="runTest()"> |
| 74 <p> |
| 75 Tests asynchronous call stacks for XHRs. |
| 76 </p> |
| 77 |
| 78 </body> |
| 79 </html> |
OLD | NEW |