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

Unified Diff: Source/devtools/front_end/elements/EventListenersSidebarPane.js

Issue 1154703005: [DevTools] Added window listeners to EventListenersSidebar (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@extract-event-listeners-tree-outline
Patch Set: Test fixed Created 5 years, 7 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
Index: Source/devtools/front_end/elements/EventListenersSidebarPane.js
diff --git a/Source/devtools/front_end/elements/EventListenersSidebarPane.js b/Source/devtools/front_end/elements/EventListenersSidebarPane.js
index d83367f582445fe62ef584e6dc265418c624b884..770e283c963483a269c1007ef34c4c5f5b31ae08 100644
--- a/Source/devtools/front_end/elements/EventListenersSidebarPane.js
+++ b/Source/devtools/front_end/elements/EventListenersSidebarPane.js
@@ -59,7 +59,7 @@ WebInspector.EventListenersSidebarPane = function()
this.settingsSelectElement.addEventListener("click", consumeEvent, false);
this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
- this._eventListenersView = new WebInspector.EventListenersView(this.bodyElement, WebInspector.EventListenersSidebarPane._objectGroupName);
+ this._eventListenersView = new WebInspector.EventListenersView(this.bodyElement);
}
WebInspector.EventListenersSidebarPane._objectGroupName = "event-listeners-panel";
@@ -84,28 +84,69 @@ WebInspector.EventListenersSidebarPane.prototype = {
return;
}
+ this._lastRequestedNode = node;
var selectedNodeOnly = "selected" === this._eventListenersFilterSetting.get();
var promises = [];
- promises.push(this._eventListenersView.addNodeEventListeners(node));
+ var listenersView = this._eventListenersView;
+ promises.push(node.resolveToObjectPromise(WebInspector.EventListenersSidebarPane._objectGroupName).then(listenersView.addObjectEventListeners.bind(listenersView)));
if (!selectedNodeOnly) {
var currentNode = node.parentNode;
while (currentNode) {
- promises.push(this._eventListenersView.addNodeEventListeners(currentNode));
+ promises.push(currentNode.resolveToObjectPromise(WebInspector.EventListenersSidebarPane._objectGroupName).then(listenersView.addObjectEventListeners.bind(listenersView)));
currentNode = currentNode.parentNode;
}
+ this._windowObjectInNodeContext(node).then(windowObjectCallback.bind(this));
+ } else {
+ Promise.all(promises).then(mycallback.bind(this));
+ }
+ /**
+ * @param {!WebInspector.RemoteObject} object
+ * @this {WebInspector.EventListenersSidebarPane}
+ */
+ function windowObjectCallback(object)
+ {
+ promises.push(this._eventListenersView.addObjectEventListeners(object));
+ Promise.all(promises).then(mycallback.bind(this));
}
- Promise.all(promises).then(mycallback.bind(this));
/**
* @this {WebInspector.EventListenersSidebarPane}
*/
function mycallback()
{
- this._lastRequestedNode = node;
this._eventListenersArivedForTest();
finishCallback();
}
},
+ /**
+ * @param {!WebInspector.DOMNode} node
+ * @return {!Promise<!WebInspector.RemoteObject>} object
+ */
+ _windowObjectInNodeContext: function(node)
+ {
+ return new Promise(windowObjectInNodeContext);
+
+ /**
+ * @param {function(?)} fulfill
+ * @param {function(*)} reject
+ */
+ function windowObjectInNodeContext(fulfill, reject)
+ {
+ var executionContexts = node.target().runtimeModel.executionContexts();
+ var context = null;
+ if (node.frameId()) {
+ for (var i = 0; i < executionContexts.length; ++i) {
+ var executionContext = executionContexts[i];
+ if (executionContext.frameId === node.frameId() && executionContext.isMainWorldContext)
+ context = executionContext;
+ }
+ } else {
+ context = executionContexts[0];
+ }
+ context.evaluate("self", WebInspector.EventListenersSidebarPane._objectGroupName, false, true, false, false, fulfill);
+ }
+ },
+
_changeSetting: function()
{
var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
« no previous file with comments | « Source/devtools/front_end/components/ObjectPropertiesSection.js ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698