Diff
Modified: trunk/LayoutTests/ChangeLog (106336 => 106337)
--- trunk/LayoutTests/ChangeLog 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/ChangeLog 2012-01-31 07:37:28 UTC (rev 106337)
@@ -1,3 +1,21 @@
+2012-01-30 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: should be possible to step through all event listeners when event listener breakpoint is hit
+ https://bugs.webkit.org/show_bug.cgi?id=77331
+
+ Test that debugger will stop in each event listener when pausing on an event listener
+ breakpoint.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/debugger/step-through-event-listeners-expected.txt: Added.
+ * inspector/debugger/step-through-event-listeners.html: Added.
+ * platform/gtk/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wincairo/Skipped:
+
2011-01-30 Hayato Ito <[email protected]>
Attach light children after removing a shadow root.
Added: trunk/LayoutTests/inspector/debugger/step-through-event-listeners-expected.txt (0 => 106337)
--- trunk/LayoutTests/inspector/debugger/step-through-event-listeners-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/step-through-event-listeners-expected.txt 2012-01-31 07:37:28 UTC (rev 106337)
@@ -0,0 +1,32 @@
+Test that debugger will pause in all event listeners when corresponding breakpoint is set. Bug 77331.
+
+
+Debugger was enabled.
+
+Running: testClickBreakpoint
+Script execution paused.
+Call stack:
+ 0) listener3 (step-through-event-listeners.html:15)
+ 1) addListenerAndClick (step-through-event-listeners.html:26)
+ 2) (:1)
+Script execution resumed.
+Script execution paused.
+Call stack:
+ 0) listener1 (step-through-event-listeners.html:7)
+ 1) addListenerAndClick (step-through-event-listeners.html:26)
+ 2) (:1)
+Script execution resumed.
+Script execution paused.
+Call stack:
+ 0) listener2 (step-through-event-listeners.html:11)
+ 1) addListenerAndClick (step-through-event-listeners.html:26)
+ 2) (:1)
+Script execution resumed.
+Script execution paused.
+Call stack:
+ 0) listener3 (step-through-event-listeners.html:15)
+ 1) addListenerAndClick (step-through-event-listeners.html:26)
+ 2) (:1)
+Script execution resumed.
+Debugger was disabled.
+
Property changes on: trunk/LayoutTests/inspector/debugger/step-through-event-listeners-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/debugger/step-through-event-listeners.html (0 => 106337)
--- trunk/LayoutTests/inspector/debugger/step-through-event-listeners.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/step-through-event-listeners.html 2012-01-31 07:37:28 UTC (rev 106337)
@@ -0,0 +1,94 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function listener1()
+{
+}
+
+function listener2()
+{
+}
+
+function listener3()
+{
+}
+
+function addListenerAndClick()
+{
+ var element = document.getElementById("test");
+ element.addEventListener("click", listener1, true);
+ element.addEventListener("click", listener2, true);
+ document.body.addEventListener("click", listener3, true);
+ document.body.addEventListener("click", listener3, false);
+ element.click();
+}
+
+function test()
+{
+ var pane = WebInspector.panels.scripts.sidebarPanes.eventListenerBreakpoints;
+ InspectorTest.runDebuggerTestSuite([
+ function testClickBreakpoint(next)
+ {
+ pane._setBreakpoint("listener:click");
+ InspectorTest.waitUntilPaused(paused1);
+ InspectorTest.evaluateInPageWithTimeout("addListenerAndClick()");
+
+ function paused1(callFrames)
+ {
+ InspectorTest.captureStackTrace(callFrames);
+ InspectorTest.resumeExecution(resumed1);
+ }
+
+ function resumed1()
+ {
+ InspectorTest.waitUntilPaused(paused2);
+ }
+
+ function paused2(callFrames)
+ {
+ InspectorTest.captureStackTrace(callFrames);
+ InspectorTest.resumeExecution(resumed2);
+ }
+
+ function resumed2()
+ {
+ InspectorTest.waitUntilPaused(paused3);
+ }
+
+ function paused3(callFrames)
+ {
+ InspectorTest.captureStackTrace(callFrames);
+ InspectorTest.resumeExecution(resumed3);
+ }
+
+ function resumed3()
+ {
+ InspectorTest.waitUntilPaused(paused4);
+ }
+
+ function paused4(callFrames)
+ {
+ InspectorTest.captureStackTrace(callFrames);
+ pane._removeBreakpoint("listener:click");
+ InspectorTest.resumeExecution(next);
+ }
+ }
+ ]);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Test that debugger will pause in all event listeners when corresponding breakpoint is set.
+<a href="" 77331.</a>
+</p>
+
+<input type=button id="test"></input>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/debugger/step-through-event-listeners.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/gtk/Skipped (106336 => 106337)
--- trunk/LayoutTests/platform/gtk/Skipped 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/platform/gtk/Skipped 2012-01-31 07:37:28 UTC (rev 106337)
@@ -1100,6 +1100,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/debugger/dom-breakpoints.html
inspector/debugger/event-listener-breakpoints.html
+inspector/debugger/step-through-event-listeners.html
inspector/debugger/xhr-breakpoints.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/LayoutTests/platform/mac/Skipped (106336 => 106337)
--- trunk/LayoutTests/platform/mac/Skipped 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-01-31 07:37:28 UTC (rev 106337)
@@ -258,6 +258,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/debugger/dom-breakpoints.html
inspector/debugger/event-listener-breakpoints.html
+inspector/debugger/step-through-event-listeners.html
inspector/debugger/xhr-breakpoints.html
# Skipping newly added tests while I'm finding out what is wrong.
Modified: trunk/LayoutTests/platform/qt/Skipped (106336 => 106337)
--- trunk/LayoutTests/platform/qt/Skipped 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-01-31 07:37:28 UTC (rev 106337)
@@ -208,6 +208,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/debugger/dom-breakpoints.html
inspector/debugger/event-listener-breakpoints.html
+inspector/debugger/step-through-event-listeners.html
inspector/debugger/xhr-breakpoints.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/LayoutTests/platform/win/Skipped (106336 => 106337)
--- trunk/LayoutTests/platform/win/Skipped 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/platform/win/Skipped 2012-01-31 07:37:28 UTC (rev 106337)
@@ -1216,6 +1216,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/debugger/dom-breakpoints.html
inspector/debugger/event-listener-breakpoints.html
+inspector/debugger/step-through-event-listeners.html
inspector/debugger/xhr-breakpoints.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/LayoutTests/platform/wincairo/Skipped (106336 => 106337)
--- trunk/LayoutTests/platform/wincairo/Skipped 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/LayoutTests/platform/wincairo/Skipped 2012-01-31 07:37:28 UTC (rev 106337)
@@ -1752,6 +1752,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=43332
inspector/debugger/dom-breakpoints.html
inspector/debugger/event-listener-breakpoints.html
+inspector/debugger/step-through-event-listeners.html
inspector/debugger/xhr-breakpoints.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/Source/WebCore/ChangeLog (106336 => 106337)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 07:37:28 UTC (rev 106337)
@@ -1,3 +1,32 @@
+2012-01-30 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: should be possible to step through all event listeners when event listener breakpoint is hit
+ https://bugs.webkit.org/show_bug.cgi?id=77331
+
+ Inspector instrumentation is called before and after each event handler invokation.
+ In case inspector front-end is closed it is no-op, otherwise it may stop execution
+ on an event listener breakpoint.
+
+ Reviewed by Pavel Feldman.
+
+ Test: inspector/debugger/step-through-event-listeners.html
+
+ * dom/EventTarget.cpp:
+ (WebCore::EventTarget::fireEventListeners):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willDispatchEventImpl):
+ (WebCore::InspectorInstrumentation::willHandleEventImpl):
+ (WebCore):
+ (WebCore::InspectorInstrumentation::didHandleEventImpl):
+ (WebCore::InspectorInstrumentation::didDispatchEventImpl):
+ (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
+ (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ (WebCore::InspectorInstrumentation::willHandleEvent):
+ (WebCore):
+ (WebCore::InspectorInstrumentation::didHandleEvent):
+
2011-01-30 Hayato Ito <[email protected]>
Attach light children after removing a shadow root.
Modified: trunk/Source/WebCore/dom/EventTarget.cpp (106336 => 106337)
--- trunk/Source/WebCore/dom/EventTarget.cpp 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/Source/WebCore/dom/EventTarget.cpp 2012-01-31 07:37:28 UTC (rev 106337)
@@ -34,6 +34,7 @@
#include "Event.h"
#include "EventException.h"
+#include "InspectorInstrumentation.h"
#include <wtf/MainThread.h>
#include <wtf/StdLibExtras.h>
#include <wtf/Vector.h>
@@ -223,9 +224,12 @@
if (event->immediatePropagationStopped())
break;
+ ScriptExecutionContext* context = scriptExecutionContext();
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
// To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
// event listeners, even though that violates some versions of the DOM spec.
- registeredListener.listener->handleEvent(scriptExecutionContext(), event);
+ registeredListener.listener->handleEvent(context, event);
+ InspectorInstrumentation::didHandleEvent(cookie);
}
d->firingEventIterators.removeLast();
}
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (106336 => 106337)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-01-31 07:37:28 UTC (rev 106337)
@@ -279,8 +279,6 @@
InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
-
int timelineAgentId = 0;
InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
if (timelineAgent && eventHasListeners(event.type(), window, node, ancestors)) {
@@ -290,18 +288,25 @@
return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
}
-void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
+InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
{
+ pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event->type(), false);
+ return InspectorInstrumentationCookie(instrumentingAgents, 0);
+}
+
+void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
+{
cancelPauseOnNativeEvent(cookie.first);
+}
+void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
+{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didDispatchEvent();
}
InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
-
int timelineAgentId = 0;
InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
if (timelineAgent && window->hasEventListeners(event.type())) {
@@ -313,8 +318,6 @@
void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie)
{
- cancelPauseOnNativeEvent(cookie.first);
-
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didDispatchEvent();
}
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (106336 => 106337)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-01-31 06:36:02 UTC (rev 106336)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-01-31 07:37:28 UTC (rev 106337)
@@ -107,6 +107,8 @@
static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
static void didDispatchEvent(const InspectorInstrumentationCookie&);
+ static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
+ static void didHandleEvent(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
@@ -253,6 +255,8 @@
static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InstrumentingAgents*, XMLHttpRequest*);
static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, DOMWindow*, Node*, const Vector<EventContext>& ancestors);
+ static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
+ static void didHandleEventImpl(const InspectorInstrumentationCookie&);
static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
@@ -592,6 +596,25 @@
#endif
}
+inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
+{
+#if ENABLE(INSPECTOR)
+ FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
+ return willHandleEventImpl(instrumentingAgents, event);
+#endif
+ return InspectorInstrumentationCookie();
+}
+
+inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie)
+{
+#if ENABLE(INSPECTOR)
+ FAST_RETURN_IF_NO_FRONTENDS(void());
+ if (cookie.first)
+ didHandleEventImpl(cookie);
+#endif
+}
+
inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
{
#if ENABLE(INSPECTOR)