OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 24 matching lines...) Expand all Loading... | |
35 } | 35 } |
36 | 36 |
37 WebInspector.CallStackSidebarPane.Events = { | 37 WebInspector.CallStackSidebarPane.Events = { |
38 CallFrameRestarted: "CallFrameRestarted", | 38 CallFrameRestarted: "CallFrameRestarted", |
39 CallFrameSelected: "CallFrameSelected" | 39 CallFrameSelected: "CallFrameSelected" |
40 } | 40 } |
41 | 41 |
42 WebInspector.CallStackSidebarPane.prototype = { | 42 WebInspector.CallStackSidebarPane.prototype = { |
43 /** | 43 /** |
44 * @param {?Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames | 44 * @param {?Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames |
45 * @param {?WebInspector.DebuggerModel.StackTrace} asyncStackTrace | |
45 */ | 46 */ |
46 update: function(callFrames) | 47 update: function(callFrames, asyncStackTrace) |
47 { | 48 { |
48 this.bodyElement.removeChildren(); | 49 this.bodyElement.removeChildren(); |
49 delete this._statusMessageElement; | 50 delete this._statusMessageElement; |
50 /** @type {!Array.<!WebInspector.CallStackSidebarPane.Placard>} */ | 51 /** @type {!Array.<!WebInspector.CallStackSidebarPane.Placard>} */ |
51 this.placards = []; | 52 this.placards = []; |
52 | 53 |
53 if (!callFrames) { | 54 if (!callFrames) { |
54 var infoElement = this.bodyElement.createChild("div", "info"); | 55 var infoElement = this.bodyElement.createChild("div", "info"); |
55 infoElement.textContent = WebInspector.UIString("Not Paused"); | 56 infoElement.textContent = WebInspector.UIString("Not Paused"); |
56 return; | 57 return; |
57 } | 58 } |
58 | 59 |
59 this._appendSidebarPlacards(callFrames, this.bodyElement); | 60 this._appendSidebarPlacards(callFrames, this.bodyElement); |
61 | |
62 while (asyncStackTrace) { | |
63 var asyncPlacards = this._appendSidebarPlacards(asyncStackTrace.call Frames); | |
64 var group = new WebInspector.PlacardGroup(WebInspector.UIString("[As ync Call]"), asyncPlacards); | |
65 group.element.addEventListener("contextmenu", this._placardContextMe nu.bind(this, null), true); | |
66 this.bodyElement.appendChild(group.element); | |
67 asyncStackTrace = asyncStackTrace.asyncStackTrace; | |
68 } | |
60 }, | 69 }, |
61 | 70 |
62 /** | 71 /** |
63 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames | 72 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames |
64 * @param {!Element=} parentElement | 73 * @param {!Element=} parentElement |
74 * @return {!Array.<!WebInspector.CallStackSidebarPane.Placard>} | |
65 */ | 75 */ |
66 _appendSidebarPlacards: function(callFrames, parentElement) | 76 _appendSidebarPlacards: function(callFrames, parentElement) |
67 { | 77 { |
78 var result = []; | |
68 for (var i = 0, n = callFrames.length; i < n; ++i) { | 79 for (var i = 0, n = callFrames.length; i < n; ++i) { |
69 var placard = new WebInspector.CallStackSidebarPane.Placard(callFram es[i]); | 80 var placard = new WebInspector.CallStackSidebarPane.Placard(callFram es[i]); |
70 placard.element.addEventListener("click", this._placardSelected.bind (this, placard), false); | 81 placard.element.addEventListener("click", this._placardSelected.bind (this, placard), false); |
71 placard.element.addEventListener("contextmenu", this._placardContext Menu.bind(this, placard), true); | 82 placard.element.addEventListener("contextmenu", this._placardContext Menu.bind(this, placard), true); |
83 result.push(placard); | |
72 this.placards.push(placard); | 84 this.placards.push(placard); |
73 if (parentElement) | 85 if (parentElement) |
74 parentElement.appendChild(placard.element); | 86 parentElement.appendChild(placard.element); |
75 } | 87 } |
88 return result; | |
76 }, | 89 }, |
77 | 90 |
78 /** | 91 /** |
79 * @param {!WebInspector.CallStackSidebarPane.Placard} placard | 92 * @param {?WebInspector.CallStackSidebarPane.Placard} placard |
yurys
2013/12/06 12:36:54
Isn't placart === null <==> placard._callFrame.isA
aandrey
2013/12/06 16:09:24
Done.
| |
80 */ | 93 */ |
81 _placardContextMenu: function(placard, event) | 94 _placardContextMenu: function(placard, event) |
82 { | 95 { |
83 var contextMenu = new WebInspector.ContextMenu(event); | 96 var contextMenu = new WebInspector.ContextMenu(event); |
84 | 97 |
85 if (WebInspector.debuggerModel.canSetScriptSource()) | 98 if (placard && !placard._callFrame.isAsync() && WebInspector.debuggerMod el.canSetScriptSource()) |
86 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Restart frame" : "Restart Frame"), this._restartFrame.bind(thi s, placard)); | 99 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Restart frame" : "Restart Frame"), this._restartFrame.bind(thi s, placard)); |
87 | 100 |
88 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy stack trace" : "Copy Stack Trace"), this._copyStackTrace.bind (this)); | 101 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy stack trace" : "Copy Stack Trace"), this._copyStackTrace.bind (this)); |
102 contextMenu.appendSeparator(); | |
103 | |
104 var asyncStacksEnabled = WebInspector.settings.enableAsyncStackTraces.ge t(); | |
105 if (asyncStacksEnabled) | |
106 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Disable async stack traces" : "Disable Async Stack Traces"), t his._enableAsyncStacks.bind(this, false)); | |
107 else | |
108 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Enable async stack traces" : "Enable Async Stack Traces"), thi s._enableAsyncStacks.bind(this, true)); | |
109 | |
89 contextMenu.show(); | 110 contextMenu.show(); |
90 }, | 111 }, |
91 | 112 |
92 /** | 113 /** |
93 * @param {!WebInspector.CallStackSidebarPane.Placard} placard | 114 * @param {!WebInspector.CallStackSidebarPane.Placard} placard |
94 */ | 115 */ |
95 _restartFrame: function(placard) | 116 _restartFrame: function(placard) |
96 { | 117 { |
97 placard._callFrame.restart(); | 118 placard._callFrame.restart(); |
98 this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.C allFrameRestarted, placard._callFrame); | 119 this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.C allFrameRestarted, placard._callFrame); |
99 }, | 120 }, |
100 | 121 |
101 /** | 122 /** |
102 * @param {!WebInspector.DebuggerModel.CallFrame} x | 123 * @param {boolean} enable |
124 */ | |
125 _enableAsyncStacks: function(enable) | |
126 { | |
127 WebInspector.settings.enableAsyncStackTraces.set(enable); | |
128 }, | |
129 | |
130 /** | |
131 * @param {WebInspector.DebuggerModel.CallFrame} x | |
103 */ | 132 */ |
104 setSelectedCallFrame: function(x) | 133 setSelectedCallFrame: function(x) |
105 { | 134 { |
106 for (var i = 0; i < this.placards.length; ++i) { | 135 for (var i = 0; i < this.placards.length; ++i) { |
107 var placard = this.placards[i]; | 136 var placard = this.placards[i]; |
108 placard.selected = (placard._callFrame === x); | 137 placard.selected = (placard._callFrame === x); |
109 } | 138 } |
110 }, | 139 }, |
111 | 140 |
112 /** | 141 /** |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 * @param {!WebInspector.CallStackSidebarPane.Placard} placard | 194 * @param {!WebInspector.CallStackSidebarPane.Placard} placard |
166 */ | 195 */ |
167 _placardSelected: function(placard) | 196 _placardSelected: function(placard) |
168 { | 197 { |
169 this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.C allFrameSelected, placard._callFrame); | 198 this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.C allFrameSelected, placard._callFrame); |
170 }, | 199 }, |
171 | 200 |
172 _copyStackTrace: function() | 201 _copyStackTrace: function() |
173 { | 202 { |
174 var text = ""; | 203 var text = ""; |
175 for (var i = 0; i < this.placards.length; ++i) | 204 for (var i = 0; i < this.placards.length; ++i) { |
205 if (i && this.placards[i].group !== this.placards[i - 1].group) | |
206 text += this.placards[i].group.title + "\n"; | |
176 text += this.placards[i].title + " (" + this.placards[i].subtitle + ")\n"; | 207 text += this.placards[i].title + " (" + this.placards[i].subtitle + ")\n"; |
208 } | |
177 InspectorFrontendHost.copyText(text); | 209 InspectorFrontendHost.copyText(text); |
178 }, | 210 }, |
179 | 211 |
180 /** | 212 /** |
181 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, func tion(Event=):boolean)} registerShortcutDelegate | 213 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, func tion(Event=):boolean)} registerShortcutDelegate |
182 */ | 214 */ |
183 registerShortcuts: function(registerShortcutDelegate) | 215 registerShortcuts: function(registerShortcutDelegate) |
184 { | 216 { |
185 registerShortcutDelegate(WebInspector.SourcesPanelDescriptor.ShortcutKey s.NextCallFrame, this._selectNextCallFrameOnStack.bind(this)); | 217 registerShortcutDelegate(WebInspector.SourcesPanelDescriptor.ShortcutKey s.NextCallFrame, this._selectNextCallFrameOnStack.bind(this)); |
186 registerShortcutDelegate(WebInspector.SourcesPanelDescriptor.ShortcutKey s.PrevCallFrame, this._selectPreviousCallFrameOnStack.bind(this)); | 218 registerShortcutDelegate(WebInspector.SourcesPanelDescriptor.ShortcutKey s.PrevCallFrame, this._selectPreviousCallFrameOnStack.bind(this)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 /** | 266 /** |
235 * @param {!WebInspector.UILocation} uiLocation | 267 * @param {!WebInspector.UILocation} uiLocation |
236 */ | 268 */ |
237 _update: function(uiLocation) | 269 _update: function(uiLocation) |
238 { | 270 { |
239 this.subtitle = uiLocation.linkText().trimMiddle(100); | 271 this.subtitle = uiLocation.linkText().trimMiddle(100); |
240 }, | 272 }, |
241 | 273 |
242 __proto__: WebInspector.Placard.prototype | 274 __proto__: WebInspector.Placard.prototype |
243 } | 275 } |
OLD | NEW |