| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | |
| 4 * | |
| 5 * Redistribution and use in source and binary forms, with or without | |
| 6 * modification, are permitted provided that the following conditions | |
| 7 * are met: | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer in the | |
| 12 * documentation and/or other materials provided with the distribution. | |
| 13 * | |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | |
| 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 25 */ | |
| 26 | |
| 27 importScript("BreakpointsSidebarPane.js"); | |
| 28 importScript("CallStackSidebarPane.js"); | |
| 29 importScript("FilePathScoreFunction.js"); | |
| 30 importScript("FilteredItemSelectionDialog.js"); | |
| 31 importScript("UISourceCodeFrame.js"); | |
| 32 importScript("JavaScriptSourceFrame.js"); | |
| 33 importScript("NavigatorOverlayController.js"); | |
| 34 importScript("NavigatorView.js"); | |
| 35 importScript("RevisionHistoryView.js"); | |
| 36 importScript("ScopeChainSidebarPane.js"); | |
| 37 importScript("ScriptsNavigator.js"); | |
| 38 importScript("ScriptsSearchScope.js"); | |
| 39 importScript("StyleSheetOutlineDialog.js"); | |
| 40 importScript("TabbedEditorContainer.js"); | |
| 41 importScript("WatchExpressionsSidebarPane.js"); | |
| 42 importScript("WorkersSidebarPane.js"); | |
| 43 | |
| 44 /** | |
| 45 * @constructor | |
| 46 * @implements {WebInspector.TabbedEditorContainerDelegate} | |
| 47 * @implements {WebInspector.ContextMenu.Provider} | |
| 48 * @extends {WebInspector.Panel} | |
| 49 * @param {WebInspector.Workspace=} workspaceForTest | |
| 50 */ | |
| 51 WebInspector.ScriptsPanel = function(workspaceForTest) | |
| 52 { | |
| 53 WebInspector.Panel.call(this, "scripts"); | |
| 54 this.registerRequiredCSS("scriptsPanel.css"); | |
| 55 this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplet
e. | |
| 56 | |
| 57 WebInspector.settings.navigatorWasOnceHidden = WebInspector.settings.createS
etting("navigatorWasOnceHidden", false); | |
| 58 WebInspector.settings.debuggerSidebarHidden = WebInspector.settings.createSe
tting("debuggerSidebarHidden", false); | |
| 59 | |
| 60 this._workspace = workspaceForTest || WebInspector.workspace; | |
| 61 | |
| 62 function viewGetter() | |
| 63 { | |
| 64 return this.visibleView; | |
| 65 } | |
| 66 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | |
| 67 | |
| 68 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString
("Sources Panel")); | |
| 69 this.debugToolbar = this._createDebugToolbar(); | |
| 70 | |
| 71 const initialDebugSidebarWidth = 225; | |
| 72 const minimumDebugSidebarWidthPercent = 0.5; | |
| 73 this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPositio
n.End, initialDebugSidebarWidth); | |
| 74 this.splitView.element.id = "scripts-split-view"; | |
| 75 this.splitView.setSidebarElementConstraints(Preferences.minScriptsSidebarWid
th); | |
| 76 this.splitView.setMainElementConstraints(minimumDebugSidebarWidthPercent); | |
| 77 | |
| 78 // Create scripts navigator | |
| 79 const initialNavigatorWidth = 225; | |
| 80 const minimumViewsContainerWidthPercent = 0.5; | |
| 81 this.editorView = new WebInspector.SidebarView(WebInspector.SidebarView.Side
barPosition.Start, "scriptsPanelNavigatorSidebarWidth", initialNavigatorWidth); | |
| 82 this.editorView.element.tabIndex = 0; | |
| 83 | |
| 84 this.editorView.setSidebarElementConstraints(Preferences.minScriptsSidebarWi
dth); | |
| 85 this.editorView.setMainElementConstraints(minimumViewsContainerWidthPercent)
; | |
| 86 this.editorView.show(this.splitView.mainElement); | |
| 87 | |
| 88 this._navigator = new WebInspector.ScriptsNavigator(); | |
| 89 this._navigator.view.show(this.editorView.sidebarElement); | |
| 90 | |
| 91 var tabbedEditorPlaceholderText = WebInspector.isMac() ? WebInspector.UIStri
ng("Hit Cmd+O to open a file") : WebInspector.UIString("Hit Ctrl+O to open a fil
e"); | |
| 92 | |
| 93 this._editorContentsElement = this.editorView.mainElement.createChild("div",
"fill"); | |
| 94 this._editorFooterElement = this.editorView.mainElement.createChild("div", "
inspector-footer status-bar hidden"); | |
| 95 this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previo
uslyViewedFiles", tabbedEditorPlaceholderText); | |
| 96 this._editorContainer.show(this._editorContentsElement); | |
| 97 | |
| 98 this._navigatorController = new WebInspector.NavigatorOverlayController(this
.editorView, this._navigator.view, this._editorContainer.view); | |
| 99 | |
| 100 this._navigator.addEventListener(WebInspector.ScriptsNavigator.Events.Script
Selected, this._scriptSelected, this); | |
| 101 this._navigator.addEventListener(WebInspector.ScriptsNavigator.Events.ItemSe
archStarted, this._itemSearchStarted, this); | |
| 102 this._navigator.addEventListener(WebInspector.ScriptsNavigator.Events.ItemCr
eationRequested, this._itemCreationRequested, this); | |
| 103 this._navigator.addEventListener(WebInspector.ScriptsNavigator.Events.ItemRe
namingRequested, this._itemRenamingRequested, this); | |
| 104 | |
| 105 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev
ents.EditorSelected, this._editorSelected, this); | |
| 106 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev
ents.EditorClosed, this._editorClosed, this); | |
| 107 | |
| 108 this._debugSidebarResizeWidgetElement = this.splitView.mainElement.createChi
ld("div", "resizer-widget"); | |
| 109 this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-wi
dget"; | |
| 110 this.splitView.installResizer(this._debugSidebarResizeWidgetElement); | |
| 111 | |
| 112 this.sidebarPanes = {}; | |
| 113 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba
rPane(); | |
| 114 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); | |
| 115 this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPa
ne.Events.CallFrameSelected, this._callFrameSelectedInSidebar.bind(this)); | |
| 116 | |
| 117 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); | |
| 118 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide
barPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this)); | |
| 119 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); | |
| 120 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan
e(); | |
| 121 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB
reakpointsSidebarPane(); | |
| 122 | |
| 123 if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFr
ontend()) { | |
| 124 WorkerAgent.enable(); | |
| 125 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebIn
spector.workerManager); | |
| 126 } | |
| 127 | |
| 128 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th
is)); | |
| 129 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoTo
Member, this._showOutlineDialog.bind(this)); | |
| 130 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.Togg
leBreakpoint, this._toggleBreakpoint.bind(this)); | |
| 131 | |
| 132 this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspect
or.UIString("Pretty print"), "scripts-toggle-pretty-print-status-bar-item"); | |
| 133 this._toggleFormatSourceButton.toggled = false; | |
| 134 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatS
ource, this); | |
| 135 | |
| 136 this._scriptViewStatusBarItemsContainer = document.createElement("div"); | |
| 137 this._scriptViewStatusBarItemsContainer.className = "inline-block"; | |
| 138 | |
| 139 this._scriptViewStatusBarTextContainer = document.createElement("div"); | |
| 140 this._scriptViewStatusBarTextContainer.className = "inline-block"; | |
| 141 | |
| 142 this._installDebuggerSidebarController(); | |
| 143 | |
| 144 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); | |
| 145 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | |
| 146 this._dockSideChanged(); | |
| 147 | |
| 148 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.SourceFrame>} */ | |
| 149 this._sourceFramesByUISourceCode = new Map(); | |
| 150 this._updateDebuggerButtons(); | |
| 151 this._pauseOnExceptionStateChanged(); | |
| 152 if (WebInspector.debuggerModel.isPaused()) | |
| 153 this._debuggerPaused(); | |
| 154 | |
| 155 WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pa
useOnExceptionStateChanged, this); | |
| 156 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.DebuggerWasEnabled, this._debuggerWasEnabled, this); | |
| 157 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.DebuggerWasDisabled, this._debuggerWasDisabled, this); | |
| 158 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.DebuggerPaused, this._debuggerPaused, this); | |
| 159 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.DebuggerResumed, this._debuggerResumed, this); | |
| 160 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.CallFrameSelected, this._callFrameSelected, this); | |
| 161 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSel
ectedCallFrame, this); | |
| 162 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | |
| 163 | |
| 164 WebInspector.startBatchUpdate(); | |
| 165 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); | |
| 166 WebInspector.endBatchUpdate(); | |
| 167 | |
| 168 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAdded, this); | |
| 169 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR
emoved, this._uiSourceCodeRemoved, this); | |
| 170 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillRe
set, this._projectWillReset.bind(this), this); | |
| 171 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.GlobalObjectCleared, this._debuggerReset, this); | |
| 172 | |
| 173 WebInspector.advancedSearchController.registerSearchScope(new WebInspector.S
criptsSearchScope(this._workspace)); | |
| 174 | |
| 175 this._boundOnKeyUp = this._onKeyUp.bind(this); | |
| 176 this._boundOnKeyDown = this._onKeyDown.bind(this); | |
| 177 } | |
| 178 | |
| 179 WebInspector.ScriptsPanel.prototype = { | |
| 180 get statusBarItems() | |
| 181 { | |
| 182 return [this._toggleFormatSourceButton.element, this._scriptViewStatusBa
rItemsContainer]; | |
| 183 }, | |
| 184 | |
| 185 /** | |
| 186 * @return {?Element} | |
| 187 */ | |
| 188 statusBarText: function() | |
| 189 { | |
| 190 return this._scriptViewStatusBarTextContainer; | |
| 191 }, | |
| 192 | |
| 193 defaultFocusedElement: function() | |
| 194 { | |
| 195 return this._editorContainer.view.defaultFocusedElement() || this._navig
ator.view.defaultFocusedElement(); | |
| 196 }, | |
| 197 | |
| 198 get paused() | |
| 199 { | |
| 200 return this._paused; | |
| 201 }, | |
| 202 | |
| 203 wasShown: function() | |
| 204 { | |
| 205 WebInspector.Panel.prototype.wasShown.call(this); | |
| 206 this._navigatorController.wasShown(); | |
| 207 | |
| 208 this.element.addEventListener("keydown", this._boundOnKeyDown, false); | |
| 209 this.element.addEventListener("keyup", this._boundOnKeyUp, false); | |
| 210 }, | |
| 211 | |
| 212 willHide: function() | |
| 213 { | |
| 214 this.element.removeEventListener("keydown", this._boundOnKeyDown, false)
; | |
| 215 this.element.removeEventListener("keyup", this._boundOnKeyUp, false); | |
| 216 | |
| 217 WebInspector.Panel.prototype.willHide.call(this); | |
| 218 WebInspector.closeViewInDrawer(); | |
| 219 }, | |
| 220 | |
| 221 /** | |
| 222 * @param {WebInspector.Event} event | |
| 223 */ | |
| 224 _uiSourceCodeAdded: function(event) | |
| 225 { | |
| 226 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data)
; | |
| 227 this._addUISourceCode(uiSourceCode); | |
| 228 }, | |
| 229 | |
| 230 /** | |
| 231 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 232 */ | |
| 233 _addUISourceCode: function(uiSourceCode) | |
| 234 { | |
| 235 if (this._toggleFormatSourceButton.toggled) | |
| 236 uiSourceCode.setFormatted(true); | |
| 237 if (uiSourceCode.project().isServiceProject()) | |
| 238 return; | |
| 239 this._navigator.addUISourceCode(uiSourceCode); | |
| 240 this._editorContainer.addUISourceCode(uiSourceCode); | |
| 241 // Replace debugger script-based uiSourceCode with a network-based one. | |
| 242 var currentUISourceCode = this._currentUISourceCode; | |
| 243 if (currentUISourceCode && currentUISourceCode.project().isServiceProjec
t() && currentUISourceCode !== uiSourceCode && currentUISourceCode.url === uiSou
rceCode.url) { | |
| 244 this._showFile(uiSourceCode); | |
| 245 this._editorContainer.removeUISourceCode(currentUISourceCode); | |
| 246 } | |
| 247 }, | |
| 248 | |
| 249 _uiSourceCodeRemoved: function(event) | |
| 250 { | |
| 251 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data)
; | |
| 252 this._removeUISourceCodes([uiSourceCode]); | |
| 253 }, | |
| 254 | |
| 255 /** | |
| 256 * @param {Array.<WebInspector.UISourceCode>} uiSourceCodes | |
| 257 */ | |
| 258 _removeUISourceCodes: function(uiSourceCodes) | |
| 259 { | |
| 260 for (var i = 0; i < uiSourceCodes.length; ++i) { | |
| 261 this._navigator.removeUISourceCode(uiSourceCodes[i]); | |
| 262 this._removeSourceFrame(uiSourceCodes[i]); | |
| 263 } | |
| 264 this._editorContainer.removeUISourceCodes(uiSourceCodes); | |
| 265 }, | |
| 266 | |
| 267 _consoleCommandEvaluatedInSelectedCallFrame: function(event) | |
| 268 { | |
| 269 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC
allFrame()); | |
| 270 }, | |
| 271 | |
| 272 _debuggerPaused: function() | |
| 273 { | |
| 274 var details = WebInspector.debuggerModel.debuggerPausedDetails(); | |
| 275 | |
| 276 this._paused = true; | |
| 277 this._waitingToPause = false; | |
| 278 this._stepping = false; | |
| 279 | |
| 280 this._updateDebuggerButtons(); | |
| 281 | |
| 282 WebInspector.inspectorView.setCurrentPanel(this); | |
| 283 this.sidebarPanes.callstack.update(details.callFrames); | |
| 284 | |
| 285 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) { | |
| 286 WebInspector.domBreakpointsSidebarPane.highlightBreakpoint(details.a
uxData); | |
| 287 function didCreateBreakpointHitStatusMessage(element) | |
| 288 { | |
| 289 this.sidebarPanes.callstack.setStatus(element); | |
| 290 } | |
| 291 WebInspector.domBreakpointsSidebarPane.createBreakpointHitStatusMess
age(details.auxData, didCreateBreakpointHitStatusMessage.bind(this)); | |
| 292 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Eve
ntListener) { | |
| 293 var eventName = details.auxData.eventName; | |
| 294 this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(detai
ls.auxData.eventName); | |
| 295 var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPan
e.eventNameForUI(eventName, details.auxData); | |
| 296 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on a \"%s\" Event Listener.", eventNameForUI)); | |
| 297 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.XHR
) { | |
| 298 this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.auxData
["breakpointURL"]); | |
| 299 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on a XMLHttpRequest.")); | |
| 300 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Exc
eption) | |
| 301 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on exception: '%s'.", details.auxData.description)); | |
| 302 else if (details.reason === WebInspector.DebuggerModel.BreakReason.Asser
t) | |
| 303 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on assertion.")); | |
| 304 else if (details.reason === WebInspector.DebuggerModel.BreakReason.CSPVi
olation) | |
| 305 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on a script blocked due to Content Security Policy directive: \"%s\".", details.
auxData["directiveText"])); | |
| 306 else if (details.reason === WebInspector.DebuggerModel.BreakReason.Debug
Command) | |
| 307 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused
on a debugged function")); | |
| 308 else { | |
| 309 function didGetUILocation(uiLocation) | |
| 310 { | |
| 311 var breakpoint = WebInspector.breakpointManager.findBreakpoint(u
iLocation.uiSourceCode, uiLocation.lineNumber); | |
| 312 if (!breakpoint) | |
| 313 return; | |
| 314 this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint); | |
| 315 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Pau
sed on a JavaScript breakpoint.")); | |
| 316 } | |
| 317 if (details.callFrames.length) | |
| 318 details.callFrames[0].createLiveLocation(didGetUILocation.bind(t
his)); | |
| 319 else | |
| 320 console.warn("ScriptsPanel paused, but callFrames.length is zero
."); // TODO remove this once we understand this case better | |
| 321 } | |
| 322 | |
| 323 this._enableDebuggerSidebar(true); | |
| 324 this._toggleDebuggerSidebarButton.setEnabled(false); | |
| 325 window.focus(); | |
| 326 InspectorFrontendHost.bringToFront(); | |
| 327 }, | |
| 328 | |
| 329 _debuggerResumed: function() | |
| 330 { | |
| 331 this._paused = false; | |
| 332 this._waitingToPause = false; | |
| 333 this._stepping = false; | |
| 334 | |
| 335 this._clearInterface(); | |
| 336 this._toggleDebuggerSidebarButton.setEnabled(true); | |
| 337 }, | |
| 338 | |
| 339 _debuggerWasEnabled: function() | |
| 340 { | |
| 341 this._updateDebuggerButtons(); | |
| 342 }, | |
| 343 | |
| 344 _debuggerWasDisabled: function() | |
| 345 { | |
| 346 this._debuggerReset(); | |
| 347 }, | |
| 348 | |
| 349 _debuggerReset: function() | |
| 350 { | |
| 351 this._debuggerResumed(); | |
| 352 this.sidebarPanes.watchExpressions.reset(); | |
| 353 delete this._skipExecutionLineRevealing; | |
| 354 }, | |
| 355 | |
| 356 _projectWillReset: function(event) | |
| 357 { | |
| 358 var project = event.data; | |
| 359 var uiSourceCodes = project.uiSourceCodes(); | |
| 360 this._removeUISourceCodes(uiSourceCodes); | |
| 361 if (project.type() === WebInspector.projectTypes.Network) | |
| 362 this._editorContainer.reset(); | |
| 363 }, | |
| 364 | |
| 365 get visibleView() | |
| 366 { | |
| 367 return this._editorContainer.visibleView; | |
| 368 }, | |
| 369 | |
| 370 _updateScriptViewStatusBarItems: function() | |
| 371 { | |
| 372 this._scriptViewStatusBarItemsContainer.removeChildren(); | |
| 373 this._scriptViewStatusBarTextContainer.removeChildren(); | |
| 374 | |
| 375 var sourceFrame = this.visibleView; | |
| 376 if (sourceFrame) { | |
| 377 var statusBarItems = sourceFrame.statusBarItems() || []; | |
| 378 for (var i = 0; i < statusBarItems.length; ++i) | |
| 379 this._scriptViewStatusBarItemsContainer.appendChild(statusBarIte
ms[i]); | |
| 380 var statusBarText = sourceFrame.statusBarText(); | |
| 381 if (statusBarText) | |
| 382 this._scriptViewStatusBarTextContainer.appendChild(statusBarText
); | |
| 383 } | |
| 384 }, | |
| 385 | |
| 386 /** | |
| 387 * @param {Element} anchor | |
| 388 */ | |
| 389 canShowAnchorLocation: function(anchor) | |
| 390 { | |
| 391 if (WebInspector.debuggerModel.debuggerEnabled() && anchor.uiSourceCode) | |
| 392 return true; | |
| 393 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(anchor.href
); | |
| 394 if (uiSourceCode) { | |
| 395 anchor.uiSourceCode = uiSourceCode; | |
| 396 return true; | |
| 397 } | |
| 398 return false; | |
| 399 }, | |
| 400 | |
| 401 /** | |
| 402 * @param {Element} anchor | |
| 403 */ | |
| 404 showAnchorLocation: function(anchor) | |
| 405 { | |
| 406 this._showSourceLocation(anchor.uiSourceCode, anchor.lineNumber, anchor.
columnNumber); | |
| 407 }, | |
| 408 | |
| 409 /** | |
| 410 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 411 * @param {number=} lineNumber | |
| 412 * @param {number=} columnNumber | |
| 413 */ | |
| 414 showUISourceCode: function(uiSourceCode, lineNumber, columnNumber) | |
| 415 { | |
| 416 this._showSourceLocation(uiSourceCode, lineNumber, columnNumber); | |
| 417 }, | |
| 418 | |
| 419 /** | |
| 420 * @return {?WebInspector.UISourceCode} | |
| 421 */ | |
| 422 currentUISourceCode: function() | |
| 423 { | |
| 424 return this._currentUISourceCode; | |
| 425 }, | |
| 426 | |
| 427 /** | |
| 428 * @param {WebInspector.UILocation} uiLocation | |
| 429 */ | |
| 430 showUILocation: function(uiLocation) | |
| 431 { | |
| 432 this._showSourceLocation(uiLocation.uiSourceCode, uiLocation.lineNumber,
uiLocation.columnNumber); | |
| 433 }, | |
| 434 | |
| 435 /** | |
| 436 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 437 * @param {number=} lineNumber | |
| 438 * @param {number=} columnNumber | |
| 439 */ | |
| 440 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber) | |
| 441 { | |
| 442 var sourceFrame = this._showFile(uiSourceCode); | |
| 443 if (typeof lineNumber === "number") | |
| 444 sourceFrame.highlightPosition(lineNumber, columnNumber); | |
| 445 sourceFrame.focus(); | |
| 446 | |
| 447 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { | |
| 448 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, | |
| 449 url: uiSourceCode.originURL(), | |
| 450 lineNumber: lineNumber | |
| 451 }); | |
| 452 }, | |
| 453 | |
| 454 /** | |
| 455 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 456 * @return {WebInspector.SourceFrame} | |
| 457 */ | |
| 458 _showFile: function(uiSourceCode) | |
| 459 { | |
| 460 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); | |
| 461 if (this._currentUISourceCode === uiSourceCode) | |
| 462 return sourceFrame; | |
| 463 this._currentUISourceCode = uiSourceCode; | |
| 464 if (!uiSourceCode.project().isServiceProject()) | |
| 465 this._navigator.revealUISourceCode(uiSourceCode, true); | |
| 466 this._editorContainer.showFile(uiSourceCode); | |
| 467 this._updateScriptViewStatusBarItems(); | |
| 468 | |
| 469 if (this._currentUISourceCode.project().type() === WebInspector.projectT
ypes.Snippets) | |
| 470 this._runSnippetButton.element.removeStyleClass("hidden"); | |
| 471 else | |
| 472 this._runSnippetButton.element.addStyleClass("hidden"); | |
| 473 | |
| 474 return sourceFrame; | |
| 475 }, | |
| 476 | |
| 477 /** | |
| 478 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 479 * @return {WebInspector.SourceFrame} | |
| 480 */ | |
| 481 _createSourceFrame: function(uiSourceCode) | |
| 482 { | |
| 483 var sourceFrame; | |
| 484 switch (uiSourceCode.contentType()) { | |
| 485 case WebInspector.resourceTypes.Script: | |
| 486 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC
ode); | |
| 487 break; | |
| 488 case WebInspector.resourceTypes.Document: | |
| 489 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC
ode); | |
| 490 break; | |
| 491 case WebInspector.resourceTypes.Stylesheet: | |
| 492 default: | |
| 493 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); | |
| 494 break; | |
| 495 } | |
| 496 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); | |
| 497 return sourceFrame; | |
| 498 }, | |
| 499 | |
| 500 /** | |
| 501 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 502 * @return {WebInspector.SourceFrame} | |
| 503 */ | |
| 504 _getOrCreateSourceFrame: function(uiSourceCode) | |
| 505 { | |
| 506 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat
eSourceFrame(uiSourceCode); | |
| 507 }, | |
| 508 | |
| 509 /** | |
| 510 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 511 * @return {WebInspector.SourceFrame} | |
| 512 */ | |
| 513 viewForFile: function(uiSourceCode) | |
| 514 { | |
| 515 return this._getOrCreateSourceFrame(uiSourceCode); | |
| 516 }, | |
| 517 | |
| 518 /** | |
| 519 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 520 */ | |
| 521 _removeSourceFrame: function(uiSourceCode) | |
| 522 { | |
| 523 var sourceFrame = this._sourceFramesByUISourceCode.get(uiSourceCode); | |
| 524 if (!sourceFrame) | |
| 525 return; | |
| 526 this._sourceFramesByUISourceCode.remove(uiSourceCode); | |
| 527 sourceFrame.dispose(); | |
| 528 }, | |
| 529 | |
| 530 _clearCurrentExecutionLine: function() | |
| 531 { | |
| 532 if (this._executionSourceFrame) | |
| 533 this._executionSourceFrame.clearExecutionLine(); | |
| 534 delete this._executionSourceFrame; | |
| 535 }, | |
| 536 | |
| 537 _setExecutionLine: function(uiLocation) | |
| 538 { | |
| 539 var callFrame = WebInspector.debuggerModel.selectedCallFrame() | |
| 540 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); | |
| 541 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); | |
| 542 this._executionSourceFrame = sourceFrame; | |
| 543 }, | |
| 544 | |
| 545 _executionLineChanged: function(uiLocation) | |
| 546 { | |
| 547 this._clearCurrentExecutionLine(); | |
| 548 this._setExecutionLine(uiLocation); | |
| 549 | |
| 550 var uiSourceCode = uiLocation.uiSourceCode; | |
| 551 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s
criptFile() : null; | |
| 552 if (this._skipExecutionLineRevealing) | |
| 553 return; | |
| 554 this._skipExecutionLineRevealing = true; | |
| 555 var sourceFrame = this._showFile(uiSourceCode); | |
| 556 sourceFrame.revealLine(uiLocation.lineNumber); | |
| 557 if (sourceFrame.canEditSource()) | |
| 558 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u
iLocation.lineNumber, 0)); | |
| 559 sourceFrame.focus(); | |
| 560 }, | |
| 561 | |
| 562 _callFrameSelected: function(event) | |
| 563 { | |
| 564 var callFrame = event.data; | |
| 565 | |
| 566 if (!callFrame) | |
| 567 return; | |
| 568 | |
| 569 this.sidebarPanes.scopechain.update(callFrame); | |
| 570 this.sidebarPanes.watchExpressions.refreshExpressions(); | |
| 571 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | |
| 572 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | |
| 573 }, | |
| 574 | |
| 575 _editorClosed: function(event) | |
| 576 { | |
| 577 this._navigatorController.hideNavigatorOverlay(); | |
| 578 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data)
; | |
| 579 | |
| 580 if (this._currentUISourceCode === uiSourceCode) | |
| 581 delete this._currentUISourceCode; | |
| 582 | |
| 583 // ScriptsNavigator does not need to update on EditorClosed. | |
| 584 this._updateScriptViewStatusBarItems(); | |
| 585 WebInspector.searchController.resetSearch(); | |
| 586 }, | |
| 587 | |
| 588 _editorSelected: function(event) | |
| 589 { | |
| 590 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data)
; | |
| 591 var sourceFrame = this._showFile(uiSourceCode); | |
| 592 this._navigatorController.hideNavigatorOverlay(); | |
| 593 if (!this._navigatorController.isNavigatorPinned()) | |
| 594 sourceFrame.focus(); | |
| 595 WebInspector.searchController.resetSearch(); | |
| 596 }, | |
| 597 | |
| 598 _scriptSelected: function(event) | |
| 599 { | |
| 600 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data.
uiSourceCode); | |
| 601 var sourceFrame = this._showFile(uiSourceCode); | |
| 602 this._navigatorController.hideNavigatorOverlay(); | |
| 603 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev
ent.data.focusSource)) | |
| 604 sourceFrame.focus(); | |
| 605 }, | |
| 606 | |
| 607 _itemSearchStarted: function(event) | |
| 608 { | |
| 609 var searchText = /** @type {string} */ (event.data); | |
| 610 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement,
searchText); | |
| 611 }, | |
| 612 | |
| 613 _pauseOnExceptionStateChanged: function() | |
| 614 { | |
| 615 var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionState
String.get(); | |
| 616 switch (pauseOnExceptionsState) { | |
| 617 case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExcept
ions: | |
| 618 this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pa
use on exceptions.\nClick to Pause on all exceptions."); | |
| 619 break; | |
| 620 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExcepti
ons: | |
| 621 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on
all exceptions.\nClick to Pause on uncaught exceptions."); | |
| 622 break; | |
| 623 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtEx
ceptions: | |
| 624 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on
uncaught exceptions.\nClick to Not pause on exceptions."); | |
| 625 break; | |
| 626 } | |
| 627 this._pauseOnExceptionButton.state = pauseOnExceptionsState; | |
| 628 }, | |
| 629 | |
| 630 _updateDebuggerButtons: function() | |
| 631 { | |
| 632 if (this._paused) { | |
| 633 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) | |
| 634 this._pauseButton.state = true; | |
| 635 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); | |
| 636 | |
| 637 this._pauseButton.setEnabled(true); | |
| 638 this._stepOverButton.setEnabled(true); | |
| 639 this._stepIntoButton.setEnabled(true); | |
| 640 this._stepOutButton.setEnabled(true); | |
| 641 | |
| 642 this.debuggerStatusElement.textContent = WebInspector.UIString("Paus
ed"); | |
| 643 } else { | |
| 644 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa
use script execution (%s).")) | |
| 645 this._pauseButton.state = false; | |
| 646 this._pauseButton.setLongClickOptionsEnabled(null); | |
| 647 | |
| 648 this._pauseButton.setEnabled(!this._waitingToPause); | |
| 649 this._stepOverButton.setEnabled(false); | |
| 650 this._stepIntoButton.setEnabled(false); | |
| 651 this._stepOutButton.setEnabled(false); | |
| 652 | |
| 653 if (this._waitingToPause) | |
| 654 this.debuggerStatusElement.textContent = WebInspector.UIString("
Pausing"); | |
| 655 else if (this._stepping) | |
| 656 this.debuggerStatusElement.textContent = WebInspector.UIString("
Stepping"); | |
| 657 else | |
| 658 this.debuggerStatusElement.textContent = ""; | |
| 659 } | |
| 660 }, | |
| 661 | |
| 662 _clearInterface: function() | |
| 663 { | |
| 664 this.sidebarPanes.callstack.update(null); | |
| 665 this.sidebarPanes.scopechain.update(null); | |
| 666 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | |
| 667 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); | |
| 668 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); | |
| 669 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); | |
| 670 | |
| 671 this._clearCurrentExecutionLine(); | |
| 672 this._updateDebuggerButtons(); | |
| 673 }, | |
| 674 | |
| 675 _togglePauseOnExceptions: function() | |
| 676 { | |
| 677 var nextStateMap = {}; | |
| 678 var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState; | |
| 679 nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExce
ptions; | |
| 680 nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaught
Exceptions; | |
| 681 nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseO
nExceptions; | |
| 682 WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this.
_pauseOnExceptionButton.state]); | |
| 683 }, | |
| 684 | |
| 685 /** | |
| 686 * @param {Event=} event | |
| 687 * @return {boolean} | |
| 688 */ | |
| 689 _runSnippet: function(event) | |
| 690 { | |
| 691 if (this._currentUISourceCode.project().type() !== WebInspector.projectT
ypes.Snippets) | |
| 692 return false; | |
| 693 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._currentUISou
rceCode); | |
| 694 return true; | |
| 695 }, | |
| 696 | |
| 697 /** | |
| 698 * @param {Event=} event | |
| 699 * @return {boolean} | |
| 700 */ | |
| 701 _togglePause: function(event) | |
| 702 { | |
| 703 if (this._paused) { | |
| 704 delete this._skipExecutionLineRevealing; | |
| 705 this._paused = false; | |
| 706 this._waitingToPause = false; | |
| 707 DebuggerAgent.resume(); | |
| 708 } else { | |
| 709 this._stepping = false; | |
| 710 this._waitingToPause = true; | |
| 711 // Make sure pauses didn't stick skipped. | |
| 712 DebuggerAgent.setSkipAllPauses(false); | |
| 713 DebuggerAgent.pause(); | |
| 714 } | |
| 715 | |
| 716 this._clearInterface(); | |
| 717 return true; | |
| 718 }, | |
| 719 | |
| 720 /** | |
| 721 * @param {WebInspector.Event=} event | |
| 722 * @return {boolean} | |
| 723 */ | |
| 724 _longResume: function(event) | |
| 725 { | |
| 726 if (!this._paused) | |
| 727 return true; | |
| 728 | |
| 729 this._paused = false; | |
| 730 this._waitingToPause = false; | |
| 731 DebuggerAgent.setSkipAllPauses(true, true); | |
| 732 setTimeout(DebuggerAgent.setSkipAllPauses.bind(DebuggerAgent, false), 50
0); | |
| 733 DebuggerAgent.resume(); | |
| 734 | |
| 735 this._clearInterface(); | |
| 736 return true; | |
| 737 }, | |
| 738 | |
| 739 /** | |
| 740 * @param {Event=} event | |
| 741 * @return {boolean} | |
| 742 */ | |
| 743 _stepOverClicked: function(event) | |
| 744 { | |
| 745 if (!this._paused) | |
| 746 return true; | |
| 747 | |
| 748 delete this._skipExecutionLineRevealing; | |
| 749 this._paused = false; | |
| 750 this._stepping = true; | |
| 751 | |
| 752 this._clearInterface(); | |
| 753 | |
| 754 DebuggerAgent.stepOver(); | |
| 755 return true; | |
| 756 }, | |
| 757 | |
| 758 /** | |
| 759 * @param {Event=} event | |
| 760 * @return {boolean} | |
| 761 */ | |
| 762 _stepIntoClicked: function(event) | |
| 763 { | |
| 764 if (!this._paused) | |
| 765 return true; | |
| 766 | |
| 767 delete this._skipExecutionLineRevealing; | |
| 768 this._paused = false; | |
| 769 this._stepping = true; | |
| 770 | |
| 771 this._clearInterface(); | |
| 772 | |
| 773 DebuggerAgent.stepInto(); | |
| 774 return true; | |
| 775 }, | |
| 776 | |
| 777 /** | |
| 778 * @param {Event=} event | |
| 779 * @return {boolean} | |
| 780 */ | |
| 781 _stepIntoSelectionClicked: function(event) | |
| 782 { | |
| 783 if (!this._paused) | |
| 784 return true; | |
| 785 | |
| 786 if (this._executionSourceFrame) { | |
| 787 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 788 if (stepIntoMarkup) | |
| 789 stepIntoMarkup.iterateSelection(event.shiftKey); | |
| 790 } | |
| 791 return true; | |
| 792 }, | |
| 793 | |
| 794 doStepIntoSelection: function(rawLocation) | |
| 795 { | |
| 796 if (!this._paused) | |
| 797 return; | |
| 798 | |
| 799 delete this._skipExecutionLineRevealing; | |
| 800 this._paused = false; | |
| 801 this._stepping = true; | |
| 802 this._clearInterface(); | |
| 803 WebInspector.debuggerModel.stepIntoSelection(rawLocation); | |
| 804 }, | |
| 805 | |
| 806 /** | |
| 807 * @param {Event=} event | |
| 808 * @return {boolean} | |
| 809 */ | |
| 810 _stepOutClicked: function(event) | |
| 811 { | |
| 812 if (!this._paused) | |
| 813 return true; | |
| 814 | |
| 815 delete this._skipExecutionLineRevealing; | |
| 816 this._paused = false; | |
| 817 this._stepping = true; | |
| 818 | |
| 819 this._clearInterface(); | |
| 820 | |
| 821 DebuggerAgent.stepOut(); | |
| 822 return true; | |
| 823 }, | |
| 824 | |
| 825 /** | |
| 826 * @param {WebInspector.Event} event | |
| 827 */ | |
| 828 _callFrameSelectedInSidebar: function(event) | |
| 829 { | |
| 830 var callFrame = /** @type {WebInspector.DebuggerModel.CallFrame} */ (eve
nt.data); | |
| 831 delete this._skipExecutionLineRevealing; | |
| 832 WebInspector.debuggerModel.setSelectedCallFrame(callFrame); | |
| 833 }, | |
| 834 | |
| 835 continueToLocation: function(rawLocation) | |
| 836 { | |
| 837 if (!this._paused) | |
| 838 return; | |
| 839 | |
| 840 delete this._skipExecutionLineRevealing; | |
| 841 this._paused = false; | |
| 842 this._stepping = true; | |
| 843 this._clearInterface(); | |
| 844 WebInspector.debuggerModel.continueToLocation(rawLocation); | |
| 845 }, | |
| 846 | |
| 847 _toggleBreakpointsClicked: function(event) | |
| 848 { | |
| 849 WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerMo
del.breakpointsActive()); | |
| 850 }, | |
| 851 | |
| 852 _breakpointsActiveStateChanged: function(event) | |
| 853 { | |
| 854 var active = event.data; | |
| 855 this._toggleBreakpointsButton.toggled = !active; | |
| 856 if (active) { | |
| 857 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv
ate breakpoints."); | |
| 858 WebInspector.inspectorView.element.removeStyleClass("breakpoints-dea
ctivated"); | |
| 859 this.sidebarPanes.jsBreakpoints.listElement.removeStyleClass("breakp
oints-list-deactivated"); | |
| 860 } else { | |
| 861 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat
e breakpoints."); | |
| 862 WebInspector.inspectorView.element.addStyleClass("breakpoints-deacti
vated"); | |
| 863 this.sidebarPanes.jsBreakpoints.listElement.addStyleClass("breakpoin
ts-list-deactivated"); | |
| 864 } | |
| 865 }, | |
| 866 | |
| 867 _createDebugToolbar: function() | |
| 868 { | |
| 869 var debugToolbar = document.createElement("div"); | |
| 870 debugToolbar.className = "status-bar"; | |
| 871 debugToolbar.id = "scripts-debug-toolbar"; | |
| 872 | |
| 873 var title, handler; | |
| 874 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C
trlOrMeta; | |
| 875 | |
| 876 // Run snippet. | |
| 877 title = WebInspector.UIString("Run snippet (%s)."); | |
| 878 handler = this._runSnippet.bind(this); | |
| 879 this._runSnippetButton = this._createButtonAndRegisterShortcuts("scripts
-run-snippet", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.
RunSnippet); | |
| 880 debugToolbar.appendChild(this._runSnippetButton.element); | |
| 881 this._runSnippetButton.element.addStyleClass("hidden"); | |
| 882 | |
| 883 // Continue. | |
| 884 handler = this._togglePause.bind(this); | |
| 885 this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-paus
e", "", handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue)
; | |
| 886 debugToolbar.appendChild(this._pauseButton.element); | |
| 887 | |
| 888 // Long resume. | |
| 889 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms
"); | |
| 890 this._longResumeButton = new WebInspector.StatusBarButton(title, "script
s-long-resume"); | |
| 891 this._longResumeButton.addEventListener("click", this._longResume.bind(t
his), this); | |
| 892 | |
| 893 // Step over. | |
| 894 title = WebInspector.UIString("Step over next function call (%s)."); | |
| 895 handler = this._stepOverClicked.bind(this); | |
| 896 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.Step
Over); | |
| 897 debugToolbar.appendChild(this._stepOverButton.element); | |
| 898 | |
| 899 // Step into. | |
| 900 title = WebInspector.UIString("Step into next function call (%s)."); | |
| 901 handler = this._stepIntoClicked.bind(this); | |
| 902 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.Step
Into); | |
| 903 debugToolbar.appendChild(this._stepIntoButton.element); | |
| 904 | |
| 905 // Step into selection (keyboard shortcut only). | |
| 906 this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.
StepIntoSelection, this._stepIntoSelectionClicked.bind(this)) | |
| 907 | |
| 908 // Step out. | |
| 909 title = WebInspector.UIString("Step out of current function (%s)."); | |
| 910 handler = this._stepOutClicked.bind(this); | |
| 911 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOu
t); | |
| 912 debugToolbar.appendChild(this._stepOutButton.element); | |
| 913 | |
| 914 // Toggle Breakpoints | |
| 915 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | |
| 916 this._toggleBreakpointsButton.toggled = false; | |
| 917 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | |
| 918 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | |
| 919 | |
| 920 // Pause on Exception | |
| 921 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item", 3); | |
| 922 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); | |
| 923 debugToolbar.appendChild(this._pauseOnExceptionButton.element); | |
| 924 | |
| 925 this.debuggerStatusElement = document.createElement("div"); | |
| 926 this.debuggerStatusElement.id = "scripts-debugger-status"; | |
| 927 debugToolbar.appendChild(this.debuggerStatusElement); | |
| 928 | |
| 929 return debugToolbar; | |
| 930 }, | |
| 931 | |
| 932 /** | |
| 933 * @param {WebInspector.StatusBarButton} button | |
| 934 * @param {string} buttonTitle | |
| 935 */ | |
| 936 _updateButtonTitle: function(button, buttonTitle) | |
| 937 { | |
| 938 var hasShortcuts = button.shortcuts && button.shortcuts.length; | |
| 939 if (hasShortcuts) | |
| 940 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); | |
| 941 else | |
| 942 button.title = buttonTitle; | |
| 943 }, | |
| 944 | |
| 945 /** | |
| 946 * @param {string} buttonId | |
| 947 * @param {string} buttonTitle | |
| 948 * @param {function(Event=):boolean} handler | |
| 949 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts | |
| 950 * @return {WebInspector.StatusBarButton} | |
| 951 */ | |
| 952 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) | |
| 953 { | |
| 954 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); | |
| 955 button.element.addEventListener("click", handler, false); | |
| 956 button.shortcuts = shortcuts; | |
| 957 this._updateButtonTitle(button, buttonTitle); | |
| 958 this.registerShortcuts(shortcuts, handler); | |
| 959 return button; | |
| 960 }, | |
| 961 | |
| 962 searchCanceled: function() | |
| 963 { | |
| 964 if (this._searchView) | |
| 965 this._searchView.searchCanceled(); | |
| 966 | |
| 967 delete this._searchView; | |
| 968 delete this._searchQuery; | |
| 969 }, | |
| 970 | |
| 971 /** | |
| 972 * @param {string} query | |
| 973 * @param {boolean} shouldJump | |
| 974 */ | |
| 975 performSearch: function(query, shouldJump) | |
| 976 { | |
| 977 WebInspector.searchController.updateSearchMatchesCount(0, this); | |
| 978 | |
| 979 if (!this.visibleView) | |
| 980 return; | |
| 981 | |
| 982 this._searchView = this.visibleView; | |
| 983 this._searchQuery = query; | |
| 984 | |
| 985 function finishedCallback(view, searchMatches) | |
| 986 { | |
| 987 if (!searchMatches) | |
| 988 return; | |
| 989 | |
| 990 WebInspector.searchController.updateSearchMatchesCount(searchMatches
, this); | |
| 991 } | |
| 992 | |
| 993 function currentMatchChanged(currentMatchIndex) | |
| 994 { | |
| 995 WebInspector.searchController.updateCurrentMatchIndex(currentMatchIn
dex, this); | |
| 996 } | |
| 997 | |
| 998 this._searchView.performSearch(query, shouldJump, finishedCallback.bind(
this), currentMatchChanged.bind(this)); | |
| 999 }, | |
| 1000 | |
| 1001 /** | |
| 1002 * @return {number} | |
| 1003 */ | |
| 1004 minimalSearchQuerySize: function() | |
| 1005 { | |
| 1006 return 0; | |
| 1007 }, | |
| 1008 | |
| 1009 jumpToNextSearchResult: function() | |
| 1010 { | |
| 1011 if (!this._searchView) | |
| 1012 return; | |
| 1013 | |
| 1014 if (this._searchView !== this.visibleView) { | |
| 1015 this.performSearch(this._searchQuery, true); | |
| 1016 return; | |
| 1017 } | |
| 1018 | |
| 1019 this._searchView.jumpToNextSearchResult(); | |
| 1020 return true; | |
| 1021 }, | |
| 1022 | |
| 1023 jumpToPreviousSearchResult: function() | |
| 1024 { | |
| 1025 if (!this._searchView) | |
| 1026 return; | |
| 1027 | |
| 1028 if (this._searchView !== this.visibleView) { | |
| 1029 this.performSearch(this._searchQuery, true); | |
| 1030 if (this._searchView) | |
| 1031 this._searchView.jumpToLastSearchResult(); | |
| 1032 return; | |
| 1033 } | |
| 1034 | |
| 1035 this._searchView.jumpToPreviousSearchResult(); | |
| 1036 }, | |
| 1037 | |
| 1038 /** | |
| 1039 * @return {boolean} | |
| 1040 */ | |
| 1041 canSearchAndReplace: function() | |
| 1042 { | |
| 1043 var view = /** @type {WebInspector.SourceFrame} */ (this.visibleView); | |
| 1044 return !!view && view.canEditSource(); | |
| 1045 }, | |
| 1046 | |
| 1047 /** | |
| 1048 * @param {string} text | |
| 1049 */ | |
| 1050 replaceSelectionWith: function(text) | |
| 1051 { | |
| 1052 var view = /** @type {WebInspector.SourceFrame} */ (this.visibleView); | |
| 1053 view.replaceSearchMatchWith(text); | |
| 1054 }, | |
| 1055 | |
| 1056 /** | |
| 1057 * @param {string} query | |
| 1058 * @param {string} text | |
| 1059 */ | |
| 1060 replaceAllWith: function(query, text) | |
| 1061 { | |
| 1062 var view = /** @type {WebInspector.SourceFrame} */ (this.visibleView); | |
| 1063 view.replaceAllWith(query, text); | |
| 1064 }, | |
| 1065 | |
| 1066 _onKeyDown: function(event) | |
| 1067 { | |
| 1068 if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code
) | |
| 1069 return; | |
| 1070 if (!this._paused || !this._executionSourceFrame) | |
| 1071 return; | |
| 1072 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 1073 if (stepIntoMarkup) | |
| 1074 stepIntoMarkup.startIteratingSelection(); | |
| 1075 }, | |
| 1076 | |
| 1077 _onKeyUp: function(event) | |
| 1078 { | |
| 1079 if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code
) | |
| 1080 return; | |
| 1081 if (!this._paused || !this._executionSourceFrame) | |
| 1082 return; | |
| 1083 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 1084 if (!stepIntoMarkup) | |
| 1085 return; | |
| 1086 var currentPosition = stepIntoMarkup.getSelectedItemIndex(); | |
| 1087 if (typeof currentPosition === "undefined") { | |
| 1088 stepIntoMarkup.stopIteratingSelection(); | |
| 1089 } else { | |
| 1090 var rawLocation = stepIntoMarkup.getRawPosition(currentPosition); | |
| 1091 this.doStepIntoSelection(rawLocation); | |
| 1092 } | |
| 1093 }, | |
| 1094 | |
| 1095 _toggleFormatSource: function() | |
| 1096 { | |
| 1097 delete this._skipExecutionLineRevealing; | |
| 1098 this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton
.toggled; | |
| 1099 var uiSourceCodes = this._workspace.uiSourceCodes(); | |
| 1100 for (var i = 0; i < uiSourceCodes.length; ++i) | |
| 1101 uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled
); | |
| 1102 | |
| 1103 var currentFile = this._editorContainer.currentFile(); | |
| 1104 | |
| 1105 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { | |
| 1106 action: WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint, | |
| 1107 enabled: this._toggleFormatSourceButton.toggled, | |
| 1108 url: currentFile ? currentFile.originURL() : null | |
| 1109 }); | |
| 1110 }, | |
| 1111 | |
| 1112 addToWatch: function(expression) | |
| 1113 { | |
| 1114 this.sidebarPanes.watchExpressions.addExpression(expression); | |
| 1115 }, | |
| 1116 | |
| 1117 /** | |
| 1118 * @return {boolean} | |
| 1119 */ | |
| 1120 _toggleBreakpoint: function() | |
| 1121 { | |
| 1122 var sourceFrame = this.visibleView; | |
| 1123 if (!sourceFrame) | |
| 1124 return false; | |
| 1125 | |
| 1126 if (sourceFrame instanceof WebInspector.JavaScriptSourceFrame) { | |
| 1127 var javaScriptSourceFrame = /** @type {WebInspector.JavaScriptSource
Frame} */ (sourceFrame); | |
| 1128 javaScriptSourceFrame.toggleBreakpointOnCurrentLine(); | |
| 1129 return true; | |
| 1130 } | |
| 1131 return false; | |
| 1132 }, | |
| 1133 | |
| 1134 /** | |
| 1135 * @param {Event=} event | |
| 1136 * @return {boolean} | |
| 1137 */ | |
| 1138 _showOutlineDialog: function(event) | |
| 1139 { | |
| 1140 var uiSourceCode = this._editorContainer.currentFile(); | |
| 1141 if (!uiSourceCode) | |
| 1142 return false; | |
| 1143 | |
| 1144 switch (uiSourceCode.contentType()) { | |
| 1145 case WebInspector.resourceTypes.Document: | |
| 1146 case WebInspector.resourceTypes.Script: | |
| 1147 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSource
Code); | |
| 1148 return true; | |
| 1149 case WebInspector.resourceTypes.Stylesheet: | |
| 1150 WebInspector.StyleSheetOutlineDialog.show(this.visibleView, uiSource
Code); | |
| 1151 return true; | |
| 1152 } | |
| 1153 return false; | |
| 1154 }, | |
| 1155 | |
| 1156 _installDebuggerSidebarController: function() | |
| 1157 { | |
| 1158 this._toggleDebuggerSidebarButton = new WebInspector.StatusBarButton("",
"right-sidebar-show-hide-button scripts-debugger-show-hide-button", 3); | |
| 1159 this._toggleDebuggerSidebarButton.addEventListener("click", clickHandler
, this); | |
| 1160 this.editorView.element.appendChild(this._toggleDebuggerSidebarButton.el
ement); | |
| 1161 this._enableDebuggerSidebar(!WebInspector.settings.debuggerSidebarHidden
.get()); | |
| 1162 | |
| 1163 function clickHandler() | |
| 1164 { | |
| 1165 this._enableDebuggerSidebar(this._toggleDebuggerSidebarButton.state
=== "left"); | |
| 1166 } | |
| 1167 }, | |
| 1168 | |
| 1169 /** | |
| 1170 * @param {boolean} show | |
| 1171 */ | |
| 1172 _enableDebuggerSidebar: function(show) | |
| 1173 { | |
| 1174 this._toggleDebuggerSidebarButton.state = show ? "right" : "left"; | |
| 1175 this._toggleDebuggerSidebarButton.title = show ? WebInspector.UIString("
Hide debugger") : WebInspector.UIString("Show debugger"); | |
| 1176 if (show) | |
| 1177 this.splitView.showSidebarElement(); | |
| 1178 else | |
| 1179 this.splitView.hideSidebarElement(); | |
| 1180 this._debugSidebarResizeWidgetElement.enableStyleClass("hidden", !show); | |
| 1181 WebInspector.settings.debuggerSidebarHidden.set(!show); | |
| 1182 }, | |
| 1183 | |
| 1184 /** | |
| 1185 * @param {WebInspector.Event} event | |
| 1186 */ | |
| 1187 _itemCreationRequested: function(event) | |
| 1188 { | |
| 1189 var project = event.data.project; | |
| 1190 var path = event.data.path; | |
| 1191 var filePath; | |
| 1192 var shouldHideNavigator; | |
| 1193 var uiSourceCode; | |
| 1194 project.createFile(path, null, fileCreated.bind(this)); | |
| 1195 | |
| 1196 /** | |
| 1197 * @param {?string} path | |
| 1198 */ | |
| 1199 function fileCreated(path) | |
| 1200 { | |
| 1201 if (!path) | |
| 1202 return; | |
| 1203 filePath = path; | |
| 1204 uiSourceCode = project.uiSourceCode(filePath); | |
| 1205 this._showSourceLocation(uiSourceCode); | |
| 1206 | |
| 1207 shouldHideNavigator = !this._navigatorController.isNavigatorPinned()
; | |
| 1208 if (this._navigatorController.isNavigatorHidden()) | |
| 1209 this._navigatorController.showNavigatorOverlay(); | |
| 1210 this._navigator.rename(uiSourceCode, callback.bind(this)); | |
| 1211 } | |
| 1212 | |
| 1213 /** | |
| 1214 * @param {boolean} committed | |
| 1215 */ | |
| 1216 function callback(committed) | |
| 1217 { | |
| 1218 if (shouldHideNavigator) | |
| 1219 this._navigatorController.hideNavigatorOverlay(); | |
| 1220 | |
| 1221 if (!committed) { | |
| 1222 project.deleteFile(uiSourceCode); | |
| 1223 return; | |
| 1224 } | |
| 1225 | |
| 1226 this._showSourceLocation(uiSourceCode); | |
| 1227 } | |
| 1228 }, | |
| 1229 | |
| 1230 /** | |
| 1231 * @param {WebInspector.Event} event | |
| 1232 */ | |
| 1233 _itemRenamingRequested: function(event) | |
| 1234 { | |
| 1235 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data)
; | |
| 1236 | |
| 1237 var shouldHideNavigator = !this._navigatorController.isNavigatorPinned()
; | |
| 1238 if (this._navigatorController.isNavigatorHidden()) | |
| 1239 this._navigatorController.showNavigatorOverlay(); | |
| 1240 this._navigator.rename(uiSourceCode, callback.bind(this)); | |
| 1241 | |
| 1242 /** | |
| 1243 * @param {boolean} committed | |
| 1244 */ | |
| 1245 function callback(committed) | |
| 1246 { | |
| 1247 if (shouldHideNavigator && committed) { | |
| 1248 this._navigatorController.hideNavigatorOverlay(); | |
| 1249 this._showSourceLocation(uiSourceCode); | |
| 1250 } | |
| 1251 } | |
| 1252 }, | |
| 1253 | |
| 1254 /** | |
| 1255 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 1256 */ | |
| 1257 _showLocalHistory: function(uiSourceCode) | |
| 1258 { | |
| 1259 WebInspector.RevisionHistoryView.showHistory(uiSourceCode); | |
| 1260 }, | |
| 1261 | |
| 1262 /** | |
| 1263 * @param {WebInspector.ContextMenu} contextMenu | |
| 1264 * @param {Object} target | |
| 1265 */ | |
| 1266 appendApplicableItems: function(event, contextMenu, target) | |
| 1267 { | |
| 1268 this._appendUISourceCodeItems(contextMenu, target); | |
| 1269 this._appendFunctionItems(contextMenu, target); | |
| 1270 }, | |
| 1271 | |
| 1272 /** | |
| 1273 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 1274 */ | |
| 1275 _mapFileSystemToNetwork: function(uiSourceCode) | |
| 1276 { | |
| 1277 WebInspector.SelectUISourceCodeForProjectTypeDialog.show(uiSourceCode.na
me(), WebInspector.projectTypes.Network, mapFileSystemToNetwork.bind(this), this
.editorView.mainElement) | |
| 1278 | |
| 1279 /** | |
| 1280 * @param {WebInspector.UISourceCode} networkUISourceCode | |
| 1281 */ | |
| 1282 function mapFileSystemToNetwork(networkUISourceCode) | |
| 1283 { | |
| 1284 this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebIns
pector.fileSystemWorkspaceProvider); | |
| 1285 } | |
| 1286 }, | |
| 1287 | |
| 1288 /** | |
| 1289 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 1290 */ | |
| 1291 _removeNetworkMapping: function(uiSourceCode) | |
| 1292 { | |
| 1293 if (confirm(WebInspector.UIString("Are you sure you want to remove netwo
rk mapping?"))) | |
| 1294 this._workspace.removeMapping(uiSourceCode); | |
| 1295 }, | |
| 1296 | |
| 1297 /** | |
| 1298 * @param {WebInspector.UISourceCode} networkUISourceCode | |
| 1299 */ | |
| 1300 _mapNetworkToFileSystem: function(networkUISourceCode) | |
| 1301 { | |
| 1302 WebInspector.SelectUISourceCodeForProjectTypeDialog.show(networkUISource
Code.name(), WebInspector.projectTypes.FileSystem, mapNetworkToFileSystem.bind(t
his), this.editorView.mainElement) | |
| 1303 | |
| 1304 /** | |
| 1305 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 1306 */ | |
| 1307 function mapNetworkToFileSystem(uiSourceCode) | |
| 1308 { | |
| 1309 this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebIns
pector.fileSystemWorkspaceProvider); | |
| 1310 } | |
| 1311 }, | |
| 1312 | |
| 1313 /** | |
| 1314 * @param {WebInspector.ContextMenu} contextMenu | |
| 1315 * @param {WebInspector.UISourceCode} uiSourceCode | |
| 1316 */ | |
| 1317 _appendUISourceCodeMappingItems: function(contextMenu, uiSourceCode) | |
| 1318 { | |
| 1319 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) { | |
| 1320 var hasMappings = !!uiSourceCode.url; | |
| 1321 if (!hasMappings) | |
| 1322 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLow
erCaseMenuTitles() ? "Map to network resource\u2026" : "Map to Network Resource\
u2026"), this._mapFileSystemToNetwork.bind(this, uiSourceCode)); | |
| 1323 else | |
| 1324 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLow
erCaseMenuTitles() ? "Remove network mapping" : "Remove Network Mapping"), this.
_removeNetworkMapping.bind(this, uiSourceCode)); | |
| 1325 } | |
| 1326 | |
| 1327 if (uiSourceCode.project().type() === WebInspector.projectTypes.Network)
{ | |
| 1328 /** | |
| 1329 * @param {WebInspector.Project} project | |
| 1330 */ | |
| 1331 function filterProject(project) | |
| 1332 { | |
| 1333 return project.type() === WebInspector.projectTypes.FileSystem; | |
| 1334 } | |
| 1335 | |
| 1336 if (!this._workspace.projects().filter(filterProject).length) | |
| 1337 return; | |
| 1338 if (this._workspace.uiSourceCodeForURL(uiSourceCode.url) === uiSourc
eCode) | |
| 1339 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLow
erCaseMenuTitles() ? "Map to file system resource\u2026" : "Map to File System R
esource\u2026"), this._mapNetworkToFileSystem.bind(this, uiSourceCode)); | |
| 1340 } | |
| 1341 }, | |
| 1342 | |
| 1343 /** | |
| 1344 * @param {WebInspector.ContextMenu} contextMenu | |
| 1345 * @param {Object} target | |
| 1346 */ | |
| 1347 _appendUISourceCodeItems: function(contextMenu, target) | |
| 1348 { | |
| 1349 if (!(target instanceof WebInspector.UISourceCode)) | |
| 1350 return; | |
| 1351 | |
| 1352 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (target); | |
| 1353 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Local modifications\u2026" : "Local Modifications\u2026"), this._s
howLocalHistory.bind(this, uiSourceCode)); | |
| 1354 | |
| 1355 if (WebInspector.isolatedFileSystemManager.supportsFileSystems()) | |
| 1356 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); | |
| 1357 }, | |
| 1358 | |
| 1359 /** | |
| 1360 * @param {WebInspector.ContextMenu} contextMenu | |
| 1361 * @param {Object} target | |
| 1362 */ | |
| 1363 _appendFunctionItems: function(contextMenu, target) | |
| 1364 { | |
| 1365 if (!(target instanceof WebInspector.RemoteObject)) | |
| 1366 return; | |
| 1367 var remoteObject = /** @type {WebInspector.RemoteObject} */ (target); | |
| 1368 if (remoteObject.type !== "function") | |
| 1369 return; | |
| 1370 | |
| 1371 function didGetDetails(error, response) | |
| 1372 { | |
| 1373 if (error) { | |
| 1374 console.error(error); | |
| 1375 return; | |
| 1376 } | |
| 1377 | |
| 1378 WebInspector.inspectorView.setCurrentPanel(this); | |
| 1379 var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(
response.location); | |
| 1380 this._showSourceLocation(uiLocation.uiSourceCode, uiLocation.lineNum
ber, uiLocation.columnNumber); | |
| 1381 } | |
| 1382 | |
| 1383 function revealFunction() | |
| 1384 { | |
| 1385 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetDetail
s.bind(this)); | |
| 1386 } | |
| 1387 | |
| 1388 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Show function definition" : "Show Function Definition"), revealFun
ction.bind(this)); | |
| 1389 }, | |
| 1390 | |
| 1391 showGoToSourceDialog: function() | |
| 1392 { | |
| 1393 var uiSourceCodes = this._editorContainer.historyUISourceCodes(); | |
| 1394 /** @type {!Map.<WebInspector.UISourceCode, number>} */ | |
| 1395 var defaultScores = new Map(); | |
| 1396 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element | |
| 1397 defaultScores.put(uiSourceCodes[i], uiSourceCodes.length - i); | |
| 1398 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement,
undefined, defaultScores); | |
| 1399 }, | |
| 1400 | |
| 1401 _dockSideChanged: function() | |
| 1402 { | |
| 1403 var dockSide = WebInspector.dockController.dockSide(); | |
| 1404 var vertically = dockSide === WebInspector.DockController.State.DockedTo
Right && WebInspector.settings.splitVerticallyWhenDockedToRight.get(); | |
| 1405 this._splitVertically(vertically); | |
| 1406 }, | |
| 1407 | |
| 1408 /** | |
| 1409 * @param {boolean} vertically | |
| 1410 */ | |
| 1411 _splitVertically: function(vertically) | |
| 1412 { | |
| 1413 if (this.sidebarPaneView && vertically === !this.splitView.isVertical()) | |
| 1414 return; | |
| 1415 | |
| 1416 if (this.sidebarPaneView) | |
| 1417 this.sidebarPaneView.detach(); | |
| 1418 | |
| 1419 this.splitView.setVertical(!vertically); | |
| 1420 | |
| 1421 if (!vertically) { | |
| 1422 this.sidebarPaneView = new WebInspector.SidebarPaneStack(); | |
| 1423 for (var pane in this.sidebarPanes) | |
| 1424 this.sidebarPaneView.addPane(this.sidebarPanes[pane]); | |
| 1425 | |
| 1426 this.sidebarElement.appendChild(this.debugToolbar); | |
| 1427 } else { | |
| 1428 this._enableDebuggerSidebar(true); | |
| 1429 | |
| 1430 this.sidebarPaneView = new WebInspector.SplitView(true, this.name +
"PanelSplitSidebarRatio", 0.5); | |
| 1431 | |
| 1432 var group1 = new WebInspector.SidebarPaneStack(); | |
| 1433 group1.show(this.sidebarPaneView.firstElement()); | |
| 1434 group1.element.id = "scripts-sidebar-stack-pane"; | |
| 1435 group1.addPane(this.sidebarPanes.callstack); | |
| 1436 group1.addPane(this.sidebarPanes.jsBreakpoints); | |
| 1437 group1.addPane(this.sidebarPanes.domBreakpoints); | |
| 1438 group1.addPane(this.sidebarPanes.xhrBreakpoints); | |
| 1439 group1.addPane(this.sidebarPanes.eventListenerBreakpoints); | |
| 1440 if (this.sidebarPanes.workerList) | |
| 1441 group1.addPane(this.sidebarPanes.workerList); | |
| 1442 | |
| 1443 var group2 = new WebInspector.SidebarTabbedPane(); | |
| 1444 group2.show(this.sidebarPaneView.secondElement()); | |
| 1445 group2.addPane(this.sidebarPanes.scopechain); | |
| 1446 group2.addPane(this.sidebarPanes.watchExpressions); | |
| 1447 | |
| 1448 this.sidebarPaneView.firstElement().appendChild(this.debugToolbar); | |
| 1449 } | |
| 1450 | |
| 1451 this.sidebarPaneView.element.id = "scripts-debug-sidebar-contents"; | |
| 1452 this.sidebarPaneView.show(this.splitView.sidebarElement); | |
| 1453 | |
| 1454 this.sidebarPanes.scopechain.expand(); | |
| 1455 this.sidebarPanes.jsBreakpoints.expand(); | |
| 1456 this.sidebarPanes.callstack.expand(); | |
| 1457 | |
| 1458 if (WebInspector.settings.watchExpressions.get().length > 0) | |
| 1459 this.sidebarPanes.watchExpressions.expand(); | |
| 1460 }, | |
| 1461 | |
| 1462 /** | |
| 1463 * @return {boolean} | |
| 1464 */ | |
| 1465 canSetFooterElement: function() | |
| 1466 { | |
| 1467 return true; | |
| 1468 }, | |
| 1469 | |
| 1470 /** | |
| 1471 * @param {Element?} element | |
| 1472 */ | |
| 1473 setFooterElement: function(element) | |
| 1474 { | |
| 1475 if (element) { | |
| 1476 this._editorFooterElement.removeStyleClass("hidden"); | |
| 1477 this._editorFooterElement.appendChild(element); | |
| 1478 this._editorContentsElement.style.bottom = this._editorFooterElement
.offsetHeight + "px"; | |
| 1479 } else { | |
| 1480 this._editorFooterElement.addStyleClass("hidden"); | |
| 1481 this._editorFooterElement.removeChildren(); | |
| 1482 this._editorContentsElement.style.bottom = 0; | |
| 1483 } | |
| 1484 this.doResize(); | |
| 1485 }, | |
| 1486 | |
| 1487 __proto__: WebInspector.Panel.prototype | |
| 1488 } | |
| OLD | NEW |