Diff
Modified: trunk/Source/WebCore/ChangeLog (106346 => 106347)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 10:05:34 UTC (rev 106347)
@@ -1,3 +1,34 @@
+2012-01-31 Pavel Feldman <[email protected]>
+
+ 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):
+
2012-01-31 Pablo Flouret <[email protected]>
Fix compilation errors on build-webkit --debug --no-workers on mac.
Modified: trunk/Source/WebCore/inspector/Inspector.json (106346 => 106347)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-01-31 10:05:34 UTC (rev 106347)
@@ -2268,7 +2268,7 @@
{
"name": "setEventListenerBreakpoint",
"parameters": [
- { "name": "eventName", "type": "string", "description": "Event name to stop on (any DOM event will do)." }
+ { "name": "eventName", "type": "string", "description": "DOM Event name to stop on (any DOM event will do)." }
],
"description": "Sets breakpoint on particular DOM event."
},
@@ -2280,6 +2280,22 @@
"description": "Removes breakpoint on particular DOM event."
},
{
+ "name": "setInstrumentationBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
+ ],
+ "description": "Sets breakpoint on particular native event.",
+ "hidden": true
+ },
+ {
+ "name": "removeInstrumentationBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
+ ],
+ "description": "Sets breakpoint on particular native event.",
+ "hidden": true
+ },
+ {
"name": "setXHRBreakpoint",
"parameters": [
{ "name": "url", "type": "string", "description": "Resource URL substring. All XHRs having this substring in the URL will get stopped upon." }
Modified: trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp (106346 => 106347)
--- trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp 2012-01-31 10:05:34 UTC (rev 106347)
@@ -38,6 +38,7 @@
#include "InspectorAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorDebuggerAgent.h"
+#include "InspectorInstrumentation.h"
#include "InspectorState.h"
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
@@ -52,6 +53,9 @@
DOMBreakpointTypesCount
};
+static const char* const listenerEventCategoryType = "listener:";
+static const char* const instrumentationEventCategoryType = "instrumentation:";
+
static const char* const domNativeBreakpointType = "DOM";
static const char* const eventListenerNativeBreakpointType = "EventListener";
static const char* const xhrNativeBreakpointType = "XHR";
@@ -124,6 +128,16 @@
void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, const String& eventName)
{
+ setBreakpoint(error, String(listenerEventCategoryType) + eventName);
+}
+
+void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString* error, const String& eventName)
+{
+ setBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
+}
+
+void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString* error, const String& eventName)
+{
if (eventName.isEmpty()) {
*error = "Event name is empty";
return;
@@ -136,6 +150,16 @@
void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error, const String& eventName)
{
+ removeBreakpoint(error, String(listenerEventCategoryType) + eventName);
+}
+
+void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString* error, const String& eventName)
+{
+ removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
+}
+
+void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString* error, const String& eventName)
+{
if (eventName.isEmpty()) {
*error = "Event name is empty";
return;
@@ -333,9 +357,9 @@
updateSubtreeBreakpoints(child, newRootMask, set);
}
-void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous)
+void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous)
{
- String fullEventName = categoryType + ':' + eventName;
+ String fullEventName = (isDOMEvent ? listenerEventCategoryType : instrumentationEventCategoryType) + eventName;
RefPtr<InspectorObject> eventListenerBreakpoints = m_state->getObject(DOMDebuggerAgentState::eventListenerBreakpoints);
if (eventListenerBreakpoints->find(fullEventName) == eventListenerBreakpoints->end())
return;
Modified: trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h (106346 => 106347)
--- trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h 2012-01-31 10:05:34 UTC (rev 106347)
@@ -66,6 +66,8 @@
void removeXHRBreakpoint(ErrorString*, const String& url);
void setEventListenerBreakpoint(ErrorString*, const String& eventName);
void removeEventListenerBreakpoint(ErrorString*, const String& eventName);
+ void setInstrumentationBreakpoint(ErrorString*, const String& eventName);
+ void removeInstrumentationBreakpoint(ErrorString*, const String& eventName);
void setDOMBreakpoint(ErrorString*, int nodeId, const String& type);
void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type);
@@ -77,7 +79,7 @@
void didRemoveDOMNode(Node*);
void willModifyDOMAttr(Element*);
void willSendXMLHttpRequest(const String& url);
- void pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous);
+ void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
virtual void clearFrontend();
virtual void discardAgent();
@@ -94,6 +96,8 @@
void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set);
bool hasBreakpoint(Node*, int type);
void discardBindings();
+ void setBreakpoint(ErrorString*, const String& eventName);
+ void removeBreakpoint(ErrorString*, const String& eventName);
void clear();
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (106346 => 106347)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-01-31 10:05:34 UTC (rev 106347)
@@ -71,9 +71,6 @@
namespace WebCore {
-static const char* const listenerEventCategoryType = "listener";
-static const char* const instrumentationEventCategoryType = "instrumentation";
-
static const char* const setTimerEventName = "setTimer";
static const char* const clearTimerEventName = "clearTimer";
static const char* const timerFiredEventName = "timerFired";
@@ -232,14 +229,14 @@
void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, setTimerEventName, true);
+ pauseOnNativeEventIfNeeded(instrumentingAgents, false, setTimerEventName, true);
if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
timelineAgent->didInstallTimer(timerId, timeout, singleShot);
}
void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, clearTimerEventName, true);
+ pauseOnNativeEventIfNeeded(instrumentingAgents, false, clearTimerEventName, true);
if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
timelineAgent->didRemoveTimer(timerId);
}
@@ -290,7 +287,7 @@
InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event->type(), false);
+ pauseOnNativeEventIfNeeded(instrumentingAgents, true, event->type(), false);
return InspectorInstrumentationCookie(instrumentingAgents, 0);
}
@@ -340,7 +337,7 @@
InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
{
- pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, timerFiredEventName, false);
+ pauseOnNativeEventIfNeeded(instrumentingAgents, false, timerFiredEventName, false);
int timelineAgentId = 0;
if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
@@ -961,11 +958,11 @@
return page && page->inspectorController()->hasFrontend();
}
-void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, const String& categoryType, const String& eventName, bool synchronous)
+void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
{
#if ENABLE(_javascript__DEBUGGER)
if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
- domDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous);
+ domDebuggerAgent->pauseOnNativeEventIfNeeded(isDOMEvent, eventName, synchronous);
#endif
}
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (106346 => 106347)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-01-31 10:05:34 UTC (rev 106347)
@@ -367,7 +367,7 @@
#endif
static bool collectingHTMLParseErrors(InstrumentingAgents*);
- static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, const String& categoryType, const String& eventName, bool synchronous);
+ static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
static void cancelPauseOnNativeEvent(InstrumentingAgents*);
static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
Modified: trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js (106346 => 106347)
--- trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js 2012-01-31 10:01:23 UTC (rev 106346)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js 2012-01-31 10:05:34 UTC (rev 106347)
@@ -461,22 +461,25 @@
this.bodyElement.appendChild(this.categoriesElement);
this._breakpointItems = {};
- this._createCategory(WebInspector.UIString("Keyboard"), "listener", ["keydown", "keyup", "keypress", "textInput"]);
- this._createCategory(WebInspector.UIString("Mouse"), "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
+ this._createCategory(WebInspector.UIString("Keyboard"), true, ["keydown", "keyup", "keypress", "textInput"]);
+ this._createCategory(WebInspector.UIString("Mouse"), true, ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
// FIXME: uncomment following once inspector stops being drop targer in major ports.
// Otherwise, inspector page reacts on drop event and tries to load the event data.
- // this._createCategory(WebInspector.UIString("Drag"), "listener", ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
- this._createCategory(WebInspector.UIString("Control"), "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
- this._createCategory(WebInspector.UIString("Clipboard"), "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
- this._createCategory(WebInspector.UIString("Load"), "listener", ["load", "unload", "abort", "error"]);
- this._createCategory(WebInspector.UIString("DOM Mutation"), "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
- this._createCategory(WebInspector.UIString("Device"), "listener", ["deviceorientation", "devicemotion"]);
- this._createCategory(WebInspector.UIString("Timer"), "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
- this._createCategory(WebInspector.UIString("Touch"), "listener", ["touchstart", "touchmove", "touchend", "touchcancel"]);
+ // this._createCategory(WebInspector.UIString("Drag"), true, ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
+ this._createCategory(WebInspector.UIString("Control"), true, ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
+ this._createCategory(WebInspector.UIString("Clipboard"), true, ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
+ this._createCategory(WebInspector.UIString("Load"), true, ["load", "unload", "abort", "error"]);
+ this._createCategory(WebInspector.UIString("DOM Mutation"), true, ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
+ this._createCategory(WebInspector.UIString("Device"), true, ["deviceorientation", "devicemotion"]);
+ this._createCategory(WebInspector.UIString("Timer"), false, ["setTimer", "clearTimer", "timerFired"]);
+ this._createCategory(WebInspector.UIString("Touch"), true, ["touchstart", "touchmove", "touchend", "touchcancel"]);
this._restoreBreakpoints();
}
+WebInspector.EventListenerBreakpointsSidebarPane.categotyListener = "listener:";
+WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation = "instrumentation:";
+
WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(eventName)
{
if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) {
@@ -490,7 +493,7 @@
}
WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
- _createCategory: function(name, type, eventNames)
+ _createCategory: function(name, isDOMEvent, eventNames)
{
var categoryItem = {};
categoryItem.element = new TreeElement(name);
@@ -503,7 +506,7 @@
categoryItem.children = {};
for (var i = 0; i < eventNames.length; ++i) {
- var eventName = type + ":" + eventNames[i];
+ var eventName = (isDOMEvent ? WebInspector.EventListenerBreakpointsSidebarPane.categotyListener : WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) + eventNames[i];
var breakpointItem = {};
var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);
@@ -563,7 +566,10 @@
if (!breakpointItem)
return;
breakpointItem.checkbox.checked = true;
- DOMDebuggerAgent.setEventListenerBreakpoint(eventName);
+ if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener) === 0)
+ DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length));
+ else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) === 0)
+ DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length));
this._updateCategoryCheckbox(breakpointItem.parent);
},
@@ -573,7 +579,10 @@
if (!breakpointItem)
return;
breakpointItem.checkbox.checked = false;
- DOMDebuggerAgent.removeEventListenerBreakpoint(eventName);
+ if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener) === 0)
+ DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyListener.length));
+ else if (eventName.indexOf(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation) === 0)
+ DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length));
this._updateCategoryCheckbox(breakpointItem.parent);
},