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 |
| 42 this._showFrameworkListenersSetting = WebInspector.settings.createSetting("s
howFrameworkListeners", true); |
| 43 this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkUse
rListenersChanged.bind(this)); |
| 44 |
41 this._eventListenersView = new WebInspector.EventListenersView(this.element)
; | 45 this._eventListenersView = new WebInspector.EventListenersView(this.element)
; |
42 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda
te, this); | 46 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda
te, this); |
43 } | 47 } |
44 | 48 |
45 /** | 49 /** |
46 * @return {!WebInspector.ElementsSidebarViewWrapperPane} | 50 * @return {!WebInspector.ElementsSidebarViewWrapperPane} |
47 */ | 51 */ |
48 WebInspector.EventListenersWidget.createSidebarWrapper = function() | 52 WebInspector.EventListenersWidget.createSidebarWrapper = function() |
49 { | 53 { |
50 var widget = new WebInspector.EventListenersWidget(); | 54 var widget = new WebInspector.EventListenersWidget(); |
51 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI
String("Event Listeners"), widget); | 55 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI
String("Event Listeners"), widget); |
52 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); | 56 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); |
53 refreshButton.addEventListener("click", widget.update.bind(widget)); | 57 refreshButton.addEventListener("click", widget.update.bind(widget)); |
54 result.toolbar().appendToolbarItem(refreshButton); | 58 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)); | 59 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe
ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto
rs"), widget._showForAncestorsSetting)); |
| 60 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe
ctor.UIString("Framework listeners"), WebInspector.UIString("Resolve event liste
ners bound with frameworks"), widget._showFrameworkListenersSetting)); |
56 return result; | 61 return result; |
57 } | 62 } |
58 | 63 |
59 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; | 64 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; |
60 | 65 |
61 WebInspector.EventListenersWidget.prototype = { | 66 WebInspector.EventListenersWidget.prototype = { |
62 /** | 67 /** |
63 * @override | 68 * @override |
64 * @protected | 69 * @protected |
65 * @return {!Promise.<?>} | 70 * @return {!Promise.<?>} |
(...skipping 16 matching lines...) Expand all Loading... |
82 var listenersView = this._eventListenersView; | 87 var listenersView = this._eventListenersView; |
83 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid
get._objectGroupName)); | 88 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid
get._objectGroupName)); |
84 if (!selectedNodeOnly) { | 89 if (!selectedNodeOnly) { |
85 var currentNode = node.parentNode; | 90 var currentNode = node.parentNode; |
86 while (currentNode) { | 91 while (currentNode) { |
87 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev
entListenersWidget._objectGroupName)); | 92 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev
entListenersWidget._objectGroupName)); |
88 currentNode = currentNode.parentNode; | 93 currentNode = currentNode.parentNode; |
89 } | 94 } |
90 promises.push(this._windowObjectInNodeContext(node)); | 95 promises.push(this._windowObjectInNodeContext(node)); |
91 } | 96 } |
92 return Promise.all(promises).then(this._eventListenersView.addObjects.bi
nd(this._eventListenersView)); | 97 /** |
| 98 * @this {!WebInspector.EventListenersWidget} |
| 99 */ |
| 100 function showResolvedHandlers() |
| 101 { |
| 102 this._showFrameworkUserListenersChanged(); |
| 103 } |
| 104 return Promise.all(promises).then(this._eventListenersView.addObjects.bi
nd(this._eventListenersView)).then(showResolvedHandlers.bind(this)); |
| 105 }, |
| 106 |
| 107 _showFrameworkUserListenersChanged: function() |
| 108 { |
| 109 this._eventListenersView.showFrameworkUserEventListeners(this._showFrame
workListenersSetting.get()); |
93 }, | 110 }, |
94 | 111 |
95 /** | 112 /** |
96 * @param {!WebInspector.DOMNode} node | 113 * @param {!WebInspector.DOMNode} node |
97 * @return {!Promise<!WebInspector.RemoteObject>} | 114 * @return {!Promise<!WebInspector.RemoteObject>} |
98 */ | 115 */ |
99 _windowObjectInNodeContext: function(node) | 116 _windowObjectInNodeContext: function(node) |
100 { | 117 { |
101 return new Promise(windowObjectInNodeContext); | 118 return new Promise(windowObjectInNodeContext); |
102 | 119 |
(...skipping 17 matching lines...) Expand all Loading... |
120 context.evaluate("self", WebInspector.EventListenersWidget._objectGr
oupName, false, true, false, false, fulfill); | 137 context.evaluate("self", WebInspector.EventListenersWidget._objectGr
oupName, false, true, false, false, fulfill); |
121 } | 138 } |
122 }, | 139 }, |
123 | 140 |
124 _eventListenersArrivedForTest: function() | 141 _eventListenersArrivedForTest: function() |
125 { | 142 { |
126 }, | 143 }, |
127 | 144 |
128 __proto__: WebInspector.ThrottledWidget.prototype | 145 __proto__: WebInspector.ThrottledWidget.prototype |
129 } | 146 } |
OLD | NEW |