OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element); | 76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element); |
77 this.editorView.setSidebarWidget(tabbedPane); | 77 this.editorView.setSidebarWidget(tabbedPane); |
78 | 78 |
79 this._sourcesView = new WebInspector.SourcesView(); | 79 this._sourcesView = new WebInspector.SourcesView(); |
80 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); | 80 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); |
81 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this)); | 81 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this)); |
82 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); | 82 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); |
83 this.editorView.setMainWidget(this._sourcesView); | 83 this.editorView.setMainWidget(this._sourcesView); |
84 this._editorChanged(this._sourcesView.currentUISourceCode()); | 84 this._editorChanged(this._sourcesView.currentUISourceCode()); |
85 | 85 |
86 this.sidebarPanes = {}; | 86 this._threadsSidebarPane = null; |
87 this.sidebarPanes.threads = null; | 87 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.watch")); |
88 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba rPane(); | 88 // TODO: Force installing listeners from the model, not the UI. |
89 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); | 89 /** @type {!WebInspector.View} */ (WebInspector.viewManager.view("sources.xh rBreakpoints")).widget(); |
dgozman
2016/08/15 21:31:03
Should we use sharedInstance(XHRBreakpointsSidebar
| |
90 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is)); | 90 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane); |
91 | 91 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); |
92 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); | |
93 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this.showUISourceCode.bind(this)); | |
94 | 92 |
95 this._installDebuggerSidebarController(); | 93 this._installDebuggerSidebarController(); |
96 | 94 |
97 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); | 95 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); |
98 this._updateSidebarPosition(); | 96 this._updateSidebarPosition(); |
99 | 97 |
100 this._updateDebuggerButtons(); | 98 this._updateDebuggerButtons(); |
101 this._pauseOnExceptionEnabledChanged(); | 99 this._pauseOnExceptionEnabledChanged(); |
102 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this); | 100 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this); |
103 | 101 |
104 this._liveLocationPool = new WebInspector.LiveLocationPool(); | 102 this._liveLocationPool = new WebInspector.LiveLocationPool(); |
105 | 103 |
106 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); | 104 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); |
107 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); | 105 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); |
108 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); | 106 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); |
107 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this); | |
109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this ); | 108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this ); |
110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); | 109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
111 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); | 110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); |
112 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.CallFrameSelected, this._callFrameSelectedOnModel, this); | |
113 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); | 111 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
114 new WebInspector.WorkspaceMappingTip(this, this._workspace); | 112 new WebInspector.WorkspaceMappingTip(this, this._workspace); |
115 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); | 113 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); |
116 WebInspector.DataSaverInfobar.maybeShowInPanel(this); | 114 WebInspector.DataSaverInfobar.maybeShowInPanel(this); |
117 WebInspector.targetManager.observeTargets(this); | 115 WebInspector.targetManager.observeTargets(this); |
118 } | 116 } |
119 | 117 |
120 WebInspector.SourcesPanel._lastModificationTimeout = 200; | 118 WebInspector.SourcesPanel._lastModificationTimeout = 200; |
121 | 119 |
122 WebInspector.SourcesPanel.minToolbarWidth = 215; | 120 WebInspector.SourcesPanel.minToolbarWidth = 215; |
123 | 121 |
124 WebInspector.SourcesPanel.prototype = { | 122 WebInspector.SourcesPanel.prototype = { |
125 /** | 123 /** |
126 * @override | 124 * @override |
127 */ | 125 */ |
128 focus: function() | 126 focus: function() |
129 { | 127 { |
130 this._sourcesView.focus(); | 128 this._sourcesView.focus(); |
131 }, | 129 }, |
132 | 130 |
133 /** | 131 /** |
134 * @override | 132 * @override |
135 * @param {!WebInspector.Target} target | 133 * @param {!WebInspector.Target} target |
136 */ | 134 */ |
137 targetAdded: function(target) | 135 targetAdded: function(target) |
138 { | 136 { |
139 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1; | 137 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1; |
140 if (hasThreads && !this.sidebarPanes.threads) { | 138 if (hasThreads && !this._threadsSidebarPane) { |
141 this.sidebarPanes.threads = new WebInspector.ThreadsSidebarPane(); | 139 this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebIns pector.viewManager.view("sources.threads")); |
142 if (this._sidebarPaneStack) { | 140 if (this._sidebarPaneStack) { |
143 this._sidebarPaneStack.showView(this.sidebarPanes.threads, this. _splitWidget.isVertical() ? this.sidebarPanes.watchExpressions : this.sidebarPan es.callstack); | 141 this._sidebarPaneStack.showView(this._threadsSidebarPane, this._ splitWidget.isVertical() ? this._watchSidebarPane : this._callstackPane); |
144 } | 142 } |
145 } | 143 } |
146 }, | 144 }, |
147 | 145 |
148 /** | 146 /** |
149 * @override | 147 * @override |
150 * @param {!WebInspector.Target} target | 148 * @param {!WebInspector.Target} target |
151 */ | 149 */ |
152 targetRemoved: function(target) | 150 targetRemoved: function(target) |
153 { | 151 { |
154 }, | 152 }, |
155 | 153 |
156 /** | 154 /** |
157 * @param {?WebInspector.Target} target | 155 * @param {?WebInspector.Target} target |
158 */ | 156 */ |
159 _setTarget: function(target) | 157 _setTarget: function(target) |
160 { | 158 { |
161 if (!target) | 159 if (!target) |
162 return; | 160 return; |
163 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 161 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
164 if (!debuggerModel) | 162 if (!debuggerModel) |
165 return; | 163 return; |
166 | 164 |
167 if (debuggerModel.isPaused()) { | 165 if (debuggerModel.isPaused()) { |
168 this._showDebuggerPausedDetails(/** @type {!WebInspector.DebuggerPau sedDetails} */ (debuggerModel.debuggerPausedDetails())); | 166 this._showDebuggerPausedDetails(/** @type {!WebInspector.DebuggerPau sedDetails} */ (debuggerModel.debuggerPausedDetails())); |
169 var callFrame = debuggerModel.selectedCallFrame(); | |
170 if (callFrame) | |
171 this._selectCallFrameInUI(callFrame); | |
172 } else { | 167 } else { |
173 this._paused = false; | 168 this._paused = false; |
174 this._clearInterface(); | 169 this._clearInterface(); |
175 this._toggleDebuggerSidebarButton.disabled = false; | 170 this._toggleDebuggerSidebarButton.disabled = false; |
176 } | 171 } |
177 }, | 172 }, |
178 | 173 |
179 /** | 174 /** |
180 * @param {!WebInspector.Event} event | 175 * @param {!WebInspector.Event} event |
181 */ | 176 */ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 250 |
256 /** | 251 /** |
257 * @param {!WebInspector.Event} event | 252 * @param {!WebInspector.Event} event |
258 */ | 253 */ |
259 _debuggerPaused: function(event) | 254 _debuggerPaused: function(event) |
260 { | 255 { |
261 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data); | 256 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data); |
262 if (!this._paused) | 257 if (!this._paused) |
263 WebInspector.inspectorView.setCurrentPanel(this); | 258 WebInspector.inspectorView.setCurrentPanel(this); |
264 | 259 |
265 if (WebInspector.context.flavor(WebInspector.Target) === details.target( )) | 260 if (WebInspector.context.flavor(WebInspector.Target) === details.target( )) { |
266 this._showDebuggerPausedDetails(details); | 261 this._showDebuggerPausedDetails(details); |
267 else if (!this._paused) | 262 } else if (!this._paused) { |
dgozman
2016/08/15 21:31:03
nit: let's remove {}
| |
268 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); | 263 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); |
264 } | |
269 }, | 265 }, |
270 | 266 |
271 /** | 267 /** |
272 * @param {!WebInspector.DebuggerPausedDetails} details | 268 * @param {!WebInspector.DebuggerPausedDetails} details |
273 */ | 269 */ |
274 _showDebuggerPausedDetails: function(details) | 270 _showDebuggerPausedDetails: function(details) |
275 { | 271 { |
276 this._paused = true; | 272 this._paused = true; |
277 this._updateDebuggerButtons(); | 273 this._updateDebuggerButtons(); |
278 | 274 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls); |
279 /** | |
280 * @param {!WebInspector.LiveLocation} liveLocation | |
281 * @this {WebInspector.SourcesPanel} | |
282 */ | |
283 function didGetUILocation(liveLocation) | |
284 { | |
285 var uiLocation = liveLocation.uiLocation(); | |
286 if (!uiLocation) | |
287 return; | |
288 var breakpoint = WebInspector.breakpointManager.findBreakpointOnLine (uiLocation.uiSourceCode, uiLocation.lineNumber); | |
289 if (!breakpoint) | |
290 return; | |
291 this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint); | |
292 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a JavaScript breakpoint.")); | |
293 } | |
294 | |
295 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) { | |
296 this.sidebarPanes.callstack.setStatus(WebInspector.domBreakpointsSid ebarPane.createBreakpointHitStatusMessage(details)); | |
297 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Eve ntListener) { | |
298 var eventName = details.auxData["eventName"]; | |
299 var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPan e.eventNameForUI(eventName, details.auxData); | |
300 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI)); | |
301 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.XHR ) { | |
302 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a XMLHttpRequest.")); | |
303 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Exc eption) { | |
304 var description = details.auxData["description"] || ""; | |
305 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception: '%s'.", description.split("\n", 1)[0])); | |
306 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Pro miseRejection) { | |
307 var description = details.auxData["description"] || ""; | |
308 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on promise rejection: '%s'.", description.split("\n", 1)[0])); | |
309 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Ass ert) { | |
310 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on assertion.")); | |
311 } else if (details.reason === WebInspector.DebuggerModel.BreakReason.Deb ugCommand) { | |
312 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a debugged function.")); | |
313 } else { | |
314 if (details.callFrames.length) | |
315 WebInspector.debuggerWorkspaceBinding.createCallFrameLiveLocatio n(details.callFrames[0].location(), didGetUILocation.bind(this), this._liveLocat ionPool); | |
316 else | |
317 console.warn("ScriptsPanel paused, but callFrames.length is zero ."); // TODO remove this once we understand this case better | |
318 } | |
319 | |
320 this._splitWidget.showBoth(true); | 275 this._splitWidget.showBoth(true); |
dgozman
2016/08/15 21:31:03
Do it in the revealLocation callback.
| |
321 this._toggleDebuggerSidebarButton.disabled = true; | 276 this._toggleDebuggerSidebarButton.disabled = true; |
322 window.focus(); | 277 window.focus(); |
323 InspectorFrontendHost.bringToFront(); | 278 InspectorFrontendHost.bringToFront(); |
324 }, | 279 }, |
325 | 280 |
326 /** | 281 /** |
327 * @param {!WebInspector.Event} event | 282 * @param {!WebInspector.Event} event |
328 */ | 283 */ |
329 _debuggerResumed: function(event) | 284 _debuggerResumed: function(event) |
330 { | 285 { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 _lastModificationTimeoutPassedForTest: function() | 420 _lastModificationTimeoutPassedForTest: function() |
466 { | 421 { |
467 WebInspector.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE; | 422 WebInspector.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE; |
468 }, | 423 }, |
469 | 424 |
470 _updateLastModificationTimeForTest: function() | 425 _updateLastModificationTimeForTest: function() |
471 { | 426 { |
472 WebInspector.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE; | 427 WebInspector.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE; |
473 }, | 428 }, |
474 | 429 |
475 /** | 430 _callFrameChanged: function() |
476 * @param {!WebInspector.Event} event | |
477 */ | |
478 _callFrameSelectedOnModel: function(event) | |
479 { | 431 { |
480 var callFrame = /** @type {?WebInspector.DebuggerModel.CallFrame} */ (ev ent.data); | 432 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.C allFrame); |
481 if (!callFrame || callFrame.target() !== WebInspector.context.flavor(Web Inspector.Target)) | 433 if (callFrame) |
482 return; | 434 WebInspector.debuggerWorkspaceBinding.createCallFrameLiveLocation(ca llFrame.location(), this._executionLineChanged.bind(this), this._liveLocationPoo l); |
dgozman
2016/08/15 21:31:03
Let's dispose previous one.
| |
483 this._selectCallFrameInUI(callFrame); | |
484 }, | |
485 | |
486 /** | |
487 * @param {!WebInspector.DebuggerModel.CallFrame} callFrame | |
488 */ | |
489 _selectCallFrameInUI: function(callFrame) | |
490 { | |
491 WebInspector.context.setFlavor(WebInspector.DebuggerModel.CallFrame, cal lFrame); | |
492 WebInspector.debuggerWorkspaceBinding.createCallFrameLiveLocation(callFr ame.location(), this._executionLineChanged.bind(this), this._liveLocationPool); | |
493 }, | 435 }, |
494 | 436 |
495 _pauseOnExceptionEnabledChanged: function() | 437 _pauseOnExceptionEnabledChanged: function() |
496 { | 438 { |
497 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); | 439 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); |
498 this._pauseOnExceptionButton.setToggled(enabled); | 440 this._pauseOnExceptionButton.setToggled(enabled); |
499 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); | 441 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); |
500 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 442 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
501 }, | 443 }, |
502 | 444 |
(...skipping 16 matching lines...) Expand all Loading... | |
519 this._togglePauseAction.setToggled(false); | 461 this._togglePauseAction.setToggled(false); |
520 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); | 462 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); |
521 this._stepOverAction.setEnabled(false); | 463 this._stepOverAction.setEnabled(false); |
522 this._stepIntoAction.setEnabled(false); | 464 this._stepIntoAction.setEnabled(false); |
523 this._stepOutAction.setEnabled(false); | 465 this._stepOutAction.setEnabled(false); |
524 } | 466 } |
525 }, | 467 }, |
526 | 468 |
527 _clearInterface: function() | 469 _clearInterface: function() |
528 { | 470 { |
529 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | |
530 | |
531 this._sourcesView.clearCurrentExecutionLine(); | 471 this._sourcesView.clearCurrentExecutionLine(); |
532 this._updateDebuggerButtons(); | 472 this._updateDebuggerButtons(); |
473 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ; | |
533 | 474 |
534 if (this._switchToPausedTargetTimeout) | 475 if (this._switchToPausedTargetTimeout) |
535 clearTimeout(this._switchToPausedTargetTimeout); | 476 clearTimeout(this._switchToPausedTargetTimeout); |
536 this._liveLocationPool.disposeAll(); | 477 this._liveLocationPool.disposeAll(); |
537 }, | 478 }, |
538 | 479 |
539 /** | 480 /** |
540 * @param {!WebInspector.DebuggerModel} debuggerModel | 481 * @param {!WebInspector.DebuggerModel} debuggerModel |
541 */ | 482 */ |
542 _switchToPausedTarget: function(debuggerModel) | 483 _switchToPausedTarget: function(debuggerModel) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 | 661 |
721 _toggleBreakpointsActive: function() | 662 _toggleBreakpointsActive: function() |
722 { | 663 { |
723 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp ointManager.breakpointsActive()); | 664 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp ointManager.breakpointsActive()); |
724 }, | 665 }, |
725 | 666 |
726 _breakpointsActiveStateChanged: function(event) | 667 _breakpointsActiveStateChanged: function(event) |
727 { | 668 { |
728 var active = event.data; | 669 var active = event.data; |
729 this._toggleBreakpointsActiveAction.setToggled(!active); | 670 this._toggleBreakpointsActiveAction.setToggled(!active); |
730 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active); | |
731 this._sourcesView.toggleBreakpointsActiveState(active); | 671 this._sourcesView.toggleBreakpointsActiveState(active); |
732 }, | 672 }, |
733 | 673 |
734 /** | 674 /** |
735 * @return {!WebInspector.Toolbar} | 675 * @return {!WebInspector.Toolbar} |
736 */ | 676 */ |
737 _createDebugToolbar: function() | 677 _createDebugToolbar: function() |
738 { | 678 { |
739 var debugToolbar = new WebInspector.Toolbar("scripts-debug-toolbar"); | 679 var debugToolbar = new WebInspector.Toolbar("scripts-debug-toolbar"); |
740 | 680 |
(...skipping 25 matching lines...) Expand all Loading... | |
766 { | 706 { |
767 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to olbar-drawer"); | 707 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to olbar-drawer"); |
768 | 708 |
769 var label = WebInspector.UIString("Pause On Caught Exceptions"); | 709 var label = WebInspector.UIString("Pause On Caught Exceptions"); |
770 var setting = WebInspector.moduleSetting("pauseOnCaughtException"); | 710 var setting = WebInspector.moduleSetting("pauseOnCaughtException"); |
771 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true)); | 711 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true)); |
772 | 712 |
773 return debugToolbarDrawer; | 713 return debugToolbarDrawer; |
774 }, | 714 }, |
775 | 715 |
776 addToWatch: function(expression) | |
777 { | |
778 this.sidebarPanes.watchExpressions.addExpression(expression); | |
779 }, | |
780 | |
781 _installDebuggerSidebarController: function() | 716 _installDebuggerSidebarController: function() |
782 { | 717 { |
783 this.editorView.displayShowHideSidebarButton("navigator"); | 718 this.editorView.displayShowHideSidebarButton("navigator"); |
784 this._toggleDebuggerSidebarButton = this._splitWidget.displayShowHideSid ebarButton("debugger", "scripts-debugger-show-hide-button"); | 719 this._toggleDebuggerSidebarButton = this._splitWidget.displayShowHideSid ebarButton("debugger", "scripts-debugger-show-hide-button"); |
785 }, | 720 }, |
786 | 721 |
787 /** | 722 /** |
788 * @param {!WebInspector.UISourceCode} uiSourceCode | 723 * @param {!WebInspector.UISourceCode} uiSourceCode |
789 */ | 724 */ |
790 _showLocalHistory: function(uiSourceCode) | 725 _showLocalHistory: function(uiSourceCode) |
791 { | 726 { |
792 WebInspector.RevisionHistoryView.showHistory(uiSourceCode); | 727 WebInspector.RevisionHistoryView.showHistory(uiSourceCode); |
793 }, | 728 }, |
794 | 729 |
795 /** | 730 /** |
796 * @override | 731 * @override |
797 * @param {!Event} event | 732 * @param {!Event} event |
798 * @param {!WebInspector.ContextMenu} contextMenu | 733 * @param {!WebInspector.ContextMenu} contextMenu |
799 * @param {!Object} target | 734 * @param {!Object} target |
800 */ | 735 */ |
801 appendApplicableItems: function(event, contextMenu, target) | 736 appendApplicableItems: function(event, contextMenu, target) |
802 { | 737 { |
803 this._appendUISourceCodeItems(event, contextMenu, target); | 738 this._appendUISourceCodeItems(event, contextMenu, target); |
804 this.appendUILocationItems(contextMenu, target); | 739 this.appendUILocationItems(contextMenu, target); |
805 this._appendRemoteObjectItems(contextMenu, target); | 740 this._appendRemoteObjectItems(contextMenu, target); |
806 this._appendNetworkRequestItems(contextMenu, target); | 741 this._appendNetworkRequestItems(contextMenu, target); |
742 | |
743 if (target instanceof WebInspector.TextRangeWithContent) | |
744 contextMenu.appendAction("debugger.evaluate-selection"); | |
807 }, | 745 }, |
808 | 746 |
809 /** | 747 /** |
810 * @param {!WebInspector.UISourceCode} uiSourceCode | 748 * @param {!WebInspector.UISourceCode} uiSourceCode |
811 */ | 749 */ |
812 mapFileSystemToNetwork: function(uiSourceCode) | 750 mapFileSystemToNetwork: function(uiSourceCode) |
813 { | 751 { |
814 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this)); | 752 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this)); |
815 | 753 |
816 /** | 754 /** |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
920 | 858 |
921 var contentType = uiSourceCode.contentType(); | 859 var contentType = uiSourceCode.contentType(); |
922 if (contentType.hasScripts()) { | 860 if (contentType.hasScripts()) { |
923 var target = WebInspector.context.flavor(WebInspector.Target); | 861 var target = WebInspector.context.flavor(WebInspector.Target); |
924 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 862 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
925 if (debuggerModel && debuggerModel.isPaused()) | 863 if (debuggerModel && debuggerModel.isPaused()) |
926 contextMenu.appendItem(WebInspector.UIString.capitalize("Continu e to ^here"), this._continueToLocation.bind(this, uiLocation)); | 864 contextMenu.appendItem(WebInspector.UIString.capitalize("Continu e to ^here"), this._continueToLocation.bind(this, uiLocation)); |
927 } | 865 } |
928 | 866 |
929 if (contentType.hasScripts() && projectType !== WebInspector.projectType s.Snippets) | 867 if (contentType.hasScripts() && projectType !== WebInspector.projectType s.Snippets) |
930 this.sidebarPanes.callstack.appendBlackboxURLContextMenuItems(contex tMenu, uiSourceCode); | 868 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, u iSourceCode); |
931 }, | 869 }, |
932 | 870 |
933 /** | 871 /** |
934 * @param {!WebInspector.UISourceCode} uiSourceCode | 872 * @param {!WebInspector.UISourceCode} uiSourceCode |
935 */ | 873 */ |
936 _handleContextMenuReveal: function(uiSourceCode) | 874 _handleContextMenuReveal: function(uiSourceCode) |
937 { | 875 { |
938 this.editorView.showBoth(); | 876 this.editorView.showBoth(); |
939 this._revealInNavigator(uiSourceCode); | 877 this._revealInNavigator(uiSourceCode); |
940 }, | 878 }, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 | 1029 |
1092 // Create vertical box with stack. | 1030 // Create vertical box with stack. |
1093 var vbox = new WebInspector.VBox(); | 1031 var vbox = new WebInspector.VBox(); |
1094 vbox.element.appendChild(this._debugToolbarDrawer); | 1032 vbox.element.appendChild(this._debugToolbarDrawer); |
1095 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); | 1033 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); |
1096 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._setAsCurrentPanel.bind(this)); | 1034 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._setAsCurrentPanel.bind(this)); |
1097 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); | 1035 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); |
1098 this._sidebarPaneStack.widget().show(vbox.element); | 1036 this._sidebarPaneStack.widget().show(vbox.element); |
1099 vbox.element.appendChild(this._debugToolbar.element); | 1037 vbox.element.appendChild(this._debugToolbar.element); |
1100 | 1038 |
1101 if (this.sidebarPanes.threads) | 1039 if (this._threadsSidebarPane) |
1102 this._sidebarPaneStack.showView(this.sidebarPanes.threads); | 1040 this._sidebarPaneStack.showView(this._threadsSidebarPane); |
1103 | 1041 |
1104 if (!vertically) { | 1042 if (!vertically) |
1105 if (this.sidebarPanes.watchExpressions.hasExpressions()) | 1043 this._sidebarPaneStack.appendView(this._watchSidebarPane); |
1106 this._sidebarPaneStack.showView(this.sidebarPanes.watchExpressio ns); | |
1107 else | |
1108 this._sidebarPaneStack.appendView(this.sidebarPanes.watchExpress ions); | |
1109 } | |
1110 | 1044 |
1111 this._sidebarPaneStack.showView(this.sidebarPanes.callstack); | 1045 this._sidebarPaneStack.showView(this._callstackPane); |
1046 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints")); | |
1047 var scopeChainView = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.scopeChain")); | |
1112 | 1048 |
1113 if (!vertically) { | 1049 if (!vertically) { |
1114 // Populate the rest of the stack. | 1050 // Populate the rest of the stack. |
1115 this._sidebarPaneStack.showView(this.sidebarPanes.scopechain); | 1051 this._sidebarPaneStack.showView(scopeChainView); |
1116 this._sidebarPaneStack.showView(this.sidebarPanes.jsBreakpoints); | 1052 this._sidebarPaneStack.showView(jsBreakpoints); |
1117 for (var pane in this.sidebarPanes) { | |
1118 if (this.sidebarPanes[pane]) | |
1119 this._sidebarPaneStack.appendView(this.sidebarPanes[pane]); | |
1120 } | |
1121 this._extensionSidebarPanesContainer = this._sidebarPaneStack; | 1053 this._extensionSidebarPanesContainer = this._sidebarPaneStack; |
1122 this.sidebarPaneView = vbox; | 1054 this.sidebarPaneView = vbox; |
1123 } else { | 1055 } else { |
1124 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5); | 1056 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5); |
1125 splitWidget.setMainWidget(vbox); | 1057 splitWidget.setMainWidget(vbox); |
1126 | 1058 |
1127 // Populate the left stack. | 1059 // Populate the left stack. |
1128 this._sidebarPaneStack.showView(this.sidebarPanes.jsBreakpoints); | 1060 this._sidebarPaneStack.showView(jsBreakpoints); |
1129 | 1061 |
1130 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(t his._setAsCurrentPanel.bind(this)); | 1062 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(t his._setAsCurrentPanel.bind(this)); |
1131 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane()); | 1063 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane()); |
1132 tabbedLocation.appendView(this.sidebarPanes.scopechain); | 1064 tabbedLocation.appendView(scopeChainView); |
1133 tabbedLocation.appendView(this.sidebarPanes.watchExpressions); | 1065 tabbedLocation.appendView(this._watchSidebarPane); |
1134 this._extensionSidebarPanesContainer = tabbedLocation; | 1066 this._extensionSidebarPanesContainer = tabbedLocation; |
1135 this.sidebarPaneView = splitWidget; | 1067 this.sidebarPaneView = splitWidget; |
1136 } | 1068 } |
1137 | 1069 |
1138 this._sidebarPaneStack.appendApplicableItems("sources-sidebar"); | 1070 this._sidebarPaneStack.appendApplicableItems("sources-sidebar"); |
1139 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); | 1071 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); |
1140 for (var i = 0; i < extensionSidebarPanes.length; ++i) | 1072 for (var i = 0; i < extensionSidebarPanes.length; ++i) |
1141 this._addExtensionSidebarPane(extensionSidebarPanes[i]); | 1073 this._addExtensionSidebarPane(extensionSidebarPanes[i]); |
1142 | 1074 |
1143 this._splitWidget.setSidebarWidget(this.sidebarPaneView); | 1075 this._splitWidget.setSidebarWidget(this.sidebarPaneView); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 if (!entry.isDirectory) | 1118 if (!entry.isDirectory) |
1187 return; | 1119 return; |
1188 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst em); | 1120 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst em); |
1189 }, | 1121 }, |
1190 | 1122 |
1191 __proto__: WebInspector.Panel.prototype | 1123 __proto__: WebInspector.Panel.prototype |
1192 } | 1124 } |
1193 | 1125 |
1194 /** | 1126 /** |
1195 * @constructor | 1127 * @constructor |
1196 * @implements {WebInspector.ContextMenu.Provider} | |
1197 */ | |
1198 WebInspector.SourcesPanel.ContextMenuProvider = function() | |
1199 { | |
1200 } | |
1201 | |
1202 WebInspector.SourcesPanel.ContextMenuProvider.prototype = { | |
1203 /** | |
1204 * @override | |
1205 * @param {!Event} event | |
1206 * @param {!WebInspector.ContextMenu} contextMenu | |
1207 * @param {!Object} target | |
1208 */ | |
1209 appendApplicableItems: function(event, contextMenu, target) | |
1210 { | |
1211 WebInspector.SourcesPanel.instance().appendApplicableItems(event, contex tMenu, target); | |
1212 } | |
1213 } | |
1214 | |
1215 /** | |
1216 * @constructor | |
1217 * @implements {WebInspector.Revealer} | 1128 * @implements {WebInspector.Revealer} |
1218 */ | 1129 */ |
1219 WebInspector.SourcesPanel.UILocationRevealer = function() | 1130 WebInspector.SourcesPanel.UILocationRevealer = function() |
1220 { | 1131 { |
1221 } | 1132 } |
1222 | 1133 |
1223 WebInspector.SourcesPanel.UILocationRevealer.prototype = { | 1134 WebInspector.SourcesPanel.UILocationRevealer.prototype = { |
1224 /** | 1135 /** |
1225 * @override | 1136 * @override |
1226 * @param {!Object} uiLocation | 1137 * @param {!Object} uiLocation |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1362 return true; | 1273 return true; |
1363 case "debugger.step-out": | 1274 case "debugger.step-out": |
1364 panel._stepOut(); | 1275 panel._stepOut(); |
1365 return true; | 1276 return true; |
1366 case "debugger.run-snippet": | 1277 case "debugger.run-snippet": |
1367 panel._runSnippet(); | 1278 panel._runSnippet(); |
1368 return true; | 1279 return true; |
1369 case "debugger.toggle-breakpoints-active": | 1280 case "debugger.toggle-breakpoints-active": |
1370 panel._toggleBreakpointsActive(); | 1281 panel._toggleBreakpointsActive(); |
1371 return true; | 1282 return true; |
1283 case "debugger.evaluate-selection": | |
1284 var currentExecutionContext = WebInspector.context.flavor(WebInspect or.ExecutionContext); | |
1285 if (currentExecutionContext) { | |
1286 var range = context.flavor(WebInspector.TextRangeWithContent); | |
1287 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecut ionContext, range.content); | |
1288 } | |
1289 return true; | |
1372 } | 1290 } |
1373 return false; | 1291 return false; |
1374 } | 1292 } |
1375 } | 1293 } |
1376 | 1294 |
1377 WebInspector.SourcesPanel.show = function() | 1295 WebInspector.SourcesPanel.show = function() |
1378 { | 1296 { |
1379 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e()); | 1297 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e()); |
1380 } | 1298 } |
1381 | 1299 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1436 __proto__: WebInspector.VBox.prototype | 1354 __proto__: WebInspector.VBox.prototype |
1437 } | 1355 } |
1438 | 1356 |
1439 /** | 1357 /** |
1440 * @return {boolean} | 1358 * @return {boolean} |
1441 */ | 1359 */ |
1442 WebInspector.SourcesPanel.WrapperView.isShowing = function() | 1360 WebInspector.SourcesPanel.WrapperView.isShowing = function() |
1443 { | 1361 { |
1444 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); | 1362 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); |
1445 } | 1363 } |
OLD | NEW |