Index: third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js |
index 2996e71c42b95b76f90b58ad97ac9675738ec7df..e38074e4b41981c8a958cc3bf6f3fda54c9f8928 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js |
+++ b/third_party/WebKit/Source/devtools/front_end/elements/EventListenersWidget.js |
@@ -26,32 +26,33 @@ |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
- |
/** |
- * @constructor |
- * @extends {WebInspector.ThrottledWidget} |
* @implements {WebInspector.ToolbarItem.ItemsProvider} |
+ * @unrestricted |
*/ |
-WebInspector.EventListenersWidget = function() |
-{ |
- WebInspector.ThrottledWidget.call(this); |
- this.element.classList.add("events-pane"); |
+WebInspector.EventListenersWidget = class extends WebInspector.ThrottledWidget { |
+ constructor() { |
+ super(); |
+ this.element.classList.add('events-pane'); |
this._toolbarItems = []; |
- this._showForAncestorsSetting = WebInspector.settings.moduleSetting("showEventListenersForAncestors"); |
+ this._showForAncestorsSetting = WebInspector.settings.moduleSetting('showEventListenersForAncestors'); |
this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); |
- this._dispatchFilterBySetting = WebInspector.settings.createSetting("eventListenerDispatchFilterType", WebInspector.EventListenersWidget.DispatchFilterBy.All); |
+ this._dispatchFilterBySetting = WebInspector.settings.createSetting( |
+ 'eventListenerDispatchFilterType', WebInspector.EventListenersWidget.DispatchFilterBy.All); |
this._dispatchFilterBySetting.addChangeListener(this.update.bind(this)); |
- this._showFrameworkListenersSetting = WebInspector.settings.createSetting("showFrameowkrListeners", true); |
+ this._showFrameworkListenersSetting = WebInspector.settings.createSetting('showFrameowkrListeners', true); |
this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkListenersChanged.bind(this)); |
this._eventListenersView = new WebInspector.EventListenersView(this.element, this.update.bind(this)); |
- var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Refresh"), "refresh-toolbar-item"); |
- refreshButton.addEventListener("click", this.update.bind(this)); |
+ var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString('Refresh'), 'refresh-toolbar-item'); |
+ refreshButton.addEventListener('click', this.update.bind(this)); |
this._toolbarItems.push(refreshButton); |
- this._toolbarItems.push(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancestors"), this._showForAncestorsSetting)); |
+ this._toolbarItems.push(new WebInspector.ToolbarCheckbox( |
+ WebInspector.UIString('Ancestors'), WebInspector.UIString('Show listeners on the ancestors'), |
+ this._showForAncestorsSetting)); |
var dispatchFilter = new WebInspector.ToolbarComboBox(this._onDispatchFilterTypeChanged.bind(this)); |
/** |
@@ -59,122 +60,123 @@ WebInspector.EventListenersWidget = function() |
* @param {string} value |
* @this {WebInspector.EventListenersWidget} |
*/ |
- function addDispatchFilterOption(name, value) |
- { |
- var option = dispatchFilter.createOption(name, "", value); |
- if (value === this._dispatchFilterBySetting.get()) |
- dispatchFilter.select(option); |
+ function addDispatchFilterOption(name, value) { |
+ var option = dispatchFilter.createOption(name, '', value); |
+ if (value === this._dispatchFilterBySetting.get()) |
+ dispatchFilter.select(option); |
} |
- addDispatchFilterOption.call(this, WebInspector.UIString("All"), WebInspector.EventListenersWidget.DispatchFilterBy.All); |
- addDispatchFilterOption.call(this, WebInspector.UIString("Passive"), WebInspector.EventListenersWidget.DispatchFilterBy.Passive); |
- addDispatchFilterOption.call(this, WebInspector.UIString("Blocking"), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking); |
+ addDispatchFilterOption.call( |
+ this, WebInspector.UIString('All'), WebInspector.EventListenersWidget.DispatchFilterBy.All); |
+ addDispatchFilterOption.call( |
+ this, WebInspector.UIString('Passive'), WebInspector.EventListenersWidget.DispatchFilterBy.Passive); |
+ addDispatchFilterOption.call( |
+ this, WebInspector.UIString('Blocking'), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking); |
dispatchFilter.setMaxWidth(200); |
this._toolbarItems.push(dispatchFilter); |
- this._toolbarItems.push(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Framework listeners"), WebInspector.UIString("Resolve event listeners bound with framework"), this._showFrameworkListenersSetting)); |
+ this._toolbarItems.push(new WebInspector.ToolbarCheckbox( |
+ WebInspector.UIString('Framework listeners'), |
+ WebInspector.UIString('Resolve event listeners bound with framework'), this._showFrameworkListenersSetting)); |
WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.update, this); |
this.update(); |
-}; |
- |
-WebInspector.EventListenersWidget.DispatchFilterBy = { |
- All : "All", |
- Blocking : "Blocking", |
- Passive : "Passive" |
-}; |
- |
-WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; |
- |
-WebInspector.EventListenersWidget.prototype = { |
- /** |
- * @override |
- * @protected |
- * @return {!Promise.<?>} |
- */ |
- doUpdate: function() |
- { |
- if (this._lastRequestedNode) { |
- this._lastRequestedNode.target().runtimeAgent().releaseObjectGroup(WebInspector.EventListenersWidget._objectGroupName); |
- delete this._lastRequestedNode; |
- } |
- var node = WebInspector.context.flavor(WebInspector.DOMNode); |
- if (!node) { |
- this._eventListenersView.reset(); |
- this._eventListenersView.addEmptyHolderIfNeeded(); |
- return Promise.resolve(); |
- } |
- this._lastRequestedNode = node; |
- var selectedNodeOnly = !this._showForAncestorsSetting.get(); |
- var promises = []; |
- var listenersView = this._eventListenersView; |
- promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWidget._objectGroupName)); |
- if (!selectedNodeOnly) { |
- var currentNode = node.parentNode; |
- while (currentNode) { |
- promises.push(currentNode.resolveToObjectPromise(WebInspector.EventListenersWidget._objectGroupName)); |
- currentNode = currentNode.parentNode; |
- } |
- promises.push(this._windowObjectInNodeContext(node)); |
- } |
- return Promise.all(promises).then(this._eventListenersView.addObjects.bind(this._eventListenersView)).then(this._showFrameworkListenersChanged.bind(this)); |
- }, |
- |
- /** |
- * @override |
- * @return {!Array<!WebInspector.ToolbarItem>} |
- */ |
- toolbarItems: function() |
- { |
- return this._toolbarItems; |
- }, |
- |
- /** |
- * @param {!Event} event |
- */ |
- _onDispatchFilterTypeChanged: function(event) |
- { |
- this._dispatchFilterBySetting.set(event.target.value); |
- }, |
- |
- _showFrameworkListenersChanged: function() |
- { |
- var dispatchFilter = this._dispatchFilterBySetting.get(); |
- var showPassive = dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.Passive; |
- var showBlocking = dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.Blocking; |
- this._eventListenersView.showFrameworkListeners(this._showFrameworkListenersSetting.get(), showPassive, showBlocking); |
- }, |
+ } |
+ |
+ /** |
+ * @override |
+ * @protected |
+ * @return {!Promise.<?>} |
+ */ |
+ doUpdate() { |
+ if (this._lastRequestedNode) { |
+ this._lastRequestedNode.target().runtimeAgent().releaseObjectGroup( |
+ WebInspector.EventListenersWidget._objectGroupName); |
+ delete this._lastRequestedNode; |
+ } |
+ var node = WebInspector.context.flavor(WebInspector.DOMNode); |
+ if (!node) { |
+ this._eventListenersView.reset(); |
+ this._eventListenersView.addEmptyHolderIfNeeded(); |
+ return Promise.resolve(); |
+ } |
+ this._lastRequestedNode = node; |
+ var selectedNodeOnly = !this._showForAncestorsSetting.get(); |
+ var promises = []; |
+ var listenersView = this._eventListenersView; |
+ promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWidget._objectGroupName)); |
+ if (!selectedNodeOnly) { |
+ var currentNode = node.parentNode; |
+ while (currentNode) { |
+ promises.push(currentNode.resolveToObjectPromise(WebInspector.EventListenersWidget._objectGroupName)); |
+ currentNode = currentNode.parentNode; |
+ } |
+ promises.push(this._windowObjectInNodeContext(node)); |
+ } |
+ return Promise.all(promises) |
+ .then(this._eventListenersView.addObjects.bind(this._eventListenersView)) |
+ .then(this._showFrameworkListenersChanged.bind(this)); |
+ } |
+ |
+ /** |
+ * @override |
+ * @return {!Array<!WebInspector.ToolbarItem>} |
+ */ |
+ toolbarItems() { |
+ return this._toolbarItems; |
+ } |
+ |
+ /** |
+ * @param {!Event} event |
+ */ |
+ _onDispatchFilterTypeChanged(event) { |
+ this._dispatchFilterBySetting.set(event.target.value); |
+ } |
+ |
+ _showFrameworkListenersChanged() { |
+ var dispatchFilter = this._dispatchFilterBySetting.get(); |
+ var showPassive = dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.All || |
+ dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.Passive; |
+ var showBlocking = dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.All || |
+ dispatchFilter === WebInspector.EventListenersWidget.DispatchFilterBy.Blocking; |
+ this._eventListenersView.showFrameworkListeners( |
+ this._showFrameworkListenersSetting.get(), showPassive, showBlocking); |
+ } |
+ |
+ /** |
+ * @param {!WebInspector.DOMNode} node |
+ * @return {!Promise<!WebInspector.RemoteObject>} |
+ */ |
+ _windowObjectInNodeContext(node) { |
+ return new Promise(windowObjectInNodeContext); |
/** |
- * @param {!WebInspector.DOMNode} node |
- * @return {!Promise<!WebInspector.RemoteObject>} |
+ * @param {function(?)} fulfill |
+ * @param {function(*)} reject |
*/ |
- _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.isDefault) |
- context = executionContext; |
- } |
- } else { |
- context = executionContexts[0]; |
- } |
- context.evaluate("self", WebInspector.EventListenersWidget._objectGroupName, false, true, false, false, false, fulfill); |
+ 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.isDefault) |
+ context = executionContext; |
} |
- }, |
+ } else { |
+ context = executionContexts[0]; |
+ } |
+ context.evaluate( |
+ 'self', WebInspector.EventListenersWidget._objectGroupName, false, true, false, false, false, fulfill); |
+ } |
+ } |
- _eventListenersArrivedForTest: function() |
- { |
- }, |
+ _eventListenersArrivedForTest() { |
+ } |
+}; |
- __proto__: WebInspector.ThrottledWidget.prototype |
+WebInspector.EventListenersWidget.DispatchFilterBy = { |
+ All: 'All', |
+ Blocking: 'Blocking', |
+ Passive: 'Passive' |
}; |
+ |
+WebInspector.EventListenersWidget._objectGroupName = 'event-listeners-panel'; |