Changeset 106347 in webkit
- Timestamp:
- Jan 31, 2012 2:05:34 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106342 r106347 1 2012-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 1 32 2012-01-31 Pablo Flouret <pablof@motorola.com> 2 33 -
trunk/Source/WebCore/inspector/Inspector.json
r106246 r106347 2269 2269 "name": "setEventListenerBreakpoint", 2270 2270 "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)." } 2272 2272 ], 2273 2273 "description": "Sets breakpoint on particular DOM event." … … 2279 2279 ], 2280 2280 "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 2281 2297 }, 2282 2298 { -
trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
r101754 r106347 39 39 #include "InspectorDOMAgent.h" 40 40 #include "InspectorDebuggerAgent.h" 41 #include "InspectorInstrumentation.h" 41 42 #include "InspectorState.h" 42 43 #include "InspectorValues.h" … … 53 54 }; 54 55 56 static const char* const listenerEventCategoryType = "listener:"; 57 static const char* const instrumentationEventCategoryType = "instrumentation:"; 58 55 59 static const char* const domNativeBreakpointType = "DOM"; 56 60 static const char* const eventListenerNativeBreakpointType = "EventListener"; … … 125 129 void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, const String& eventName) 126 130 { 131 setBreakpoint(error, String(listenerEventCategoryType) + eventName); 132 } 133 134 void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString* error, const String& eventName) 135 { 136 setBreakpoint(error, String(instrumentationEventCategoryType) + eventName); 137 } 138 139 void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString* error, const String& eventName) 140 { 127 141 if (eventName.isEmpty()) { 128 142 *error = "Event name is empty"; … … 136 150 137 151 void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error, const String& eventName) 152 { 153 removeBreakpoint(error, String(listenerEventCategoryType) + eventName); 154 } 155 156 void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString* error, const String& eventName) 157 { 158 removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName); 159 } 160 161 void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString* error, const String& eventName) 138 162 { 139 163 if (eventName.isEmpty()) { … … 334 358 } 335 359 336 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded( const String& categoryType, const String& eventName, bool synchronous)337 { 338 String fullEventName = categoryType + ':'+ eventName;360 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous) 361 { 362 String fullEventName = (isDOMEvent ? listenerEventCategoryType : instrumentationEventCategoryType) + eventName; 339 363 RefPtr<InspectorObject> eventListenerBreakpoints = m_state->getObject(DOMDebuggerAgentState::eventListenerBreakpoints); 340 364 if (eventListenerBreakpoints->find(fullEventName) == eventListenerBreakpoints->end()) -
trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h
r101754 r106347 67 67 void setEventListenerBreakpoint(ErrorString*, const String& eventName); 68 68 void removeEventListenerBreakpoint(ErrorString*, const String& eventName); 69 void setInstrumentationBreakpoint(ErrorString*, const String& eventName); 70 void removeInstrumentationBreakpoint(ErrorString*, const String& eventName); 69 71 void setDOMBreakpoint(ErrorString*, int nodeId, const String& type); 70 72 void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type); … … 78 80 void willModifyDOMAttr(Element*); 79 81 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); 81 83 82 84 virtual void clearFrontend(); … … 95 97 bool hasBreakpoint(Node*, int type); 96 98 void discardBindings(); 99 void setBreakpoint(ErrorString*, const String& eventName); 100 void removeBreakpoint(ErrorString*, const String& eventName); 97 101 98 102 void clear(); -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r106337 r106347 72 72 namespace WebCore { 73 73 74 static const char* const listenerEventCategoryType = "listener";75 static const char* const instrumentationEventCategoryType = "instrumentation";76 77 74 static const char* const setTimerEventName = "setTimer"; 78 75 static const char* const clearTimerEventName = "clearTimer"; … … 233 230 void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot) 234 231 { 235 pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, setTimerEventName, true);232 pauseOnNativeEventIfNeeded(instrumentingAgents, false, setTimerEventName, true); 236 233 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) 237 234 timelineAgent->didInstallTimer(timerId, timeout, singleShot); … … 240 237 void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId) 241 238 { 242 pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, clearTimerEventName, true);239 pauseOnNativeEventIfNeeded(instrumentingAgents, false, clearTimerEventName, true); 243 240 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) 244 241 timelineAgent->didRemoveTimer(timerId); … … 291 288 InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event) 292 289 { 293 pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event->type(), false);290 pauseOnNativeEventIfNeeded(instrumentingAgents, true, event->type(), false); 294 291 return InspectorInstrumentationCookie(instrumentingAgents, 0); 295 292 } … … 341 338 InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId) 342 339 { 343 pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, timerFiredEventName, false);340 pauseOnNativeEventIfNeeded(instrumentingAgents, false, timerFiredEventName, false); 344 341 345 342 int timelineAgentId = 0; … … 962 959 } 963 960 964 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, const String& categoryType, const String& eventName, bool synchronous)961 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous) 965 962 { 966 963 #if ENABLE(JAVASCRIPT_DEBUGGER) 967 964 if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent()) 968 domDebuggerAgent->pauseOnNativeEventIfNeeded( categoryType, eventName, synchronous);965 domDebuggerAgent->pauseOnNativeEventIfNeeded(isDOMEvent, eventName, synchronous); 969 966 #endif 970 967 } -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r106337 r106347 368 368 369 369 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); 371 371 static void cancelPauseOnNativeEvent(InstrumentingAgents*); 372 372 static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); -
trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
r106252 r106347 462 462 463 463 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"]); 466 466 // FIXME: uncomment following once inspector stops being drop targer in major ports. 467 467 // 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"]); 476 476 477 477 this._restoreBreakpoints(); 478 478 } 479 480 WebInspector.EventListenerBreakpointsSidebarPane.categotyListener = "listener:"; 481 WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation = "instrumentation:"; 479 482 480 483 WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(eventName) … … 491 494 492 495 WebInspector.EventListenerBreakpointsSidebarPane.prototype = { 493 _createCategory: function(name, type, eventNames)496 _createCategory: function(name, isDOMEvent, eventNames) 494 497 { 495 498 var categoryItem = {}; … … 504 507 categoryItem.children = {}; 505 508 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]; 507 510 508 511 var breakpointItem = {}; … … 564 567 return; 565 568 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)); 567 573 this._updateCategoryCheckbox(breakpointItem.parent); 568 574 }, … … 574 580 return; 575 581 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)); 577 586 this._updateCategoryCheckbox(breakpointItem.parent); 578 587 },
Note: See TracChangeset
for help on using the changeset viewer.