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 downloadEnd1()
35 xhr.removeEventListener("loadend", downloadEnd1, false);
38 function downloadEnd2()
40 xhr.removeEventListener("loadend", downloadEnd2, true);
45 xhr.upload.removeEventListener("loadend", uploadEnd, false);
48 function downloadProgress()
51 xhr.removeEventListener("progress", downloadProgress, false);
53 function uploadProgress()
56 xhr.upload.removeEventListener("progress", uploadProgress, false);
58 xhr.addEventListener("loadend", downloadEnd1, false);
59 xhr.addEventListener("loadend", downloadEnd2, true);
61 xhr.upload.addEventListener("loadend", uploadEnd, false);
62 xhr.addEventListener("progress", downloadProgress, false);
63 xhr.upload.addEventListener("progress", uploadProgress, false);
65 xhr.open("POST", "/foo?count=" + (++xhrCount) + "&now=" + Date.now(), async);
66 xhr.send(String(sendXHR));
71 var totalDebuggerStatements = 9;
72 var maxAsyncCallStackDepth = 4;
73 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
79 <body onload="runTest()">
81 Tests asynchronous call stacks for XHRs.