| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * @constructor | 31 * @constructor |
| 32 * @extends {WebInspector.ThrottledWidget} | 32 * @extends {WebInspector.ThrottledWidget} |
| 33 */ | 33 */ |
| 34 WebInspector.EventListenersWidget = function() | 34 WebInspector.EventListenersWidget = function() |
| 35 { | 35 { |
| 36 WebInspector.ThrottledWidget.call(this); | 36 WebInspector.ThrottledWidget.call(this); |
| 37 this.element.classList.add("events-pane"); | 37 this.element.classList.add("events-pane"); |
| 38 | 38 |
| 39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve
ntListenersForAncestors", true); | 39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve
ntListenersForAncestors", true); |
| 40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); | 40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); |
| 41 this._showFrameworkListenersSetting = WebInspector.settings.createSetting("s
howFrameowkrListeners", true); |
| 42 this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkLis
tenersChanged.bind(this)); |
| 41 this._eventListenersView = new WebInspector.EventListenersView(this.element)
; | 43 this._eventListenersView = new WebInspector.EventListenersView(this.element)
; |
| 42 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda
te, this); | 44 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda
te, this); |
| 43 } | 45 } |
| 44 | 46 |
| 45 /** | 47 /** |
| 46 * @return {!WebInspector.ElementsSidebarViewWrapperPane} | 48 * @return {!WebInspector.ElementsSidebarViewWrapperPane} |
| 47 */ | 49 */ |
| 48 WebInspector.EventListenersWidget.createSidebarWrapper = function() | 50 WebInspector.EventListenersWidget.createSidebarWrapper = function() |
| 49 { | 51 { |
| 50 var widget = new WebInspector.EventListenersWidget(); | 52 var widget = new WebInspector.EventListenersWidget(); |
| 51 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI
String("Event Listeners"), widget); | 53 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI
String("Event Listeners"), widget); |
| 52 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); | 54 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); |
| 53 refreshButton.addEventListener("click", widget.update.bind(widget)); | 55 refreshButton.addEventListener("click", widget.update.bind(widget)); |
| 54 result.toolbar().appendToolbarItem(refreshButton); | 56 result.toolbar().appendToolbarItem(refreshButton); |
| 55 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe
ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto
rs"), widget._showForAncestorsSetting)); | 57 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe
ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto
rs"), widget._showForAncestorsSetting)); |
| 58 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe
ctor.UIString("Framework listeners"), WebInspector.UIString("Resolve event liste
ners bound with framework"), widget._showFrameworkListenersSetting)); |
| 56 return result; | 59 return result; |
| 57 } | 60 } |
| 58 | 61 |
| 59 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; | 62 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; |
| 60 | 63 |
| 61 WebInspector.EventListenersWidget.prototype = { | 64 WebInspector.EventListenersWidget.prototype = { |
| 62 /** | 65 /** |
| 63 * @override | 66 * @override |
| 64 * @protected | 67 * @protected |
| 65 * @return {!Promise.<?>} | 68 * @return {!Promise.<?>} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 82 var listenersView = this._eventListenersView; | 85 var listenersView = this._eventListenersView; |
| 83 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid
get._objectGroupName)); | 86 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid
get._objectGroupName)); |
| 84 if (!selectedNodeOnly) { | 87 if (!selectedNodeOnly) { |
| 85 var currentNode = node.parentNode; | 88 var currentNode = node.parentNode; |
| 86 while (currentNode) { | 89 while (currentNode) { |
| 87 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev
entListenersWidget._objectGroupName)); | 90 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev
entListenersWidget._objectGroupName)); |
| 88 currentNode = currentNode.parentNode; | 91 currentNode = currentNode.parentNode; |
| 89 } | 92 } |
| 90 promises.push(this._windowObjectInNodeContext(node)); | 93 promises.push(this._windowObjectInNodeContext(node)); |
| 91 } | 94 } |
| 92 return Promise.all(promises).then(this._eventListenersView.addObjects.bi
nd(this._eventListenersView)); | 95 return Promise.all(promises).then(this._eventListenersView.addObjects.bi
nd(this._eventListenersView)).then(this._showFrameworkListenersChanged.bind(this
)); |
| 96 }, |
| 97 |
| 98 _showFrameworkListenersChanged: function() |
| 99 { |
| 100 this._eventListenersView.showFrameworkListeners(this._showFrameworkListe
nersSetting.get()); |
| 93 }, | 101 }, |
| 94 | 102 |
| 95 /** | 103 /** |
| 96 * @param {!WebInspector.DOMNode} node | 104 * @param {!WebInspector.DOMNode} node |
| 97 * @return {!Promise<!WebInspector.RemoteObject>} | 105 * @return {!Promise<!WebInspector.RemoteObject>} |
| 98 */ | 106 */ |
| 99 _windowObjectInNodeContext: function(node) | 107 _windowObjectInNodeContext: function(node) |
| 100 { | 108 { |
| 101 return new Promise(windowObjectInNodeContext); | 109 return new Promise(windowObjectInNodeContext); |
| 102 | 110 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 120 context.evaluate("self", WebInspector.EventListenersWidget._objectGr
oupName, false, true, false, false, fulfill); | 128 context.evaluate("self", WebInspector.EventListenersWidget._objectGr
oupName, false, true, false, false, fulfill); |
| 121 } | 129 } |
| 122 }, | 130 }, |
| 123 | 131 |
| 124 _eventListenersArrivedForTest: function() | 132 _eventListenersArrivedForTest: function() |
| 125 { | 133 { |
| 126 }, | 134 }, |
| 127 | 135 |
| 128 __proto__: WebInspector.ThrottledWidget.prototype | 136 __proto__: WebInspector.ThrottledWidget.prototype |
| 129 } | 137 } |
| OLD | NEW |