Index: LayoutTests/inspector/sources/debugger/event-listener-breakpoints-xhr.html |
diff --git a/LayoutTests/inspector/sources/debugger/event-listener-breakpoints-xhr.html b/LayoutTests/inspector/sources/debugger/event-listener-breakpoints-xhr.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d46bb3f7bf06dba34ffea56c73297d55f35f1458 |
--- /dev/null |
+++ b/LayoutTests/inspector/sources/debugger/event-listener-breakpoints-xhr.html |
@@ -0,0 +1,97 @@ |
+<html> |
+<head> |
+<script src="../../../http/tests/inspector/inspector-test.js"></script> |
+<script src="../../../http/tests/inspector/debugger-test.js"></script> |
+<script> |
+ |
+function testFunction() |
+{ |
+ sendXHR(); |
+} |
+ |
+function sendXHR() |
+{ |
+ var xhr = new XMLHttpRequest(); |
+ xhr.onreadystatechange = function() |
+ { |
+ xhr.onreadystatechange = null; |
+ }; |
+ function downloadEnd() |
+ { |
+ xhr.removeEventListener("loadend", downloadEnd, false); |
+ } |
+ function uploadEnd() |
+ { |
+ xhr.upload.removeEventListener("loadend", uploadEnd, false); |
+ } |
+ function downloadProgress() |
+ { |
+ xhr.removeEventListener("progress", downloadProgress, false); |
+ } |
+ function uploadProgress() |
+ { |
+ xhr.upload.removeEventListener("progress", uploadProgress, false); |
+ } |
+ function loadCallback() |
+ { |
+ xhr.onload = null; |
+ xhr.onerror = null; |
+ } |
+ xhr.onload = loadCallback; |
+ xhr.onerror = loadCallback; |
+ xhr.addEventListener("loadend", downloadEnd, false); |
+ xhr.addEventListener("progress", downloadProgress, false); |
+ xhr.upload.addEventListener("loadend", uploadEnd, false); |
+ xhr.upload.addEventListener("progress", uploadProgress, false); |
+ xhr.open("POST", "http://localhost/?now=" + Date.now(), true); |
+ xhr.send(String(sendXHR)); |
+} |
+ |
+function test() |
+{ |
+ var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints; |
+ var xhrTargetNames = ["XMLHttpRequest", "XMLHttpRequestUpload"]; |
+ |
+ InspectorTest.setQuiet(true); |
+ InspectorTest.startDebuggerTest(step1); |
+ |
+ function step1() |
+ { |
+ pane._setBreakpoint("listener:load"); |
+ pane._setBreakpoint("listener:error"); |
+ pane._setBreakpoint("listener:loadend", xhrTargetNames); |
+ pane._setBreakpoint("listener:progress", xhrTargetNames); |
+ pane._setBreakpoint("listener:readystatechange", xhrTargetNames); |
+ InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
+ } |
+ |
+ var totalBreaks = 6; |
+ var callStacksOutput = []; |
+ function didPause(callFrames, reason, breakpointIds, asyncStackTrace, auxData) |
+ { |
+ --totalBreaks; |
+ auxData = auxData || {}; |
+ var result = InspectorTest.captureStackTraceIntoString(callFrames) + "\n"; |
+ result += "Event target: " + auxData["targetName"] + "\n"; |
+ |
+ callStacksOutput.push(result); |
+ if (totalBreaks) { |
+ InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause)); |
+ } else { |
+ InspectorTest.addResult("Captured call stacks in no particular order:"); |
+ callStacksOutput.sort(); |
+ InspectorTest.addResults(callStacksOutput); |
+ InspectorTest.completeDebuggerTest(); |
+ } |
+ } |
+} |
+ |
+</script> |
+</head> |
+ |
+<body onload="runTest()"> |
+<p> |
+Tests event listener breakpoints on XHRs. |
+</p> |
+</body> |
+</html> |