3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
9 function testFunction()
11 setTimeout(timeout, 0);
20 function sendAsyncXHR() { sendXHR(true); }
21 function sendSyncXHR() { sendXHR(false); }
23 function sendXHR(async)
25 var xhr = new XMLHttpRequest();
26 xhr.onreadystatechange = function()
28 if (xhr.readyState == 4) {
29 xhr.onreadystatechange = null;
33 function downloadEnd()
35 xhr.removeEventListener("loadend", downloadEnd, false);
40 xhr.upload.removeEventListener("loadend", uploadEnd, false);
43 function downloadProgress()
46 xhr.removeEventListener("progress", downloadProgress, false);
48 function uploadProgress()
51 xhr.upload.removeEventListener("progress", uploadProgress, false);
53 xhr.addEventListener("loadend", downloadEnd, false);
55 xhr.upload.addEventListener("loadend", uploadEnd, false);
56 xhr.addEventListener("progress", downloadProgress, false);
57 xhr.upload.addEventListener("progress", uploadProgress, false);
59 xhr.open("POST", "/foo?count=" + (++xhrCount) + "&now=" + Date.now(), async);
60 xhr.send(String(sendXHR));
65 var totalDebuggerStatements = 7;
66 var maxAsyncCallStackDepth = 4;
67 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
73 <body onload="runTest()">
75 Tests asynchronous call stacks for XHRs.