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

Unified Diff: Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js

Issue 1098683002: [DevTools] Added Event Listeners sidebar in sources panel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@window-listeners
Patch Set: 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
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/sources/SourcesPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js
diff --git a/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js b/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf974705e6117975e3780fdfd361794b837a84eb
--- /dev/null
+++ b/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js
@@ -0,0 +1,83 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarPane}
+ */
+WebInspector.ObjectEventListenersSidebarPane = function()
+{
+ WebInspector.SidebarPane.call(this, "Event Listeners");
+ this.bodyElement.classList.add("events-pane");
+
+ var refreshButton = this.titleElement.createChild("button", "pane-title-button refresh");
+ refreshButton.addEventListener("click", this._refreshClick.bind(this), false);
+ refreshButton.title = WebInspector.UIString("Refresh");
+
+ WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this.update, this);
+ this._eventListenersView = new WebInspector.EventListenersView(this.bodyElement);
+}
+
+WebInspector.ObjectEventListenersSidebarPane._objectGroupName = "object-event-listeners-sidebar-pane";
+
+WebInspector.ObjectEventListenersSidebarPane.prototype = {
+ update: function()
+ {
+ if (this._lastRequestedContext) {
+ this._lastRequestedContext.target().runtimeAgent().releaseObjectGroup(WebInspector.ObjectEventListenersSidebarPane._objectGroupName);
+ delete this._lastRequestedContext;
+ }
+ this._eventListenersView.reset();
+ var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
+ if (!executionContext)
+ return;
+ this._lastRequestedContext = executionContext;
+ this._windowObjectInContext(executionContext).then(this._eventListenersView.addObjectEventListeners.bind(this._eventListenersView));
+ },
+
+ expand: function()
+ {
+ WebInspector.SidebarPane.prototype.expand.call(this);
+ this.update();
+ },
+
+ /**
+ * @param {!WebInspector.ExecutionContext} executionContext
+ * @return {!Promise<!WebInspector.RemoteObject>} object
+ */
+ _windowObjectInContext: function(executionContext)
+ {
+ return new Promise(windowObjectInContext);
+
+ /**
+ * @param {function(?)} fulfill
+ * @param {function(*)} reject
+ */
+ function windowObjectInContext(fulfill, reject)
+ {
+ executionContext.evaluate("self", WebInspector.ObjectEventListenersSidebarPane._objectGroupName, false, true, false, false, mycallback);
+ /**
+ * @param {?WebInspector.RemoteObject} object
+ */
+ function mycallback(object)
+ {
+ if (object)
+ fulfill(object);
+ else
+ reject(null);
+ }
+ }
+ },
+
+ /**
+ * @param {!Event} event
+ */
+ _refreshClick: function(event)
+ {
+ event.consume();
+ this.update();
+ },
+
+ __proto__: WebInspector.SidebarPane.prototype
+}
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/sources/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698