Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 145133008: DevTools: Make getEventListeners() of Console API work for window. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 38120b1c3276dc8c946b546a7b58c4b37f0826f3..5cc9c66d0de6d5d5db181797107c8e5728b1e53d 100755
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -863,7 +863,7 @@ void InspectorDOMAgent::getEventListenersForNode(ErrorString* errorString, int n
for (size_t j = 0; j < vector.size(); ++j) {
const RegisteredEventListener& listener = vector[j];
if (listener.useCapture)
- listenersArray->addItem(buildObjectForEventListener(listener, info.eventType, info.node, objectGroup));
+ listenersArray->addItem(buildObjectForEventListener(listener, info.eventType, info.eventTarget->toNode(), objectGroup));
}
}
@@ -874,30 +874,26 @@ void InspectorDOMAgent::getEventListenersForNode(ErrorString* errorString, int n
for (size_t j = 0; j < vector.size(); ++j) {
const RegisteredEventListener& listener = vector[j];
if (!listener.useCapture)
- listenersArray->addItem(buildObjectForEventListener(listener, info.eventType, info.node, objectGroup));
+ listenersArray->addItem(buildObjectForEventListener(listener, info.eventType, info.eventTarget->toNode(), objectGroup));
}
}
}
-void InspectorDOMAgent::getEventListeners(Node* node, Vector<EventListenerInfo>& eventInformation, bool includeAncestors)
+void InspectorDOMAgent::getEventListeners(EventTarget* target, Vector<EventListenerInfo>& eventInformation, bool includeAncestors)
{
// The Node's Ancestors including self.
- Vector<Node*> ancestors;
- // Push this node as the firs element.
- ancestors.append(node);
+ Vector<EventTarget*> ancestors;
+ ancestors.append(target);
if (includeAncestors) {
- for (ContainerNode* ancestor = node->parentOrShadowHostNode(); ancestor; ancestor = ancestor->parentOrShadowHostNode())
+ Node* node = target->toNode();
+ for (ContainerNode* ancestor = node ? node->parentOrShadowHostNode() : 0; ancestor; ancestor = ancestor->parentOrShadowHostNode())
ancestors.append(ancestor);
}
// Nodes and their Listeners for the concerned event types (order is top to bottom)
for (size_t i = ancestors.size(); i; --i) {
- Node* ancestor = ancestors[i - 1];
- EventTargetData* d = ancestor->eventTargetData();
- if (!d)
- continue;
- // Get the list of event types this Node is concerned with
- Vector<AtomicString> eventTypes = d->eventListenerMap.eventTypes();
+ EventTarget* ancestor = ancestors[i - 1];
+ Vector<AtomicString> eventTypes = ancestor->eventTypes();
for (size_t j = 0; j < eventTypes.size(); ++j) {
AtomicString& type = eventTypes[j];
const EventListenerVector& listeners = ancestor->getEventListeners(type);
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698