Changeset 106337 in webkit


Ignore:
Timestamp:
Jan 30, 2012 11:37:28 PM (12 years ago)
Author:
yurys@chromium.org
Message:

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

Source/WebCore:

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):

LayoutTests:

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:
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106336 r106337  
     12012-01-30  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: should be possible to step through all event listeners when event listener breakpoint is hit
     4        https://bugs.webkit.org/show_bug.cgi?id=77331
     5
     6        Test that debugger will stop in each event listener when pausing on an event listener
     7        breakpoint.
     8
     9        Reviewed by Pavel Feldman.
     10
     11        * inspector/debugger/step-through-event-listeners-expected.txt: Added.
     12        * inspector/debugger/step-through-event-listeners.html: Added.
     13        * platform/gtk/Skipped:
     14        * platform/mac/Skipped:
     15        * platform/qt/Skipped:
     16        * platform/win/Skipped:
     17        * platform/wincairo/Skipped:
     18
    1192011-01-30  Hayato Ito  <hayato@chromium.org>
    220
  • trunk/LayoutTests/platform/gtk/Skipped

    r105886 r106337  
    11011101inspector/debugger/dom-breakpoints.html
    11021102inspector/debugger/event-listener-breakpoints.html
     1103inspector/debugger/step-through-event-listeners.html
    11031104inspector/debugger/xhr-breakpoints.html
    11041105
  • trunk/LayoutTests/platform/mac/Skipped

    r105941 r106337  
    259259inspector/debugger/dom-breakpoints.html
    260260inspector/debugger/event-listener-breakpoints.html
     261inspector/debugger/step-through-event-listeners.html
    261262inspector/debugger/xhr-breakpoints.html
    262263
  • trunk/LayoutTests/platform/qt/Skipped

    r106106 r106337  
    209209inspector/debugger/dom-breakpoints.html
    210210inspector/debugger/event-listener-breakpoints.html
     211inspector/debugger/step-through-event-listeners.html
    211212inspector/debugger/xhr-breakpoints.html
    212213
  • trunk/LayoutTests/platform/win/Skipped

    r106188 r106337  
    12171217inspector/debugger/dom-breakpoints.html
    12181218inspector/debugger/event-listener-breakpoints.html
     1219inspector/debugger/step-through-event-listeners.html
    12191220inspector/debugger/xhr-breakpoints.html
    12201221
  • trunk/LayoutTests/platform/wincairo/Skipped

    r105500 r106337  
    17531753inspector/debugger/dom-breakpoints.html
    17541754inspector/debugger/event-listener-breakpoints.html
     1755inspector/debugger/step-through-event-listeners.html
    17551756inspector/debugger/xhr-breakpoints.html
    17561757
  • trunk/Source/WebCore/ChangeLog

    r106336 r106337  
     12012-01-30  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: should be possible to step through all event listeners when event listener breakpoint is hit
     4        https://bugs.webkit.org/show_bug.cgi?id=77331
     5
     6        Inspector instrumentation is called before and after each event handler invokation.
     7        In case inspector front-end is closed it is no-op, otherwise it may stop execution
     8        on an event listener breakpoint.
     9
     10        Reviewed by Pavel Feldman.
     11
     12        Test: inspector/debugger/step-through-event-listeners.html
     13
     14        * dom/EventTarget.cpp:
     15        (WebCore::EventTarget::fireEventListeners):
     16        * inspector/InspectorInstrumentation.cpp:
     17        (WebCore::InspectorInstrumentation::willDispatchEventImpl):
     18        (WebCore::InspectorInstrumentation::willHandleEventImpl):
     19        (WebCore):
     20        (WebCore::InspectorInstrumentation::didHandleEventImpl):
     21        (WebCore::InspectorInstrumentation::didDispatchEventImpl):
     22        (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
     23        (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
     24        * inspector/InspectorInstrumentation.h:
     25        (InspectorInstrumentation):
     26        (WebCore::InspectorInstrumentation::willHandleEvent):
     27        (WebCore):
     28        (WebCore::InspectorInstrumentation::didHandleEvent):
     29
    1302011-01-30  Hayato Ito  <hayato@chromium.org>
    231
  • trunk/Source/WebCore/dom/EventTarget.cpp

    r98388 r106337  
    3535#include "Event.h"
    3636#include "EventException.h"
     37#include "InspectorInstrumentation.h"
    3738#include <wtf/MainThread.h>
    3839#include <wtf/StdLibExtras.h>
     
    224225            break;
    225226
     227        ScriptExecutionContext* context = scriptExecutionContext();
     228        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
    226229        // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
    227230        // event listeners, even though that violates some versions of the DOM spec.
    228         registeredListener.listener->handleEvent(scriptExecutionContext(), event);
     231        registeredListener.listener->handleEvent(context, event);
     232        InspectorInstrumentation::didHandleEvent(cookie);
    229233    }
    230234    d->firingEventIterators.removeLast();
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r106030 r106337  
    280280InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
    281281{
    282     pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
    283 
    284282    int timelineAgentId = 0;
    285283    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
     
    291289}
    292290
     291InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
     292{
     293    pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event->type(), false);
     294    return InspectorInstrumentationCookie(instrumentingAgents, 0);
     295}
     296
     297void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
     298{
     299    cancelPauseOnNativeEvent(cookie.first);
     300}
     301
    293302void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
    294303{
    295     cancelPauseOnNativeEvent(cookie.first);
    296 
    297304    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    298305        timelineAgent->didDispatchEvent();
     
    301308InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window)
    302309{
    303     pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
    304 
    305310    int timelineAgentId = 0;
    306311    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
     
    314319void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie)
    315320{
    316     cancelPauseOnNativeEvent(cookie.first);
    317 
    318321    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
    319322        timelineAgent->didDispatchEvent();
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r105415 r106337  
    108108    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
    109109    static void didDispatchEvent(const InspectorInstrumentationCookie&);
     110    static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
     111    static void didHandleEvent(const InspectorInstrumentationCookie&);
    110112    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
    111113    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
     
    254256    static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
    255257    static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, DOMWindow*, Node*, const Vector<EventContext>& ancestors);
     258    static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
     259    static void didHandleEventImpl(const InspectorInstrumentationCookie&);
    256260    static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
    257261    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
     
    593597}
    594598
     599inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
     600{
     601#if ENABLE(INSPECTOR)
     602    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     603    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
     604        return willHandleEventImpl(instrumentingAgents, event);
     605#endif
     606    return InspectorInstrumentationCookie();
     607}
     608
     609inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie)
     610{
     611#if ENABLE(INSPECTOR)
     612    FAST_RETURN_IF_NO_FRONTENDS(void());
     613    if (cookie.first)
     614        didHandleEventImpl(cookie);
     615#endif
     616}
     617
    595618inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
    596619{
Note: See TracChangeset for help on using the changeset viewer.