Chromium Code Reviews| Index: LayoutTests/inspector/debugger/async-callstack-xhrs.html |
| diff --git a/LayoutTests/inspector/debugger/async-callstack-xhrs.html b/LayoutTests/inspector/debugger/async-callstack-xhrs.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55670296daf47d839ab6908de73be9c2fe62b587 |
| --- /dev/null |
| +++ b/LayoutTests/inspector/debugger/async-callstack-xhrs.html |
| @@ -0,0 +1,77 @@ |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/debugger-test.js"></script> |
| +<script> |
| + |
| +function testFunction() |
| +{ |
| + setTimeout(timeout, 0); |
| +} |
| + |
| +function timeout() |
| +{ |
| + sendSyncXHR(); |
| + sendAsyncXHR(); |
| +} |
| + |
| +function sendAsyncXHR() { sendXHR(true); } |
| +function sendSyncXHR() { sendXHR(false); } |
| + |
| +function sendXHR(async) |
| +{ |
| + var count = sendXHR.__count = (sendXHR.__count || 0) + 1; |
|
yurys
2013/12/23 09:11:57
Why not simply put count into the global scope, or
aandrey
2013/12/23 12:09:38
Done.
|
| + var xhr = new XMLHttpRequest(); |
| + xhr.onreadystatechange = function() |
| + { |
| + if (xhr.readyState == 4) { |
| + xhr.onreadystatechange = null; |
| + debugger; |
| + } |
| + }; |
| + function downloadEnd() |
| + { |
| + xhr.removeEventListener("loadend", downloadEnd, false); |
| + debugger; |
| + } |
| + function uploadEnd() |
| + { |
| + xhr.upload.removeEventListener("loadend", uploadEnd, false); |
| + debugger; |
| + } |
| + function downloadProgress() |
| + { |
| + debugger; |
| + xhr.removeEventListener("progress", downloadProgress, false); |
| + } |
| + function uploadProgress() |
| + { |
| + debugger; |
| + xhr.upload.removeEventListener("progress", uploadProgress, false); |
| + } |
| + xhr.addEventListener("loadend", downloadEnd, false); |
| + if (async) { |
| + xhr.upload.addEventListener("loadend", uploadEnd, false); |
| + xhr.addEventListener("progress", downloadProgress, false); |
| + xhr.upload.addEventListener("progress", uploadProgress, false); |
| + } |
| + xhr.open("POST", "/foo?count=" + count + "&now=" + Date.now(), async); |
| + xhr.send(String(sendXHR)); |
| +} |
| + |
| +var test = function() |
| +{ |
| + var totalDebuggerStatements = 7; |
| + InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements); |
| +} |
| + |
| +</script> |
| +</head> |
| + |
| +<body onload="runTest()"> |
| +<p> |
| +Tests asynchronous call stacks for XHRs. |
| +</p> |
| + |
| +</body> |
| +</html> |