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

Unified Diff: Source/devtools/front_end/sdk/DOMModel.js

Issue 1042853004: [DevTools] Event Listeners Sidebar shows window listeners (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Extracted eventListenersTreeOutline.css Created 5 years, 8 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/devtools/front_end/elements/module.json ('k') | Source/devtools/front_end/sdk/RemoteObject.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/DOMModel.js
diff --git a/Source/devtools/front_end/sdk/DOMModel.js b/Source/devtools/front_end/sdk/DOMModel.js
index 8e2697e6e8b2bdcfb551cb45e1791656b801d20d..477bd083f07fcc1459b1eec0db2188512df97131 100644
--- a/Source/devtools/front_end/sdk/DOMModel.js
+++ b/Source/devtools/front_end/sdk/DOMModel.js
@@ -533,7 +533,7 @@ WebInspector.DOMNode.prototype = {
/**
* @param {string} objectGroupId
- * @param {function(?Array.<!WebInspector.DOMModel.EventListener>)} callback
+ * @param {function(?Array.<!WebInspector.DOMModel.DOMEventListener>)} callback
*/
eventListeners: function(objectGroupId, callback)
{
@@ -550,7 +550,7 @@ WebInspector.DOMNode.prototype = {
return;
}
callback(payloads.map(function(payload) {
- return new WebInspector.DOMModel.EventListener(target, payload);
+ return new WebInspector.DOMModel.DOMEventListener(target, payload);
}));
}
this._agent.getEventListenersForNode(this.id, objectGroupId, mycallback);
@@ -2024,61 +2024,72 @@ WebInspector.DOMDispatcher.prototype = {
/**
* @constructor
- * @extends {WebInspector.SDKObject}
+ * @extends {WebInspector.EventListener<DOMAgent.EventListener>}
* @param {!WebInspector.Target} target
* @param {!DOMAgent.EventListener} payload
*/
-WebInspector.DOMModel.EventListener = function(target, payload)
+WebInspector.DOMModel.DOMEventListener = function(target, payload)
{
- WebInspector.SDKObject.call(this, target);
- this._payload = payload;
- var script = target.debuggerModel.scriptForId(payload.location.scriptId);
- var sourceName = script ? script.contentURL() : "";
- this._sourceName = sourceName;
+ WebInspector.EventListener.call(this, target, payload);
}
-WebInspector.DOMModel.EventListener.prototype = {
- /**
- * @return {!DOMAgent.EventListener}
- */
- payload: function()
- {
- return this._payload;
- },
-
+WebInspector.DOMModel.DOMEventListener.prototype = {
/**
- * @return {?WebInspector.DOMNode}
+ * @override
+ * @return {boolean}
*/
- node: function()
+ isDOMEventListener: function()
{
- return this.target().domModel.nodeForId(this._payload.nodeId);
+ return true;
},
/**
- * @return {!WebInspector.DebuggerModel.Location}
+ * @return {number}
*/
- location: function()
+ nodeId: function()
{
- return WebInspector.DebuggerModel.Location.fromPayload(this.target(), this._payload.location);
+ return this._payload.nodeId;
},
/**
- * @return {?WebInspector.RemoteObject}
+ * @return {?WebInspector.DOMNode}
*/
- handler: function()
+ node: function()
{
- return this._payload.handler ? this.target().runtimeModel.createRemoteObject(this._payload.handler) : null;
+ return this.target().domModel.nodeForId(this.nodeId());
},
/**
- * @return {string}
+ * @override
+ * @param {function(!Array<!WebInspector.RemoteObjectProperty>)} callback
+ * @param {string} objectGroupName
*/
- sourceName: function()
+ getProperties: function(callback, objectGroupName)
{
- return this._sourceName;
+ /**
+ * @this {WebInspector.DOMModel.DOMEventListener}
+ * @param {?WebInspector.RemoteObject} nodeObject
+ */
+ function getPropertiesWithNodeObject(nodeObject)
+ {
+ /**
+ * @this {WebInspector.DOMModel.DOMEventListener}
+ * @param {!Array<!WebInspector.RemoteObjectProperty>} properties
+ */
+ function mycallback(properties)
+ {
+ var runtimeModel = this.target().runtimeModel;
+ properties.push(runtimeModel.createRemotePropertyFromPrimitiveValue("attachment", this._payload.isAttribute ? "attribute" : "script"));
+ if (nodeObject)
+ properties.push(new WebInspector.RemoteObjectProperty("node", nodeObject));
+ callback(properties);
+ }
+ WebInspector.EventListener.prototype.getProperties.call(this, mycallback.bind(this), objectGroupName);
+ }
+ this.node().resolveToObject(objectGroupName, getPropertiesWithNodeObject.bind(this));
},
- __proto__: WebInspector.SDKObject.prototype
+ __proto__: WebInspector.EventListener.prototype
}
/**
« no previous file with comments | « Source/devtools/front_end/elements/module.json ('k') | Source/devtools/front_end/sdk/RemoteObject.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698