Index: LayoutTests/inspector/sources/debugger/event-listener-breakpoints.html |
diff --git a/LayoutTests/inspector/sources/debugger/event-listener-breakpoints.html b/LayoutTests/inspector/sources/debugger/event-listener-breakpoints.html |
index dba4a734722654248e934121f12faf6e4cc47dad..c3ade10a218a559b86b86764c832f38839241e96 100644 |
--- a/LayoutTests/inspector/sources/debugger/event-listener-breakpoints.html |
+++ b/LayoutTests/inspector/sources/debugger/event-listener-breakpoints.html |
@@ -21,6 +21,29 @@ function timerFired() |
return 0; |
} |
+function addLoadListeners() |
+{ |
+ var xhr = new XMLHttpRequest(); |
+ xhr.onload = loadCallback; |
+ xhr.onerror = loadCallback; |
+ xhr.open("GET", "http://localhost/", true); |
+ |
+ var img = new Image(); |
+ img.onload = sendXHR; |
+ img.onerror = sendXHR; |
+ img.src = "foo/bar/dummy"; |
+ |
+ function sendXHR() |
+ { |
+ xhr.send(); |
+ } |
+} |
+ |
+function loadCallback() |
+{ |
+ return 0; |
+} |
+ |
function test() |
{ |
WebInspector.inspectorView.showPanel("sources"); |
@@ -32,16 +55,17 @@ function test() |
InspectorTest.waitUntilPaused(paused); |
InspectorTest.evaluateInPageWithTimeout("addListenerAndClick()"); |
- function paused(callFrames) |
+ function paused(callFrames, reason, breakpointIds, asyncStackTrace, auxData) |
{ |
InspectorTest.captureStackTrace(callFrames); |
+ printEventTargetName(auxData); |
pane._removeBreakpoint("listener:click"); |
InspectorTest.resumeExecution(resumed); |
} |
function resumed() |
{ |
- InspectorTest.evaluateInPage("addListenerAndClick())", next); |
+ InspectorTest.evaluateInPage("addListenerAndClick()", next); |
} |
}, |
@@ -57,8 +81,39 @@ function test() |
pane._removeBreakpoint("instrumentation:timerFired"); |
InspectorTest.resumeExecution(next); |
} |
+ }, |
+ |
+ function testLoadBreakpointOnXHR(next) |
+ { |
+ DOMDebuggerAgent.setEventListenerBreakpoint("load", "xmlHTTPrequest"); // test case-insensitive match |
+ DOMDebuggerAgent.setEventListenerBreakpoint("error", "XMLHttpRequest"); |
+ InspectorTest.waitUntilPaused(paused); |
+ InspectorTest.evaluateInPageWithTimeout("addLoadListeners()"); |
+ |
+ function paused(callFrames, reason, breakpointIds, asyncStackTrace, auxData) |
+ { |
+ InspectorTest.captureStackTrace(callFrames); |
+ printEventTargetName(auxData); |
+ DOMDebuggerAgent.removeEventListenerBreakpoint("load", "XMLHttpRequest"); |
+ DOMDebuggerAgent.removeEventListenerBreakpoint("error", "xmlHTTPrequest"); |
+ InspectorTest.resumeExecution(resumed); |
+ } |
+ |
+ function resumed() |
+ { |
+ InspectorTest.evaluateInPage("addLoadListeners()", next); |
+ } |
} |
]); |
+ |
+ function printEventTargetName(auxData) |
+ { |
+ var targetName = auxData && auxData.targetName; |
+ if (targetName) |
+ InspectorTest.addResult("Event target: " + targetName); |
+ else |
+ InspectorTest.addResult("FAIL: No event target name received!"); |
+ } |
} |
</script> |