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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 this.callFrameList.clear(); | 62 this.callFrameList.clear(); |
63 this._linkifier.reset(); | 63 this._linkifier.reset(); |
64 this.element.removeChildren(); | 64 this.element.removeChildren(); |
65 this._locationPool.disposeAll(); | 65 this._locationPool.disposeAll(); |
66 | 66 |
67 this.callFrameList.show(this.element); | 67 this.callFrameList.show(this.element); |
68 delete this._hiddenCallFramesMessageElement; | 68 delete this._hiddenCallFramesMessageElement; |
69 this.callFrames = []; | 69 this.callFrames = []; |
70 this._hiddenCallFrames = 0; | 70 this._hiddenCallFrames = 0; |
71 | 71 |
72 this._updateStatusMessage(details); | |
73 | |
74 if (!details) { | 72 if (!details) { |
| 73 var infoElement = this.element.createChild("div", "gray-info-message
"); |
| 74 infoElement.textContent = WebInspector.UIString("Not Paused"); |
75 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame,
null); | 75 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame,
null); |
76 return; | 76 return; |
77 } | 77 } |
78 this._debuggerModel = details.debuggerModel; | 78 this._debuggerModel = details.debuggerModel; |
79 var asyncStackTrace = details.asyncStackTrace; | 79 var asyncStackTrace = details.asyncStackTrace; |
80 | 80 |
81 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callF
rames)); | 81 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callF
rames)); |
82 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length)
; | 82 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length)
; |
83 | 83 |
84 while (asyncStackTrace) { | 84 while (asyncStackTrace) { |
(...skipping 18 matching lines...) Expand all Loading... |
103 showAllLink.textContent = WebInspector.UIString("Show"); | 103 showAllLink.textContent = WebInspector.UIString("Show"); |
104 showAllLink.addEventListener("click", this._revealHiddenCallFrames.b
ind(this), false); | 104 showAllLink.addEventListener("click", this._revealHiddenCallFrames.b
ind(this), false); |
105 this.element.insertBefore(element, this.element.firstChild); | 105 this.element.insertBefore(element, this.element.firstChild); |
106 this._hiddenCallFramesMessageElement = element; | 106 this._hiddenCallFramesMessageElement = element; |
107 } | 107 } |
108 this._selectNextVisibleCallFrame(0); | 108 this._selectNextVisibleCallFrame(0); |
109 this.revealView(); | 109 this.revealView(); |
110 }, | 110 }, |
111 | 111 |
112 /** | 112 /** |
113 * @param {?WebInspector.DebuggerPausedDetails} details | |
114 */ | |
115 _updateStatusMessage: function(details) | |
116 { | |
117 var status = this.contentElement.createChild("div", "callstack-info"); | |
118 status.removeChildren(); | |
119 | |
120 if (!details) { | |
121 status.textContent = WebInspector.UIString("Not Paused"); | |
122 status.classList.toggle("status", false); | |
123 return; | |
124 } | |
125 | |
126 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) { | |
127 status.appendChild(WebInspector.domBreakpointsSidebarPane.createBrea
kpointHitStatusMessage(details)); | |
128 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Eve
ntListener) { | |
129 var eventName = details.auxData["eventName"]; | |
130 var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPan
e.eventNameForUI(eventName, details.auxData); | |
131 status.textContent = WebInspector.UIString("Paused on a \"%s\" Event
Listener.", eventNameForUI); | |
132 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.XHR
) { | |
133 status.textContent = WebInspector.UIString("Paused on a XMLHttpReque
st."); | |
134 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Exc
eption) { | |
135 var description = details.auxData["description"] || ""; | |
136 status.textContent = WebInspector.UIString("Paused on exception: '%s
'.", description.split("\n", 1)[0]); | |
137 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Pro
miseRejection) { | |
138 var description = details.auxData["description"] || ""; | |
139 status.textContent = WebInspector.UIString("Paused on promise reject
ion: '%s'.", description.split("\n", 1)[0]); | |
140 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Ass
ert) { | |
141 status.textContent = WebInspector.UIString("Paused on assertion."); | |
142 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Deb
ugCommand) { | |
143 status.textContent = WebInspector.UIString("Paused on a debugged fun
ction."); | |
144 } else { | |
145 if (details.callFrames.length) { | |
146 var uiLocation = details && details.callFrames.length ? WebInspe
ctor.debuggerWorkspaceBinding.rawLocationToUILocation(details.callFrames[0].loca
tion()) : null; | |
147 var breakpoint = uiLocation ? WebInspector.breakpointManager.fin
dBreakpointOnLine(uiLocation.uiSourceCode, uiLocation.lineNumber) : null; | |
148 if (breakpoint) { | |
149 status.textContent = WebInspector.UIString("Paused on a Java
Script breakpoint."); | |
150 } | |
151 } else { | |
152 console.warn("ScriptsPanel paused, but callFrames.length is zero
."); // TODO remove this once we understand this case better | |
153 } | |
154 } | |
155 status.classList.toggle("hidden", !status.firstChild); | |
156 }, | |
157 | |
158 /** | |
159 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames | 113 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames |
160 * @return {!Array<!WebInspector.CallStackSidebarPane.CallFrame>} | 114 * @return {!Array<!WebInspector.CallStackSidebarPane.CallFrame>} |
161 */ | 115 */ |
162 _callFramesFromDebugger: function(callFrames) | 116 _callFramesFromDebugger: function(callFrames) |
163 { | 117 { |
164 var callFrameItems = []; | 118 var callFrameItems = []; |
165 for (var i = 0, n = callFrames.length; i < n; ++i) { | 119 for (var i = 0, n = callFrames.length; i < n; ++i) { |
166 var callFrame = callFrames[i]; | 120 var callFrame = callFrames[i]; |
167 var callFrameItem = new WebInspector.CallStackSidebarPane.CallFrame(
callFrame.functionName, callFrame.location(), this._linkifier, callFrame, this._
locationPool); | 121 var callFrameItem = new WebInspector.CallStackSidebarPane.CallFrame(
callFrame.functionName, callFrame.location(), this._linkifier, callFrame, this._
locationPool); |
168 callFrameItem.element.addEventListener("click", this._callFrameSelec
ted.bind(this, callFrameItem), false); | 122 callFrameItem.element.addEventListener("click", this._callFrameSelec
ted.bind(this, callFrameItem), false); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 var uiLocation = liveLocation.uiLocation(); | 443 var uiLocation = liveLocation.uiLocation(); |
490 if (!uiLocation) | 444 if (!uiLocation) |
491 return; | 445 return; |
492 var text = uiLocation.linkText(); | 446 var text = uiLocation.linkText(); |
493 this.setSubtitle(text.trimMiddle(30)); | 447 this.setSubtitle(text.trimMiddle(30)); |
494 this.subtitleElement.title = text; | 448 this.subtitleElement.title = text; |
495 }, | 449 }, |
496 | 450 |
497 __proto__: WebInspector.UIList.Item.prototype | 451 __proto__: WebInspector.UIList.Item.prototype |
498 } | 452 } |
OLD | NEW |