Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2238003002: DevTools: migrate sources panel sidebar to views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 this._splitWidget.show(this.element); 57 this._splitWidget.show(this.element);
58 58
59 // Create scripts navigator 59 // Create scripts navigator
60 const initialNavigatorWidth = 225; 60 const initialNavigatorWidth = 225;
61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth); 61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth);
62 this.editorView.enableShowModeSaving(); 62 this.editorView.enableShowModeSaving();
63 this.editorView.element.tabIndex = 0; 63 this.editorView.element.tabIndex = 0;
64 this._splitWidget.setMainWidget(this.editorView); 64 this._splitWidget.setMainWidget(this.editorView);
65 65
66 // Create navigator tabbed pane with toolbar. 66 // Create navigator tabbed pane with toolbar.
67 this._navigatorTabbedLocation = WebInspector.viewManager.createTabbedLocatio n(this._setAsCurrentPanel.bind(this), "navigator-view", true); 67 this._navigatorTabbedLocation = WebInspector.viewManager.createTabbedLocatio n(this._revealNavigatorSidebar.bind(this), "navigator-view", true);
68 var tabbedPane = this._navigatorTabbedLocation.tabbedPane(); 68 var tabbedPane = this._navigatorTabbedLocation.tabbedPane();
69 tabbedPane.setMinimumSize(100, 25); 69 tabbedPane.setMinimumSize(100, 25);
70 tabbedPane.setShrinkableTabs(true); 70 tabbedPane.setShrinkableTabs(true);
71 tabbedPane.element.classList.add("navigator-tabbed-pane"); 71 tabbedPane.element.classList.add("navigator-tabbed-pane");
72 var navigatorToolbar = new WebInspector.Toolbar(""); 72 var navigatorToolbar = new WebInspector.Toolbar("");
73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true); 73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true);
74 navigatorMenuButton.setTitle(WebInspector.UIString("More options")); 74 navigatorMenuButton.setTitle(WebInspector.UIString("More options"));
75 navigatorToolbar.appendToolbarItem(navigatorMenuButton); 75 navigatorToolbar.appendToolbarItem(navigatorMenuButton);
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 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane);
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); 263 WebInspector.context.setFlavor(WebInspector.Target, details.target() );
269 }, 264 },
270 265
271 /** 266 /**
272 * @param {!WebInspector.DebuggerPausedDetails} details 267 * @param {!WebInspector.DebuggerPausedDetails} details
273 */ 268 */
274 _showDebuggerPausedDetails: function(details) 269 _showDebuggerPausedDetails: function(details)
275 { 270 {
276 this._paused = true; 271 this._paused = true;
277 this._updateDebuggerButtons(); 272 this._updateDebuggerButtons();
278 273 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);
321 this._toggleDebuggerSidebarButton.disabled = true; 274 this._toggleDebuggerSidebarButton.disabled = true;
322 window.focus(); 275 window.focus();
323 InspectorFrontendHost.bringToFront(); 276 InspectorFrontendHost.bringToFront();
324 }, 277 },
325 278
326 /** 279 /**
327 * @param {!WebInspector.Event} event 280 * @param {!WebInspector.Event} event
328 */ 281 */
329 _debuggerResumed: function(event) 282 _debuggerResumed: function(event)
330 { 283 {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 _lastModificationTimeoutPassedForTest: function() 418 _lastModificationTimeoutPassedForTest: function()
466 { 419 {
467 WebInspector.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE; 420 WebInspector.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE;
468 }, 421 },
469 422
470 _updateLastModificationTimeForTest: function() 423 _updateLastModificationTimeForTest: function()
471 { 424 {
472 WebInspector.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE; 425 WebInspector.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE;
473 }, 426 },
474 427
475 /** 428 _callFrameChanged: function()
476 * @param {!WebInspector.Event} event
477 */
478 _callFrameSelectedOnModel: function(event)
479 { 429 {
480 var callFrame = /** @type {?WebInspector.DebuggerModel.CallFrame} */ (ev ent.data); 430 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.C allFrame);
481 if (!callFrame || callFrame.target() !== WebInspector.context.flavor(Web Inspector.Target)) 431 if (!callFrame)
482 return; 432 return;
483 this._selectCallFrameInUI(callFrame); 433 if (this._executionLineLocation)
484 }, 434 this._executionLineLocation.dispose();
485 435 this._executionLineLocation = WebInspector.debuggerWorkspaceBinding.crea teCallFrameLiveLocation(callFrame.location(), this._executionLineChanged.bind(th is), this._liveLocationPool);
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 }, 436 },
494 437
495 _pauseOnExceptionEnabledChanged: function() 438 _pauseOnExceptionEnabledChanged: function()
496 { 439 {
497 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); 440 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( );
498 this._pauseOnExceptionButton.setToggled(enabled); 441 this._pauseOnExceptionButton.setToggled(enabled);
499 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); 442 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions"));
500 this._debugToolbarDrawer.classList.toggle("expanded", enabled); 443 this._debugToolbarDrawer.classList.toggle("expanded", enabled);
501 }, 444 },
502 445
(...skipping 16 matching lines...) Expand all
519 this._togglePauseAction.setToggled(false); 462 this._togglePauseAction.setToggled(false);
520 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); 463 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() );
521 this._stepOverAction.setEnabled(false); 464 this._stepOverAction.setEnabled(false);
522 this._stepIntoAction.setEnabled(false); 465 this._stepIntoAction.setEnabled(false);
523 this._stepOutAction.setEnabled(false); 466 this._stepOutAction.setEnabled(false);
524 } 467 }
525 }, 468 },
526 469
527 _clearInterface: function() 470 _clearInterface: function()
528 { 471 {
529 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();
530
531 this._sourcesView.clearCurrentExecutionLine(); 472 this._sourcesView.clearCurrentExecutionLine();
532 this._updateDebuggerButtons(); 473 this._updateDebuggerButtons();
474 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ;
533 475
534 if (this._switchToPausedTargetTimeout) 476 if (this._switchToPausedTargetTimeout)
535 clearTimeout(this._switchToPausedTargetTimeout); 477 clearTimeout(this._switchToPausedTargetTimeout);
536 this._liveLocationPool.disposeAll(); 478 this._liveLocationPool.disposeAll();
537 }, 479 },
538 480
539 /** 481 /**
540 * @param {!WebInspector.DebuggerModel} debuggerModel 482 * @param {!WebInspector.DebuggerModel} debuggerModel
541 */ 483 */
542 _switchToPausedTarget: function(debuggerModel) 484 _switchToPausedTarget: function(debuggerModel)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 662
721 _toggleBreakpointsActive: function() 663 _toggleBreakpointsActive: function()
722 { 664 {
723 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp ointManager.breakpointsActive()); 665 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp ointManager.breakpointsActive());
724 }, 666 },
725 667
726 _breakpointsActiveStateChanged: function(event) 668 _breakpointsActiveStateChanged: function(event)
727 { 669 {
728 var active = event.data; 670 var active = event.data;
729 this._toggleBreakpointsActiveAction.setToggled(!active); 671 this._toggleBreakpointsActiveAction.setToggled(!active);
730 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active);
731 this._sourcesView.toggleBreakpointsActiveState(active); 672 this._sourcesView.toggleBreakpointsActiveState(active);
732 }, 673 },
733 674
734 /** 675 /**
735 * @return {!WebInspector.Toolbar} 676 * @return {!WebInspector.Toolbar}
736 */ 677 */
737 _createDebugToolbar: function() 678 _createDebugToolbar: function()
738 { 679 {
739 var debugToolbar = new WebInspector.Toolbar("scripts-debug-toolbar"); 680 var debugToolbar = new WebInspector.Toolbar("scripts-debug-toolbar");
740 681
(...skipping 25 matching lines...) Expand all
766 { 707 {
767 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to olbar-drawer"); 708 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to olbar-drawer");
768 709
769 var label = WebInspector.UIString("Pause On Caught Exceptions"); 710 var label = WebInspector.UIString("Pause On Caught Exceptions");
770 var setting = WebInspector.moduleSetting("pauseOnCaughtException"); 711 var setting = WebInspector.moduleSetting("pauseOnCaughtException");
771 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true)); 712 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingChec kbox(label, setting, true));
772 713
773 return debugToolbarDrawer; 714 return debugToolbarDrawer;
774 }, 715 },
775 716
776 addToWatch: function(expression)
777 {
778 this.sidebarPanes.watchExpressions.addExpression(expression);
779 },
780
781 _installDebuggerSidebarController: function() 717 _installDebuggerSidebarController: function()
782 { 718 {
783 this.editorView.displayShowHideSidebarButton("navigator"); 719 this.editorView.displayShowHideSidebarButton("navigator");
784 this._toggleDebuggerSidebarButton = this._splitWidget.displayShowHideSid ebarButton("debugger", "scripts-debugger-show-hide-button"); 720 this._toggleDebuggerSidebarButton = this._splitWidget.displayShowHideSid ebarButton("debugger", "scripts-debugger-show-hide-button");
785 }, 721 },
786 722
787 /** 723 /**
788 * @param {!WebInspector.UISourceCode} uiSourceCode 724 * @param {!WebInspector.UISourceCode} uiSourceCode
789 */ 725 */
790 _showLocalHistory: function(uiSourceCode) 726 _showLocalHistory: function(uiSourceCode)
791 { 727 {
792 WebInspector.RevisionHistoryView.showHistory(uiSourceCode); 728 WebInspector.RevisionHistoryView.showHistory(uiSourceCode);
793 }, 729 },
794 730
795 /** 731 /**
796 * @override 732 * @override
797 * @param {!Event} event 733 * @param {!Event} event
798 * @param {!WebInspector.ContextMenu} contextMenu 734 * @param {!WebInspector.ContextMenu} contextMenu
799 * @param {!Object} target 735 * @param {!Object} target
800 */ 736 */
801 appendApplicableItems: function(event, contextMenu, target) 737 appendApplicableItems: function(event, contextMenu, target)
802 { 738 {
803 this._appendUISourceCodeItems(event, contextMenu, target); 739 this._appendUISourceCodeItems(event, contextMenu, target);
804 this.appendUILocationItems(contextMenu, target); 740 this.appendUILocationItems(contextMenu, target);
805 this._appendRemoteObjectItems(contextMenu, target); 741 this._appendRemoteObjectItems(contextMenu, target);
806 this._appendNetworkRequestItems(contextMenu, target); 742 this._appendNetworkRequestItems(contextMenu, target);
743 contextMenu.appendAction("debugger.evaluate-selection");
807 }, 744 },
808 745
809 /** 746 /**
810 * @param {!WebInspector.UISourceCode} uiSourceCode 747 * @param {!WebInspector.UISourceCode} uiSourceCode
811 */ 748 */
812 mapFileSystemToNetwork: function(uiSourceCode) 749 mapFileSystemToNetwork: function(uiSourceCode)
813 { 750 {
814 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this)); 751 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this));
815 752
816 /** 753 /**
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 857
921 var contentType = uiSourceCode.contentType(); 858 var contentType = uiSourceCode.contentType();
922 if (contentType.hasScripts()) { 859 if (contentType.hasScripts()) {
923 var target = WebInspector.context.flavor(WebInspector.Target); 860 var target = WebInspector.context.flavor(WebInspector.Target);
924 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 861 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
925 if (debuggerModel && debuggerModel.isPaused()) 862 if (debuggerModel && debuggerModel.isPaused())
926 contextMenu.appendItem(WebInspector.UIString.capitalize("Continu e to ^here"), this._continueToLocation.bind(this, uiLocation)); 863 contextMenu.appendItem(WebInspector.UIString.capitalize("Continu e to ^here"), this._continueToLocation.bind(this, uiLocation));
927 } 864 }
928 865
929 if (contentType.hasScripts() && projectType !== WebInspector.projectType s.Snippets) 866 if (contentType.hasScripts() && projectType !== WebInspector.projectType s.Snippets)
930 this.sidebarPanes.callstack.appendBlackboxURLContextMenuItems(contex tMenu, uiSourceCode); 867 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, u iSourceCode);
931 }, 868 },
932 869
933 /** 870 /**
934 * @param {!WebInspector.UISourceCode} uiSourceCode 871 * @param {!WebInspector.UISourceCode} uiSourceCode
935 */ 872 */
936 _handleContextMenuReveal: function(uiSourceCode) 873 _handleContextMenuReveal: function(uiSourceCode)
937 { 874 {
938 this.editorView.showBoth(); 875 this.editorView.showBoth();
939 this._revealInNavigator(uiSourceCode); 876 this._revealInNavigator(uiSourceCode);
940 }, 877 },
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(location); 994 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(location);
1058 if (uiLocation) 995 if (uiLocation)
1059 this.showUILocation(uiLocation); 996 this.showUILocation(uiLocation);
1060 }, 997 },
1061 998
1062 showGoToSourceDialog: function() 999 showGoToSourceDialog: function()
1063 { 1000 {
1064 this._sourcesView.showOpenResourceDialog(); 1001 this._sourcesView.showOpenResourceDialog();
1065 }, 1002 },
1066 1003
1004 _revealNavigatorSidebar: function()
1005 {
1006 this._setAsCurrentPanel();
1007 this.editorView.showBoth(true);
1008 },
1009
1010 _revealDebuggerSidebar: function()
1011 {
1012 this._setAsCurrentPanel();
1013 this._splitWidget.showBoth(true);
1014 },
1015
1067 _updateSidebarPosition: function() 1016 _updateSidebarPosition: function()
1068 { 1017 {
1069 var vertically; 1018 var vertically;
1070 var position = WebInspector.moduleSetting("sidebarPosition").get(); 1019 var position = WebInspector.moduleSetting("sidebarPosition").get();
1071 if (position === "right") 1020 if (position === "right")
1072 vertically = false; 1021 vertically = false;
1073 else if (position === "bottom") 1022 else if (position === "bottom")
1074 vertically = true; 1023 vertically = true;
1075 else 1024 else
1076 vertically = WebInspector.inspectorView.element.offsetWidth < 680; 1025 vertically = WebInspector.inspectorView.element.offsetWidth < 680;
1077 1026
1078 if (this.sidebarPaneView && vertically === !this._splitWidget.isVertical ()) 1027 if (this.sidebarPaneView && vertically === !this._splitWidget.isVertical ())
1079 return; 1028 return;
1080 1029
1081 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach()) 1030 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach())
1082 return; // We can't reparent extension iframes. 1031 return; // We can't reparent extension iframes.
1083 1032
1084 if (this.sidebarPaneView) 1033 if (this.sidebarPaneView)
1085 this.sidebarPaneView.detach(); 1034 this.sidebarPaneView.detach();
1086 1035
1087 this._splitWidget.setVertical(!vertically); 1036 this._splitWidget.setVertical(!vertically);
1088 this._splitWidget.element.classList.toggle("sources-split-view-vertical" , vertically); 1037 this._splitWidget.element.classList.toggle("sources-split-view-vertical" , vertically);
1089 1038
1090 WebInspector.SourcesPanel.updateResizer(this); 1039 WebInspector.SourcesPanel.updateResizer(this);
1091 1040
1092 // Create vertical box with stack. 1041 // Create vertical box with stack.
1093 var vbox = new WebInspector.VBox(); 1042 var vbox = new WebInspector.VBox();
1094 vbox.element.appendChild(this._debugToolbarDrawer); 1043 vbox.element.appendChild(this._debugToolbarDrawer);
1095 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); 1044 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100);
1096 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._setAsCurrentPanel.bind(this)); 1045 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this));
1097 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); 1046 this._sidebarPaneStack.widget().element.classList.add("overflow-auto");
1098 this._sidebarPaneStack.widget().show(vbox.element); 1047 this._sidebarPaneStack.widget().show(vbox.element);
1099 vbox.element.appendChild(this._debugToolbar.element); 1048 vbox.element.appendChild(this._debugToolbar.element);
1100 1049
1101 if (this.sidebarPanes.threads) 1050 if (this._threadsSidebarPane)
1102 this._sidebarPaneStack.showView(this.sidebarPanes.threads); 1051 this._sidebarPaneStack.showView(this._threadsSidebarPane);
1103 1052
1104 if (!vertically) { 1053 if (!vertically)
1105 if (this.sidebarPanes.watchExpressions.hasExpressions()) 1054 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 1055
1111 this._sidebarPaneStack.showView(this.sidebarPanes.callstack); 1056 this._sidebarPaneStack.showView(this._callstackPane);
1057 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints"));
1058 var scopeChainView = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.scopeChain"));
1112 1059
1113 if (!vertically) { 1060 if (!vertically) {
1114 // Populate the rest of the stack. 1061 // Populate the rest of the stack.
1115 this._sidebarPaneStack.showView(this.sidebarPanes.scopechain); 1062 this._sidebarPaneStack.showView(scopeChainView);
1116 this._sidebarPaneStack.showView(this.sidebarPanes.jsBreakpoints); 1063 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; 1064 this._extensionSidebarPanesContainer = this._sidebarPaneStack;
1122 this.sidebarPaneView = vbox; 1065 this.sidebarPaneView = vbox;
1123 } else { 1066 } else {
1124 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5); 1067 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5);
1125 splitWidget.setMainWidget(vbox); 1068 splitWidget.setMainWidget(vbox);
1126 1069
1127 // Populate the left stack. 1070 // Populate the left stack.
1128 this._sidebarPaneStack.showView(this.sidebarPanes.jsBreakpoints); 1071 this._sidebarPaneStack.showView(jsBreakpoints);
1129 1072
1130 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(t his._setAsCurrentPanel.bind(this)); 1073 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(t his._revealDebuggerSidebar.bind(this));
1131 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane()); 1074 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane());
1132 tabbedLocation.appendView(this.sidebarPanes.scopechain); 1075 tabbedLocation.appendView(scopeChainView);
1133 tabbedLocation.appendView(this.sidebarPanes.watchExpressions); 1076 tabbedLocation.appendView(this._watchSidebarPane);
1134 this._extensionSidebarPanesContainer = tabbedLocation; 1077 this._extensionSidebarPanesContainer = tabbedLocation;
1135 this.sidebarPaneView = splitWidget; 1078 this.sidebarPaneView = splitWidget;
1136 } 1079 }
1137 1080
1138 this._sidebarPaneStack.appendApplicableItems("sources-sidebar"); 1081 this._sidebarPaneStack.appendApplicableItems("sources-sidebar");
1139 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); 1082 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes();
1140 for (var i = 0; i < extensionSidebarPanes.length; ++i) 1083 for (var i = 0; i < extensionSidebarPanes.length; ++i)
1141 this._addExtensionSidebarPane(extensionSidebarPanes[i]); 1084 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
1142 1085
1143 this._splitWidget.setSidebarWidget(this.sidebarPaneView); 1086 this._splitWidget.setSidebarWidget(this.sidebarPaneView);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 if (!entry.isDirectory) 1129 if (!entry.isDirectory)
1187 return; 1130 return;
1188 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst em); 1131 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst em);
1189 }, 1132 },
1190 1133
1191 __proto__: WebInspector.Panel.prototype 1134 __proto__: WebInspector.Panel.prototype
1192 } 1135 }
1193 1136
1194 /** 1137 /**
1195 * @constructor 1138 * @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} 1139 * @implements {WebInspector.Revealer}
1218 */ 1140 */
1219 WebInspector.SourcesPanel.UILocationRevealer = function() 1141 WebInspector.SourcesPanel.UILocationRevealer = function()
1220 { 1142 {
1221 } 1143 }
1222 1144
1223 WebInspector.SourcesPanel.UILocationRevealer.prototype = { 1145 WebInspector.SourcesPanel.UILocationRevealer.prototype = {
1224 /** 1146 /**
1225 * @override 1147 * @override
1226 * @param {!Object} uiLocation 1148 * @param {!Object} uiLocation
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 return true; 1284 return true;
1363 case "debugger.step-out": 1285 case "debugger.step-out":
1364 panel._stepOut(); 1286 panel._stepOut();
1365 return true; 1287 return true;
1366 case "debugger.run-snippet": 1288 case "debugger.run-snippet":
1367 panel._runSnippet(); 1289 panel._runSnippet();
1368 return true; 1290 return true;
1369 case "debugger.toggle-breakpoints-active": 1291 case "debugger.toggle-breakpoints-active":
1370 panel._toggleBreakpointsActive(); 1292 panel._toggleBreakpointsActive();
1371 return true; 1293 return true;
1294 case "debugger.evaluate-selection":
1295 var frame = WebInspector.context.flavor(WebInspector.UISourceCodeFra me);
1296 if (frame) {
1297 var text = frame.textEditor.copyRange(frame.textEditor.selection ());
1298 var executionContext = WebInspector.context.flavor(WebInspector. ExecutionContext);
1299 if (executionContext)
dgozman 2016/08/16 01:05:10 Let's check for context before copying the text?
1300 WebInspector.ConsoleModel.evaluateCommandInConsole(execution Context, text);
1301 }
1302 return true;
1372 } 1303 }
1373 return false; 1304 return false;
1374 } 1305 }
1375 } 1306 }
1376 1307
1377 WebInspector.SourcesPanel.show = function() 1308 WebInspector.SourcesPanel.show = function()
1378 { 1309 {
1379 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e()); 1310 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e());
1380 } 1311 }
1381 1312
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 __proto__: WebInspector.VBox.prototype 1367 __proto__: WebInspector.VBox.prototype
1437 } 1368 }
1438 1369
1439 /** 1370 /**
1440 * @return {boolean} 1371 * @return {boolean}
1441 */ 1372 */
1442 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1373 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1443 { 1374 {
1444 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1375 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1445 } 1376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698