Index: third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js |
index 93d5d2f25294cb5276cb4b3a5695314b4a54f06d..90e253c18b7d7689a355b5c636527829a598b770 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/ObjectEventListenersSidebarPane.js |
@@ -1,102 +1,99 @@ |
// 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.VBox} |
* @implements {WebInspector.ToolbarItem.ItemsProvider} |
+ * @unrestricted |
*/ |
-WebInspector.ObjectEventListenersSidebarPane = function() |
-{ |
- WebInspector.VBox.call(this); |
- this.element.classList.add("event-listeners-sidebar-pane"); |
+WebInspector.ObjectEventListenersSidebarPane = class extends WebInspector.VBox { |
+ constructor() { |
+ super(); |
+ this.element.classList.add('event-listeners-sidebar-pane'); |
- this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); |
- this._refreshButton.addEventListener("click", this._refreshClick.bind(this)); |
+ this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString('Refresh'), 'refresh-toolbar-item'); |
+ this._refreshButton.addEventListener('click', this._refreshClick.bind(this)); |
this._refreshButton.setEnabled(false); |
this._eventListenersView = new WebInspector.EventListenersView(this.element, this.update.bind(this)); |
-}; |
- |
-WebInspector.ObjectEventListenersSidebarPane._objectGroupName = "object-event-listeners-sidebar-pane"; |
- |
-WebInspector.ObjectEventListenersSidebarPane.prototype = { |
- /** |
- * @override |
- * @return {!Array<!WebInspector.ToolbarItem>} |
- */ |
- toolbarItems: function() |
- { |
- return [this._refreshButton]; |
- }, |
+ } |
- update: function() |
- { |
- if (this._lastRequestedContext) { |
- this._lastRequestedContext.target().runtimeAgent().releaseObjectGroup(WebInspector.ObjectEventListenersSidebarPane._objectGroupName); |
- delete this._lastRequestedContext; |
- } |
- var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
- if (!executionContext) { |
- this._eventListenersView.reset(); |
- this._eventListenersView.addEmptyHolderIfNeeded(); |
- return; |
- } |
- this._lastRequestedContext = executionContext; |
- Promise.all([this._windowObjectInContext(executionContext)]).then(this._eventListenersView.addObjects.bind(this._eventListenersView)); |
- }, |
+ /** |
+ * @override |
+ * @return {!Array<!WebInspector.ToolbarItem>} |
+ */ |
+ toolbarItems() { |
+ return [this._refreshButton]; |
+ } |
- wasShown: function() |
- { |
- WebInspector.VBox.prototype.wasShown.call(this); |
- WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); |
- this._refreshButton.setEnabled(true); |
- this.update(); |
- }, |
+ update() { |
+ if (this._lastRequestedContext) { |
+ this._lastRequestedContext.target().runtimeAgent().releaseObjectGroup( |
+ WebInspector.ObjectEventListenersSidebarPane._objectGroupName); |
+ delete this._lastRequestedContext; |
+ } |
+ var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
+ if (!executionContext) { |
+ this._eventListenersView.reset(); |
+ this._eventListenersView.addEmptyHolderIfNeeded(); |
+ return; |
+ } |
+ this._lastRequestedContext = executionContext; |
+ Promise.all([this._windowObjectInContext(executionContext)]) |
+ .then(this._eventListenersView.addObjects.bind(this._eventListenersView)); |
+ } |
- willHide: function() |
- { |
- WebInspector.VBox.prototype.willHide.call(this); |
- WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); |
- this._refreshButton.setEnabled(false); |
- }, |
+ /** |
+ * @override |
+ */ |
+ wasShown() { |
+ super.wasShown(); |
+ WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); |
+ this._refreshButton.setEnabled(true); |
+ 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, false, mycallback); |
- /** |
- * @param {?WebInspector.RemoteObject} object |
- */ |
- function mycallback(object) |
- { |
- if (object) |
- fulfill(object); |
- else |
- reject(null); |
- } |
- } |
- }, |
+ /** |
+ * @override |
+ */ |
+ willHide() { |
+ super.willHide(); |
+ WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionContext, this.update, this); |
+ this._refreshButton.setEnabled(false); |
+ } |
+ /** |
+ * @param {!WebInspector.ExecutionContext} executionContext |
+ * @return {!Promise<!WebInspector.RemoteObject>} object |
+ */ |
+ _windowObjectInContext(executionContext) { |
+ return new Promise(windowObjectInContext); |
/** |
- * @param {!WebInspector.Event} event |
+ * @param {function(?)} fulfill |
+ * @param {function(*)} reject |
*/ |
- _refreshClick: function(event) |
- { |
- event.consume(); |
- this.update(); |
- }, |
+ function windowObjectInContext(fulfill, reject) { |
+ executionContext.evaluate( |
+ 'self', WebInspector.ObjectEventListenersSidebarPane._objectGroupName, false, true, false, false, false, |
+ mycallback); |
+ /** |
+ * @param {?WebInspector.RemoteObject} object |
+ */ |
+ function mycallback(object) { |
+ if (object) |
+ fulfill(object); |
+ else |
+ reject(null); |
+ } |
+ } |
+ } |
- __proto__: WebInspector.VBox.prototype |
+ /** |
+ * @param {!WebInspector.Event} event |
+ */ |
+ _refreshClick(event) { |
+ event.consume(); |
+ this.update(); |
+ } |
}; |
+ |
+WebInspector.ObjectEventListenersSidebarPane._objectGroupName = 'object-event-listeners-sidebar-pane'; |