Changeset 106347 in webkit


Ignore:
Timestamp:
Jan 31, 2012 2:05:34 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: DOMDebugger.setEventListenerBreakpoint should accept regular DOM event names.
https://bugs.webkit.org/show_bug.cgi?id=77409

Reviewed by Yury Semikhatsky.

  • inspector/Inspector.json:
  • inspector/InspectorDOMDebuggerAgent.cpp:

(WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint):
(WebCore):
(WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::setBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):

  • inspector/InspectorDOMDebuggerAgent.h:

(InspectorDOMDebuggerAgent):

  • inspector/InspectorInstrumentation.cpp:

(WebCore::InspectorInstrumentation::didInstallTimerImpl):
(WebCore::InspectorInstrumentation::didRemoveTimerImpl):
(WebCore::InspectorInstrumentation::willHandleEventImpl):
(WebCore::InspectorInstrumentation::willFireTimerImpl):
(WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):

  • inspector/InspectorInstrumentation.h:

(InspectorInstrumentation):

  • inspector/front-end/BreakpointsSidebarPane.js:

(WebInspector.EventListenerBreakpointsSidebarPane.prototype._setBreakpoint):
(WebInspector.EventListenerBreakpointsSidebarPane.prototype._removeBreakpoint):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106342 r106347  
     12012-01-31  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: DOMDebugger.setEventListenerBreakpoint should accept regular DOM event names.
     4        https://bugs.webkit.org/show_bug.cgi?id=77409
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/Inspector.json:
     9        * inspector/InspectorDOMDebuggerAgent.cpp:
     10        (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint):
     11        (WebCore):
     12        (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint):
     13        (WebCore::InspectorDOMDebuggerAgent::setBreakpoint):
     14        (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint):
     15        (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint):
     16        (WebCore::InspectorDOMDebuggerAgent::removeBreakpoint):
     17        (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
     18        * inspector/InspectorDOMDebuggerAgent.h:
     19        (InspectorDOMDebuggerAgent):
     20        * inspector/InspectorInstrumentation.cpp:
     21        (WebCore::InspectorInstrumentation::didInstallTimerImpl):
     22        (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
     23        (WebCore::InspectorInstrumentation::willHandleEventImpl):
     24        (WebCore::InspectorInstrumentation::willFireTimerImpl):
     25        (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):
     26        * inspector/InspectorInstrumentation.h:
     27        (InspectorInstrumentation):
     28        * inspector/front-end/BreakpointsSidebarPane.js:
     29        (WebInspector.EventListenerBreakpointsSidebarPane.prototype._setBreakpoint):
     30        (WebInspector.EventListenerBreakpointsSidebarPane.prototype._removeBreakpoint):
     31
    1322012-01-31  Pablo Flouret  <pablof@motorola.com>
    233
  • trunk/Source/WebCore/inspector/Inspector.json

    r106246 r106347  
    22692269                "name": "setEventListenerBreakpoint",
    22702270                "parameters": [
    2271                     { "name": "eventName", "type": "string", "description": "Event name to stop on (any DOM event will do)." }
     2271                    { "name": "eventName", "type": "string", "description": "DOM Event name to stop on (any DOM event will do)." }
    22722272                ],
    22732273                "description": "Sets breakpoint on particular DOM event."
     
    22792279                ],
    22802280                "description": "Removes breakpoint on particular DOM event."
     2281            },
     2282            {
     2283                "name": "setInstrumentationBreakpoint",
     2284                "parameters": [
     2285                    { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
     2286                ],
     2287                "description": "Sets breakpoint on particular native event.",
     2288                "hidden": true
     2289            },
     2290            {
     2291                "name": "removeInstrumentationBreakpoint",
     2292                "parameters": [
     2293                    { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
     2294                ],
     2295                "description": "Sets breakpoint on particular native event.",
     2296                "hidden": true
    22812297            },
    22822298            {
  • trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp

    r101754 r106347  
    3939#include "InspectorDOMAgent.h"
    4040#include "InspectorDebuggerAgent.h"
     41#include "InspectorInstrumentation.h"
    4142#include "InspectorState.h"
    4243#include "InspectorValues.h"
     
    5354};
    5455
     56static const char* const listenerEventCategoryType = "listener:";
     57static const char* const instrumentationEventCategoryType = "instrumentation:";
     58
    5559static const char* const domNativeBreakpointType = "DOM";
    5660static const char* const eventListenerNativeBreakpointType = "EventListener";
     
    125129void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, const String& eventName)
    126130{
     131    setBreakpoint(error, String(listenerEventCategoryType) + eventName);
     132}
     133
     134void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString* error, const String& eventName)
     135{
     136    setBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
     137}
     138
     139void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString* error, const String& eventName)
     140{
    127141    if (eventName.isEmpty()) {
    128142        *error = "Event name is empty";
     
    136150
    137151void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error, const String& eventName)
     152{
     153    removeBreakpoint(error, String(listenerEventCategoryType) + eventName);
     154}
     155
     156void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString* error, const String& eventName)
     157{
     158    removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
     159}
     160
     161void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString* error, const String& eventName)
    138162{
    139163    if (eventName.isEmpty()) {
     
    334358}
    335359
    336 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous)
    337 {
    338     String fullEventName = categoryType + ':' + eventName;
     360void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous)
     361{
     362    String fullEventName = (isDOMEvent ? listenerEventCategoryType : instrumentationEventCategoryType) + eventName;
    339363    RefPtr<InspectorObject> eventListenerBreakpoints = m_state->getObject(DOMDebuggerAgentState::eventListenerBreakpoints);
    340364    if (eventListenerBreakpoints->find(fullEventName) == eventListenerBreakpoints->end())
  • trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h

    r101754 r106347  
    6767    void setEventListenerBreakpoint(ErrorString*, const String& eventName);
    6868    void removeEventListenerBreakpoint(ErrorString*, const String& eventName);
     69    void setInstrumentationBreakpoint(ErrorString*, const String& eventName);
     70    void removeInstrumentationBreakpoint(ErrorString*, const String& eventName);
    6971    void setDOMBreakpoint(ErrorString*, int nodeId, const String& type);
    7072    void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type);
     
    7880    void willModifyDOMAttr(Element*);
    7981    void willSendXMLHttpRequest(const String& url);
    80     void pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous);
     82    void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
    8183
    8284    virtual void clearFrontend();
     
    9597    bool hasBreakpoint(Node*, int type);
    9698    void discardBindings();
     99    void setBreakpoint(ErrorString*, const String& eventName);
     100    void removeBreakpoint(ErrorString*, const String& eventName);
    97101
    98102    void clear();
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r106337 r106347  
    7272namespace WebCore {
    7373
    74 static const char* const listenerEventCategoryType = "listener";
    75 static const char* const instrumentationEventCategoryType = "instrumentation";
    76 
    7774static const char* const setTimerEventName = "setTimer";
    7875static const char* const clearTimerEventName = "clearTimer";
     
    233230void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot)
    234231{
    235     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, setTimerEventName, true);
     232    pauseOnNativeEventIfNeeded(instrumentingAgents, false, setTimerEventName, true);
    236233    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    237234        timelineAgent->didInstallTimer(timerId, timeout, singleShot);
     
    240237void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
    241238{
    242     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, clearTimerEventName, true);
     239    pauseOnNativeEventIfNeeded(instrumentingAgents, false, clearTimerEventName, true);
    243240    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    244241        timelineAgent->didRemoveTimer(timerId);
     
    291288InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
    292289{
    293     pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event->type(), false);
     290    pauseOnNativeEventIfNeeded(instrumentingAgents, true, event->type(), false);
    294291    return InspectorInstrumentationCookie(instrumentingAgents, 0);
    295292}
     
    341338InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
    342339{
    343     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, timerFiredEventName, false);
     340    pauseOnNativeEventIfNeeded(instrumentingAgents, false, timerFiredEventName, false);
    344341
    345342    int timelineAgentId = 0;
     
    962959}
    963960
    964 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, const String& categoryType, const String& eventName, bool synchronous)
     961void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
    965962{
    966963#if ENABLE(JAVASCRIPT_DEBUGGER)
    967964    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
    968         domDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous);
     965        domDebuggerAgent->pauseOnNativeEventIfNeeded(isDOMEvent, eventName, synchronous);
    969966#endif
    970967}
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r106337 r106347  
    368368
    369369    static bool collectingHTMLParseErrors(InstrumentingAgents*);
    370     static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, const String& categoryType, const String& eventName, bool synchronous);
     370    static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
    371371    static void cancelPauseOnNativeEvent(InstrumentingAgents*);
    372372    static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
  • trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js

    r106252 r106347  
    462462
    463463    this._breakpointItems = {};
    464     this._createCategory(WebInspector.UIString("Keyboard"), "listener", ["keydown", "keyup", "keypress", "textInput"]);
    465     this._createCategory(WebInspector.UIString("Mouse"), "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
     464    this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "keyup", "keypress", "textInput"]);
     465    this._createCategory(WebInspector.UIString("Mouse"), true, ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
    466466    // FIXME: uncomment following once inspector stops being drop targer in major ports.
    467467    // Otherwise, inspector page reacts on drop event and tries to load the event data.
    468     // this._createCategory(WebInspector.UIString("Drag"), "listener", ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
    469     this._createCategory(WebInspector.UIString("Control"), "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
    470     this._createCategory(WebInspector.UIString("Clipboard"), "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
    471     this._createCategory(WebInspector.UIString("Load"), "listener", ["load", "unload", "abort", "error"]);
    472     this._createCategory(WebInspector.UIString("DOM Mutation"), "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
    473     this._createCategory(WebInspector.UIString("Device"), "listener", ["deviceorientation", "devicemotion"]);
    474     this._createCategory(WebInspector.UIString("Timer"), "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
    475     this._createCategory(WebInspector.UIString("Touch"), "listener", ["touchstart", "touchmove", "touchend", "touchcancel"]);
     468    // this._createCategory(WebInspector.UIString("Drag"), true, ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
     469    this._createCategory(WebInspector.UIString("Control"), true, ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
     470    this._createCategory(WebInspector.UIString("Clipboard"), true, ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
     471    this._createCategory(WebInspector.UIString("Load"), true, ["load", "unload", "abort", "error"]);
     472    this._createCategory(WebInspector.UIString("DOM Mutation"), true, ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
     473    this._createCategory(WebInspector.UIString("Device"), true, ["deviceorientation", "devicemotion"]);
     474    this._createCategory(WebInspector.UIString("Timer"), false, ["setTimer", "clearTimer", "timerFired"]);
     475    this._createCategory(WebInspector.UIString("Touch"), true, ["touchstart", "touchmove", "touchend", "touchcancel"]);
    476476
    477477    this._restoreBreakpoints();
    478478}
     479
     480WebInspector.EventListenerBreakpointsSidebarPane.categotyListener = "listener:";
     481WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation = "instrumentation:";
    479482
    480483WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(eventName)
     
    491494
    492495WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
    493     _createCategory: function(name, type, eventNames)
     496    _createCategory: function(name, isDOMEvent, eventNames)
    494497    {
    495498        var categoryItem = {};
     
    504507        categoryItem.children = {};
    505508        for (var i = 0; i < eventNames.length; ++i) {
    506             var eventName = type + ":" + eventNames[i];
     509            var eventName = (isDOMEvent ? WebInspector.EventListenerBreakpointsSidebarPane.categotyListener :  WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) + eventNames[i];
    507510
    508511            var breakpointItem = {};
     
    564567            return;
    565568        breakpointItem.checkbox.checked = true;
    566         DOMDebuggerAgent.setEventListenerBreakpoint(eventName);
     569        if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener) === 0)
     570            DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length));
     571        else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) === 0)
     572            DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length));
    567573        this._updateCategoryCheckbox(breakpointItem.parent);
    568574    },
     
    574580            return;
    575581        breakpointItem.checkbox.checked = false;
    576         DOMDebuggerAgent.removeEventListenerBreakpoint(eventName);
     582        if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener) === 0)
     583            DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length));
     584        else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) === 0)
     585            DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length));
    577586        this._updateCategoryCheckbox(breakpointItem.parent);
    578587    },
Note: See TracChangeset for help on using the changeset viewer.