| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 /** | 25 /** |
| 26 * @implements {WebInspector.ContextFlavorListener} | 26 * @implements {UI.ContextFlavorListener} |
| 27 * @unrestricted | 27 * @unrestricted |
| 28 */ | 28 */ |
| 29 WebInspector.CallStackSidebarPane = class extends WebInspector.SimpleView { | 29 Sources.CallStackSidebarPane = class extends UI.SimpleView { |
| 30 constructor() { | 30 constructor() { |
| 31 super(WebInspector.UIString('Call Stack')); | 31 super(Common.UIString('Call Stack')); |
| 32 this.element.addEventListener('keydown', this._keyDown.bind(this), true); | 32 this.element.addEventListener('keydown', this._keyDown.bind(this), true); |
| 33 this.element.tabIndex = 0; | 33 this.element.tabIndex = 0; |
| 34 this.callFrameList = new WebInspector.UIList(); | 34 this.callFrameList = new Sources.UIList(); |
| 35 this.callFrameList.show(this.element); | 35 this.callFrameList.show(this.element); |
| 36 this._linkifier = new WebInspector.Linkifier(); | 36 this._linkifier = new Components.Linkifier(); |
| 37 WebInspector.moduleSetting('enableAsyncStackTraces').addChangeListener(this.
_asyncStackTracesStateChanged, this); | 37 Common.moduleSetting('enableAsyncStackTraces').addChangeListener(this._async
StackTracesStateChanged, this); |
| 38 WebInspector.moduleSetting('skipStackFramesPattern').addChangeListener(this.
_update, this); | 38 Common.moduleSetting('skipStackFramesPattern').addChangeListener(this._updat
e, this); |
| 39 /** @type {!Array<!WebInspector.CallStackSidebarPane.CallFrame>} */ | 39 /** @type {!Array<!Sources.CallStackSidebarPane.CallFrame>} */ |
| 40 this.callFrames = []; | 40 this.callFrames = []; |
| 41 this._locationPool = new WebInspector.LiveLocationPool(); | 41 this._locationPool = new Bindings.LiveLocationPool(); |
| 42 this._update(); | 42 this._update(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @override | 46 * @override |
| 47 * @param {?Object} object | 47 * @param {?Object} object |
| 48 */ | 48 */ |
| 49 flavorChanged(object) { | 49 flavorChanged(object) { |
| 50 this._update(); | 50 this._update(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 _update() { | 53 _update() { |
| 54 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDetails
); | 54 var details = UI.context.flavor(SDK.DebuggerPausedDetails); |
| 55 | 55 |
| 56 this.callFrameList.detach(); | 56 this.callFrameList.detach(); |
| 57 this.callFrameList.clear(); | 57 this.callFrameList.clear(); |
| 58 this._linkifier.reset(); | 58 this._linkifier.reset(); |
| 59 this.element.removeChildren(); | 59 this.element.removeChildren(); |
| 60 this._locationPool.disposeAll(); | 60 this._locationPool.disposeAll(); |
| 61 | 61 |
| 62 this.callFrameList.show(this.element); | 62 this.callFrameList.show(this.element); |
| 63 delete this._hiddenCallFramesMessageElement; | 63 delete this._hiddenCallFramesMessageElement; |
| 64 this.callFrames = []; | 64 this.callFrames = []; |
| 65 this._hiddenCallFrames = 0; | 65 this._hiddenCallFrames = 0; |
| 66 | 66 |
| 67 if (!details) { | 67 if (!details) { |
| 68 var infoElement = this.element.createChild('div', 'gray-info-message'); | 68 var infoElement = this.element.createChild('div', 'gray-info-message'); |
| 69 infoElement.textContent = WebInspector.UIString('Not Paused'); | 69 infoElement.textContent = Common.UIString('Not Paused'); |
| 70 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame, null)
; | 70 UI.context.setFlavor(SDK.DebuggerModel.CallFrame, null); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 this._debuggerModel = details.debuggerModel; | 73 this._debuggerModel = details.debuggerModel; |
| 74 var asyncStackTrace = details.asyncStackTrace; | 74 var asyncStackTrace = details.asyncStackTrace; |
| 75 | 75 |
| 76 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callFrame
s)); | 76 this._appendSidebarCallFrames(this._callFramesFromDebugger(details.callFrame
s)); |
| 77 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length); | 77 var topStackHidden = (this._hiddenCallFrames === this.callFrames.length); |
| 78 | 78 |
| 79 var peviousStackTrace = details.callFrames; | 79 var peviousStackTrace = details.callFrames; |
| 80 while (asyncStackTrace) { | 80 while (asyncStackTrace) { |
| 81 var title = ''; | 81 var title = ''; |
| 82 if (asyncStackTrace.description === 'async function') { | 82 if (asyncStackTrace.description === 'async function') { |
| 83 var lastPreviousFrame = peviousStackTrace[peviousStackTrace.length - 1]; | 83 var lastPreviousFrame = peviousStackTrace[peviousStackTrace.length - 1]; |
| 84 var topFrame = asyncStackTrace.callFrames[0]; | 84 var topFrame = asyncStackTrace.callFrames[0]; |
| 85 var lastPreviousFrameName = WebInspector.beautifyFunctionName(lastPrevio
usFrame.functionName); | 85 var lastPreviousFrameName = UI.beautifyFunctionName(lastPreviousFrame.fu
nctionName); |
| 86 var topFrameName = WebInspector.beautifyFunctionName(topFrame.functionNa
me); | 86 var topFrameName = UI.beautifyFunctionName(topFrame.functionName); |
| 87 title = topFrameName + ' awaits ' + lastPreviousFrameName; | 87 title = topFrameName + ' awaits ' + lastPreviousFrameName; |
| 88 } else { | 88 } else { |
| 89 title = WebInspector.asyncStackTraceLabel(asyncStackTrace.description); | 89 title = UI.asyncStackTraceLabel(asyncStackTrace.description); |
| 90 } | 90 } |
| 91 var asyncCallFrame = new WebInspector.UIList.Item(title, '', true); | 91 var asyncCallFrame = new Sources.UIList.Item(title, '', true); |
| 92 asyncCallFrame.setHoverable(false); | 92 asyncCallFrame.setHoverable(false); |
| 93 asyncCallFrame.element.addEventListener( | 93 asyncCallFrame.element.addEventListener( |
| 94 'contextmenu', this._asyncCallFrameContextMenu.bind(this, this.callFra
mes.length), true); | 94 'contextmenu', this._asyncCallFrameContextMenu.bind(this, this.callFra
mes.length), true); |
| 95 this._appendSidebarCallFrames( | 95 this._appendSidebarCallFrames( |
| 96 this._callFramesFromRuntime(asyncStackTrace.callFrames, asyncCallFrame
), asyncCallFrame); | 96 this._callFramesFromRuntime(asyncStackTrace.callFrames, asyncCallFrame
), asyncCallFrame); |
| 97 peviousStackTrace = asyncStackTrace.callFrames; | 97 peviousStackTrace = asyncStackTrace.callFrames; |
| 98 asyncStackTrace = asyncStackTrace.parent; | 98 asyncStackTrace = asyncStackTrace.parent; |
| 99 } | 99 } |
| 100 | 100 |
| 101 if (topStackHidden) | 101 if (topStackHidden) |
| 102 this._revealHiddenCallFrames(); | 102 this._revealHiddenCallFrames(); |
| 103 if (this._hiddenCallFrames) { | 103 if (this._hiddenCallFrames) { |
| 104 var element = createElementWithClass('div', 'hidden-callframes-message'); | 104 var element = createElementWithClass('div', 'hidden-callframes-message'); |
| 105 if (this._hiddenCallFrames === 1) | 105 if (this._hiddenCallFrames === 1) |
| 106 element.textContent = WebInspector.UIString('1 stack frame is hidden (bl
ack-boxed).'); | 106 element.textContent = Common.UIString('1 stack frame is hidden (black-bo
xed).'); |
| 107 else | 107 else |
| 108 element.textContent = | 108 element.textContent = |
| 109 WebInspector.UIString('%d stack frames are hidden (black-boxed).', t
his._hiddenCallFrames); | 109 Common.UIString('%d stack frames are hidden (black-boxed).', this._h
iddenCallFrames); |
| 110 element.createTextChild(' '); | 110 element.createTextChild(' '); |
| 111 var showAllLink = element.createChild('span', 'link'); | 111 var showAllLink = element.createChild('span', 'link'); |
| 112 showAllLink.textContent = WebInspector.UIString('Show'); | 112 showAllLink.textContent = Common.UIString('Show'); |
| 113 showAllLink.addEventListener('click', this._revealHiddenCallFrames.bind(th
is), false); | 113 showAllLink.addEventListener('click', this._revealHiddenCallFrames.bind(th
is), false); |
| 114 this.element.insertBefore(element, this.element.firstChild); | 114 this.element.insertBefore(element, this.element.firstChild); |
| 115 this._hiddenCallFramesMessageElement = element; | 115 this._hiddenCallFramesMessageElement = element; |
| 116 } | 116 } |
| 117 this._selectNextVisibleCallFrame(0); | 117 this._selectNextVisibleCallFrame(0); |
| 118 this.revealView(); | 118 this.revealView(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames | 122 * @param {!Array.<!SDK.DebuggerModel.CallFrame>} callFrames |
| 123 * @return {!Array<!WebInspector.CallStackSidebarPane.CallFrame>} | 123 * @return {!Array<!Sources.CallStackSidebarPane.CallFrame>} |
| 124 */ | 124 */ |
| 125 _callFramesFromDebugger(callFrames) { | 125 _callFramesFromDebugger(callFrames) { |
| 126 var callFrameItems = []; | 126 var callFrameItems = []; |
| 127 for (var i = 0, n = callFrames.length; i < n; ++i) { | 127 for (var i = 0, n = callFrames.length; i < n; ++i) { |
| 128 var callFrame = callFrames[i]; | 128 var callFrame = callFrames[i]; |
| 129 var callFrameItem = new WebInspector.CallStackSidebarPane.CallFrame( | 129 var callFrameItem = new Sources.CallStackSidebarPane.CallFrame( |
| 130 callFrame.functionName, callFrame.location(), this._linkifier, callFra
me, this._locationPool); | 130 callFrame.functionName, callFrame.location(), this._linkifier, callFra
me, this._locationPool); |
| 131 callFrameItem.element.addEventListener('click', this._callFrameSelected.bi
nd(this, callFrameItem), false); | 131 callFrameItem.element.addEventListener('click', this._callFrameSelected.bi
nd(this, callFrameItem), false); |
| 132 callFrameItems.push(callFrameItem); | 132 callFrameItems.push(callFrameItem); |
| 133 } | 133 } |
| 134 return callFrameItems; | 134 return callFrameItems; |
| 135 } | 135 } |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * @param {!Array<!Protocol.Runtime.CallFrame>} callFrames | 138 * @param {!Array<!Protocol.Runtime.CallFrame>} callFrames |
| 139 * @param {!WebInspector.UIList.Item} asyncCallFrameItem | 139 * @param {!Sources.UIList.Item} asyncCallFrameItem |
| 140 * @return {!Array<!WebInspector.CallStackSidebarPane.CallFrame>} | 140 * @return {!Array<!Sources.CallStackSidebarPane.CallFrame>} |
| 141 */ | 141 */ |
| 142 _callFramesFromRuntime(callFrames, asyncCallFrameItem) { | 142 _callFramesFromRuntime(callFrames, asyncCallFrameItem) { |
| 143 var callFrameItems = []; | 143 var callFrameItems = []; |
| 144 for (var i = 0, n = callFrames.length; i < n; ++i) { | 144 for (var i = 0, n = callFrames.length; i < n; ++i) { |
| 145 var callFrame = callFrames[i]; | 145 var callFrame = callFrames[i]; |
| 146 var location = new WebInspector.DebuggerModel.Location( | 146 var location = new SDK.DebuggerModel.Location( |
| 147 this._debuggerModel, callFrame.scriptId, callFrame.lineNumber, callFra
me.columnNumber); | 147 this._debuggerModel, callFrame.scriptId, callFrame.lineNumber, callFra
me.columnNumber); |
| 148 var callFrameItem = new WebInspector.CallStackSidebarPane.CallFrame( | 148 var callFrameItem = new Sources.CallStackSidebarPane.CallFrame( |
| 149 callFrame.functionName, location, this._linkifier, null, this._locatio
nPool, asyncCallFrameItem); | 149 callFrame.functionName, location, this._linkifier, null, this._locatio
nPool, asyncCallFrameItem); |
| 150 callFrameItem.element.addEventListener('click', this._asyncCallFrameClicke
d.bind(this, callFrameItem), false); | 150 callFrameItem.element.addEventListener('click', this._asyncCallFrameClicke
d.bind(this, callFrameItem), false); |
| 151 callFrameItems.push(callFrameItem); | 151 callFrameItems.push(callFrameItem); |
| 152 } | 152 } |
| 153 return callFrameItems; | 153 return callFrameItems; |
| 154 } | 154 } |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * @param {!Array.<!WebInspector.CallStackSidebarPane.CallFrame>} callFrames | 157 * @param {!Array.<!Sources.CallStackSidebarPane.CallFrame>} callFrames |
| 158 * @param {!WebInspector.UIList.Item=} asyncCallFrameItem | 158 * @param {!Sources.UIList.Item=} asyncCallFrameItem |
| 159 */ | 159 */ |
| 160 _appendSidebarCallFrames(callFrames, asyncCallFrameItem) { | 160 _appendSidebarCallFrames(callFrames, asyncCallFrameItem) { |
| 161 if (asyncCallFrameItem) | 161 if (asyncCallFrameItem) |
| 162 this.callFrameList.addItem(asyncCallFrameItem); | 162 this.callFrameList.addItem(asyncCallFrameItem); |
| 163 | 163 |
| 164 var allCallFramesHidden = true; | 164 var allCallFramesHidden = true; |
| 165 for (var i = 0, n = callFrames.length; i < n; ++i) { | 165 for (var i = 0, n = callFrames.length; i < n; ++i) { |
| 166 var callFrameItem = callFrames[i]; | 166 var callFrameItem = callFrames[i]; |
| 167 callFrameItem.element.addEventListener('contextmenu', this._callFrameConte
xtMenu.bind(this, callFrameItem), true); | 167 callFrameItem.element.addEventListener('contextmenu', this._callFrameConte
xtMenu.bind(this, callFrameItem), true); |
| 168 this.callFrames.push(callFrameItem); | 168 this.callFrames.push(callFrameItem); |
| 169 | 169 |
| 170 if (WebInspector.blackboxManager.isBlackboxedRawLocation(callFrameItem._lo
cation)) { | 170 if (Bindings.blackboxManager.isBlackboxedRawLocation(callFrameItem._locati
on)) { |
| 171 callFrameItem.setHidden(true); | 171 callFrameItem.setHidden(true); |
| 172 callFrameItem.setDimmed(true); | 172 callFrameItem.setDimmed(true); |
| 173 ++this._hiddenCallFrames; | 173 ++this._hiddenCallFrames; |
| 174 } else { | 174 } else { |
| 175 this.callFrameList.addItem(callFrameItem); | 175 this.callFrameList.addItem(callFrameItem); |
| 176 allCallFramesHidden = false; | 176 allCallFramesHidden = false; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 if (allCallFramesHidden && asyncCallFrameItem) { | 179 if (allCallFramesHidden && asyncCallFrameItem) { |
| 180 asyncCallFrameItem.setHidden(true); | 180 asyncCallFrameItem.setHidden(true); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 197 callFrame.setHidden(false); | 197 callFrame.setHidden(false); |
| 198 this.callFrameList.addItem(callFrame); | 198 this.callFrameList.addItem(callFrame); |
| 199 } | 199 } |
| 200 if (this._hiddenCallFramesMessageElement) { | 200 if (this._hiddenCallFramesMessageElement) { |
| 201 this._hiddenCallFramesMessageElement.remove(); | 201 this._hiddenCallFramesMessageElement.remove(); |
| 202 delete this._hiddenCallFramesMessageElement; | 202 delete this._hiddenCallFramesMessageElement; |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * @param {!WebInspector.CallStackSidebarPane.CallFrame} callFrame | 207 * @param {!Sources.CallStackSidebarPane.CallFrame} callFrame |
| 208 * @param {!Event} event | 208 * @param {!Event} event |
| 209 */ | 209 */ |
| 210 _callFrameContextMenu(callFrame, event) { | 210 _callFrameContextMenu(callFrame, event) { |
| 211 var contextMenu = new WebInspector.ContextMenu(event); | 211 var contextMenu = new UI.ContextMenu(event); |
| 212 var debuggerCallFrame = callFrame._debuggerCallFrame; | 212 var debuggerCallFrame = callFrame._debuggerCallFrame; |
| 213 if (debuggerCallFrame) | 213 if (debuggerCallFrame) |
| 214 contextMenu.appendItem( | 214 contextMenu.appendItem( |
| 215 WebInspector.UIString.capitalize('Restart ^frame'), debuggerCallFrame.
restart.bind(debuggerCallFrame)); | 215 Common.UIString.capitalize('Restart ^frame'), debuggerCallFrame.restar
t.bind(debuggerCallFrame)); |
| 216 | 216 |
| 217 contextMenu.appendItem(WebInspector.UIString.capitalize('Copy ^stack ^trace'
), this._copyStackTrace.bind(this)); | 217 contextMenu.appendItem(Common.UIString.capitalize('Copy ^stack ^trace'), thi
s._copyStackTrace.bind(this)); |
| 218 | 218 |
| 219 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILocati
on(callFrame._location); | 219 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(c
allFrame._location); |
| 220 this.appendBlackboxURLContextMenuItems(contextMenu, uiLocation.uiSourceCode)
; | 220 this.appendBlackboxURLContextMenuItems(contextMenu, uiLocation.uiSourceCode)
; |
| 221 | 221 |
| 222 contextMenu.show(); | 222 contextMenu.show(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 /** | 225 /** |
| 226 * @param {number} index | 226 * @param {number} index |
| 227 * @param {!Event} event | 227 * @param {!Event} event |
| 228 */ | 228 */ |
| 229 _asyncCallFrameContextMenu(index, event) { | 229 _asyncCallFrameContextMenu(index, event) { |
| 230 for (; index < this.callFrames.length; ++index) { | 230 for (; index < this.callFrames.length; ++index) { |
| 231 var callFrame = this.callFrames[index]; | 231 var callFrame = this.callFrames[index]; |
| 232 if (!callFrame.isHidden()) { | 232 if (!callFrame.isHidden()) { |
| 233 this._callFrameContextMenu(callFrame, event); | 233 this._callFrameContextMenu(callFrame, event); |
| 234 break; | 234 break; |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 /** | 239 /** |
| 240 * @param {!WebInspector.ContextMenu} contextMenu | 240 * @param {!UI.ContextMenu} contextMenu |
| 241 * @param {!WebInspector.UISourceCode} uiSourceCode | 241 * @param {!Workspace.UISourceCode} uiSourceCode |
| 242 */ | 242 */ |
| 243 appendBlackboxURLContextMenuItems(contextMenu, uiSourceCode) { | 243 appendBlackboxURLContextMenuItems(contextMenu, uiSourceCode) { |
| 244 var binding = WebInspector.persistence.binding(uiSourceCode); | 244 var binding = Persistence.persistence.binding(uiSourceCode); |
| 245 if (binding) | 245 if (binding) |
| 246 uiSourceCode = binding.network; | 246 uiSourceCode = binding.network; |
| 247 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) | 247 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) |
| 248 return; | 248 return; |
| 249 var canBlackbox = WebInspector.blackboxManager.canBlackboxUISourceCode(uiSou
rceCode); | 249 var canBlackbox = Bindings.blackboxManager.canBlackboxUISourceCode(uiSourceC
ode); |
| 250 var isBlackboxed = WebInspector.blackboxManager.isBlackboxedUISourceCode(uiS
ourceCode); | 250 var isBlackboxed = Bindings.blackboxManager.isBlackboxedUISourceCode(uiSourc
eCode); |
| 251 var isContentScript = uiSourceCode.project().type() === WebInspector.project
Types.ContentScripts; | 251 var isContentScript = uiSourceCode.project().type() === Workspace.projectTyp
es.ContentScripts; |
| 252 | 252 |
| 253 var manager = WebInspector.blackboxManager; | 253 var manager = Bindings.blackboxManager; |
| 254 if (canBlackbox) { | 254 if (canBlackbox) { |
| 255 if (isBlackboxed) | 255 if (isBlackboxed) |
| 256 contextMenu.appendItem( | 256 contextMenu.appendItem( |
| 257 WebInspector.UIString.capitalize('Stop ^blackboxing'), | 257 Common.UIString.capitalize('Stop ^blackboxing'), |
| 258 manager.unblackboxUISourceCode.bind(manager, uiSourceCode)); | 258 manager.unblackboxUISourceCode.bind(manager, uiSourceCode)); |
| 259 else | 259 else |
| 260 contextMenu.appendItem( | 260 contextMenu.appendItem( |
| 261 WebInspector.UIString.capitalize('Blackbox ^script'), | 261 Common.UIString.capitalize('Blackbox ^script'), |
| 262 manager.blackboxUISourceCode.bind(manager, uiSourceCode)); | 262 manager.blackboxUISourceCode.bind(manager, uiSourceCode)); |
| 263 } | 263 } |
| 264 if (isContentScript) { | 264 if (isContentScript) { |
| 265 if (isBlackboxed) | 265 if (isBlackboxed) |
| 266 contextMenu.appendItem( | 266 contextMenu.appendItem( |
| 267 WebInspector.UIString.capitalize('Stop blackboxing ^all ^content ^sc
ripts'), | 267 Common.UIString.capitalize('Stop blackboxing ^all ^content ^scripts'
), |
| 268 manager.blackboxContentScripts.bind(manager)); | 268 manager.blackboxContentScripts.bind(manager)); |
| 269 else | 269 else |
| 270 contextMenu.appendItem( | 270 contextMenu.appendItem( |
| 271 WebInspector.UIString.capitalize('Blackbox ^all ^content ^scripts'), | 271 Common.UIString.capitalize('Blackbox ^all ^content ^scripts'), |
| 272 manager.unblackboxContentScripts.bind(manager)); | 272 manager.unblackboxContentScripts.bind(manager)); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 _asyncStackTracesStateChanged() { | 276 _asyncStackTracesStateChanged() { |
| 277 var enabled = WebInspector.moduleSetting('enableAsyncStackTraces').get(); | 277 var enabled = Common.moduleSetting('enableAsyncStackTraces').get(); |
| 278 if (!enabled && this.callFrames) | 278 if (!enabled && this.callFrames) |
| 279 this._removeAsyncCallFrames(); | 279 this._removeAsyncCallFrames(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 _removeAsyncCallFrames() { | 282 _removeAsyncCallFrames() { |
| 283 var shouldSelectTopFrame = false; | 283 var shouldSelectTopFrame = false; |
| 284 var lastSyncCallFrameIndex = -1; | 284 var lastSyncCallFrameIndex = -1; |
| 285 for (var i = 0; i < this.callFrames.length; ++i) { | 285 for (var i = 0; i < this.callFrames.length; ++i) { |
| 286 var callFrame = this.callFrames[i]; | 286 var callFrame = this.callFrames[i]; |
| 287 if (callFrame._asyncCallFrame) { | 287 if (callFrame._asyncCallFrame) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (!selectedCallFrame) | 345 if (!selectedCallFrame) |
| 346 return -1; | 346 return -1; |
| 347 for (var i = 0; i < this.callFrames.length; ++i) { | 347 for (var i = 0; i < this.callFrames.length; ++i) { |
| 348 if (this.callFrames[i]._debuggerCallFrame === selectedCallFrame) | 348 if (this.callFrames[i]._debuggerCallFrame === selectedCallFrame) |
| 349 return i; | 349 return i; |
| 350 } | 350 } |
| 351 return -1; | 351 return -1; |
| 352 } | 352 } |
| 353 | 353 |
| 354 /** | 354 /** |
| 355 * @param {!WebInspector.CallStackSidebarPane.CallFrame} callFrameItem | 355 * @param {!Sources.CallStackSidebarPane.CallFrame} callFrameItem |
| 356 */ | 356 */ |
| 357 _asyncCallFrameClicked(callFrameItem) { | 357 _asyncCallFrameClicked(callFrameItem) { |
| 358 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILocati
on(callFrameItem._location); | 358 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(c
allFrameItem._location); |
| 359 WebInspector.Revealer.reveal(uiLocation); | 359 Common.Revealer.reveal(uiLocation); |
| 360 } | 360 } |
| 361 | 361 |
| 362 /** | 362 /** |
| 363 * @param {!WebInspector.CallStackSidebarPane.CallFrame} selectedCallFrame | 363 * @param {!Sources.CallStackSidebarPane.CallFrame} selectedCallFrame |
| 364 */ | 364 */ |
| 365 _callFrameSelected(selectedCallFrame) { | 365 _callFrameSelected(selectedCallFrame) { |
| 366 selectedCallFrame.element.scrollIntoViewIfNeeded(); | 366 selectedCallFrame.element.scrollIntoViewIfNeeded(); |
| 367 var callFrame = selectedCallFrame._debuggerCallFrame; | 367 var callFrame = selectedCallFrame._debuggerCallFrame; |
| 368 | 368 |
| 369 for (var i = 0; i < this.callFrames.length; ++i) { | 369 for (var i = 0; i < this.callFrames.length; ++i) { |
| 370 var callFrameItem = this.callFrames[i]; | 370 var callFrameItem = this.callFrames[i]; |
| 371 callFrameItem.setSelected(callFrameItem === selectedCallFrame); | 371 callFrameItem.setSelected(callFrameItem === selectedCallFrame); |
| 372 if (callFrameItem.isSelected() && callFrameItem.isHidden()) | 372 if (callFrameItem.isSelected() && callFrameItem.isHidden()) |
| 373 this._revealHiddenCallFrames(); | 373 this._revealHiddenCallFrames(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 var oldCallFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.Ca
llFrame); | 376 var oldCallFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); |
| 377 if (oldCallFrame === callFrame) { | 377 if (oldCallFrame === callFrame) { |
| 378 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILoca
tion(callFrame.location()); | 378 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocation
(callFrame.location()); |
| 379 WebInspector.Revealer.reveal(uiLocation); | 379 Common.Revealer.reveal(uiLocation); |
| 380 return; | 380 return; |
| 381 } | 381 } |
| 382 | 382 |
| 383 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame, callFra
me); | 383 UI.context.setFlavor(SDK.DebuggerModel.CallFrame, callFrame); |
| 384 callFrame.debuggerModel.setSelectedCallFrame(callFrame); | 384 callFrame.debuggerModel.setSelectedCallFrame(callFrame); |
| 385 } | 385 } |
| 386 | 386 |
| 387 _copyStackTrace() { | 387 _copyStackTrace() { |
| 388 var text = ''; | 388 var text = ''; |
| 389 var lastCallFrame = null; | 389 var lastCallFrame = null; |
| 390 for (var i = 0; i < this.callFrames.length; ++i) { | 390 for (var i = 0; i < this.callFrames.length; ++i) { |
| 391 var callFrame = this.callFrames[i]; | 391 var callFrame = this.callFrames[i]; |
| 392 if (callFrame.isHidden()) | 392 if (callFrame.isHidden()) |
| 393 continue; | 393 continue; |
| 394 if (lastCallFrame && callFrame._asyncCallFrame !== lastCallFrame._asyncCal
lFrame) | 394 if (lastCallFrame && callFrame._asyncCallFrame !== lastCallFrame._asyncCal
lFrame) |
| 395 text += callFrame._asyncCallFrame.title() + '\n'; | 395 text += callFrame._asyncCallFrame.title() + '\n'; |
| 396 text += callFrame.title() + ' (' + callFrame.subtitle() + ')\n'; | 396 text += callFrame.title() + ' (' + callFrame.subtitle() + ')\n'; |
| 397 lastCallFrame = callFrame; | 397 lastCallFrame = callFrame; |
| 398 } | 398 } |
| 399 InspectorFrontendHost.copyText(text); | 399 InspectorFrontendHost.copyText(text); |
| 400 } | 400 } |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, functi
on(!Event=):boolean)} registerShortcutDelegate | 403 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event=
):boolean)} registerShortcutDelegate |
| 404 */ | 404 */ |
| 405 registerShortcuts(registerShortcutDelegate) { | 405 registerShortcuts(registerShortcutDelegate) { |
| 406 registerShortcutDelegate( | 406 registerShortcutDelegate( |
| 407 WebInspector.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame, this._
selectNextCallFrameOnStack.bind(this)); | 407 Components.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame, this._se
lectNextCallFrameOnStack.bind(this)); |
| 408 registerShortcutDelegate( | 408 registerShortcutDelegate( |
| 409 WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame, | 409 Components.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame, |
| 410 this._selectPreviousCallFrameOnStack.bind(this)); | 410 this._selectPreviousCallFrameOnStack.bind(this)); |
| 411 } | 411 } |
| 412 | 412 |
| 413 _keyDown(event) { | 413 _keyDown(event) { |
| 414 if (event.altKey || event.shiftKey || event.metaKey || event.ctrlKey) | 414 if (event.altKey || event.shiftKey || event.metaKey || event.ctrlKey) |
| 415 return; | 415 return; |
| 416 if (event.key === 'ArrowUp' && this._selectPreviousCallFrameOnStack() || | 416 if (event.key === 'ArrowUp' && this._selectPreviousCallFrameOnStack() || |
| 417 event.key === 'ArrowDown' && this._selectNextCallFrameOnStack()) | 417 event.key === 'ArrowDown' && this._selectNextCallFrameOnStack()) |
| 418 event.consume(true); | 418 event.consume(true); |
| 419 } | 419 } |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 /** | 422 /** |
| 423 * @unrestricted | 423 * @unrestricted |
| 424 */ | 424 */ |
| 425 WebInspector.CallStackSidebarPane.CallFrame = class extends WebInspector.UIList.
Item { | 425 Sources.CallStackSidebarPane.CallFrame = class extends Sources.UIList.Item { |
| 426 /** | 426 /** |
| 427 * @param {string} functionName | 427 * @param {string} functionName |
| 428 * @param {!WebInspector.DebuggerModel.Location} location | 428 * @param {!SDK.DebuggerModel.Location} location |
| 429 * @param {!WebInspector.Linkifier} linkifier | 429 * @param {!Components.Linkifier} linkifier |
| 430 * @param {?WebInspector.DebuggerModel.CallFrame} debuggerCallFrame | 430 * @param {?SDK.DebuggerModel.CallFrame} debuggerCallFrame |
| 431 * @param {!WebInspector.LiveLocationPool} locationPool | 431 * @param {!Bindings.LiveLocationPool} locationPool |
| 432 * @param {!WebInspector.UIList.Item=} asyncCallFrame | 432 * @param {!Sources.UIList.Item=} asyncCallFrame |
| 433 */ | 433 */ |
| 434 constructor(functionName, location, linkifier, debuggerCallFrame, locationPool
, asyncCallFrame) { | 434 constructor(functionName, location, linkifier, debuggerCallFrame, locationPool
, asyncCallFrame) { |
| 435 super(WebInspector.beautifyFunctionName(functionName), ''); | 435 super(UI.beautifyFunctionName(functionName), ''); |
| 436 this._location = location; | 436 this._location = location; |
| 437 this._debuggerCallFrame = debuggerCallFrame; | 437 this._debuggerCallFrame = debuggerCallFrame; |
| 438 this._asyncCallFrame = asyncCallFrame; | 438 this._asyncCallFrame = asyncCallFrame; |
| 439 WebInspector.debuggerWorkspaceBinding.createCallFrameLiveLocation(location,
this._update.bind(this), locationPool); | 439 Bindings.debuggerWorkspaceBinding.createCallFrameLiveLocation(location, this
._update.bind(this), locationPool); |
| 440 } | 440 } |
| 441 | 441 |
| 442 /** | 442 /** |
| 443 * @param {!WebInspector.LiveLocation} liveLocation | 443 * @param {!Bindings.LiveLocation} liveLocation |
| 444 */ | 444 */ |
| 445 _update(liveLocation) { | 445 _update(liveLocation) { |
| 446 var uiLocation = liveLocation.uiLocation(); | 446 var uiLocation = liveLocation.uiLocation(); |
| 447 if (!uiLocation) | 447 if (!uiLocation) |
| 448 return; | 448 return; |
| 449 var text = uiLocation.linkText(); | 449 var text = uiLocation.linkText(); |
| 450 this.setSubtitle(text.trimMiddle(30)); | 450 this.setSubtitle(text.trimMiddle(30)); |
| 451 this.subtitleElement.title = text; | 451 this.subtitleElement.title = text; |
| 452 } | 452 } |
| 453 }; | 453 }; |
| OLD | NEW |