Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-async / async-callstack-xhrs.html
blob34e2baf221d4aa4d27cced9f5ce22bae634afcf5
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>
7 var xhrCount = 0;
9 function testFunction()
11 setTimeout(timeout, 0);
14 function timeout()
16 sendSyncXHR();
17 sendAsyncXHR();
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;
30 debugger;
33 function downloadEnd1()
35 xhr.removeEventListener("loadend", downloadEnd1, false);
36 debugger;
38 function downloadEnd2()
40 xhr.removeEventListener("loadend", downloadEnd2, true);
41 debugger;
43 function uploadEnd()
45 xhr.upload.removeEventListener("loadend", uploadEnd, false);
46 debugger;
48 function downloadProgress()
50 debugger;
51 xhr.removeEventListener("progress", downloadProgress, false);
53 function uploadProgress()
55 debugger;
56 xhr.upload.removeEventListener("progress", uploadProgress, false);
58 xhr.addEventListener("loadend", downloadEnd1, false);
59 xhr.addEventListener("loadend", downloadEnd2, true);
60 if (async) {
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));
69 var test = function()
71 var totalDebuggerStatements = 9;
72 var maxAsyncCallStackDepth = 4;
73 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
76 </script>
77 </head>
79 <body onload="runTest()">
80 <p>
81 Tests asynchronous call stacks for XHRs.
82 </p>
84 </body>
85 </html>