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

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

Issue 2389883003: DevTools: hoist debugger paused reason to top (Closed)
Patch Set: update test for windows compat Created 4 years, 1 month 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 this._runSnippetAction = /** @type {!WebInspector.Action }*/ (WebInspector.a ctionRegistry.action("debugger.run-snippet")); 44 this._runSnippetAction = /** @type {!WebInspector.Action }*/ (WebInspector.a ctionRegistry.action("debugger.run-snippet"));
45 this._togglePauseAction = /** @type {!WebInspector.Action }*/ (WebInspector. actionRegistry.action("debugger.toggle-pause")); 45 this._togglePauseAction = /** @type {!WebInspector.Action }*/ (WebInspector. actionRegistry.action("debugger.toggle-pause"));
46 this._stepOverAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-over")); 46 this._stepOverAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-over"));
47 this._stepIntoAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-into")); 47 this._stepIntoAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-into"));
48 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action("debugger.step-out")); 48 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action("debugger.step-out"));
49 this._toggleBreakpointsActiveAction = /** @type {!WebInspector.Action }*/ (W ebInspector.actionRegistry.action("debugger.toggle-breakpoints-active")); 49 this._toggleBreakpointsActiveAction = /** @type {!WebInspector.Action }*/ (W ebInspector.actionRegistry.action("debugger.toggle-breakpoints-active"));
50 50
51 this._debugToolbar = this._createDebugToolbar(); 51 this._debugToolbar = this._createDebugToolbar();
52 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); 52 this._debugToolbarDrawer = this._createDebugToolbarDrawer();
53 this._debuggerPausedMessage = new WebInspector.DebuggerPausedMessage();
53 54
54 const initialDebugSidebarWidth = 225; 55 const initialDebugSidebarWidth = 225;
55 this._splitWidget = new WebInspector.SplitWidget(true, true, "sourcesPanelSp litViewState", initialDebugSidebarWidth); 56 this._splitWidget = new WebInspector.SplitWidget(true, true, "sourcesPanelSp litViewState", initialDebugSidebarWidth);
56 this._splitWidget.enableShowModeSaving(); 57 this._splitWidget.enableShowModeSaving();
57 this._splitWidget.show(this.element); 58 this._splitWidget.show(this.element);
58 59
59 // Create scripts navigator 60 // Create scripts navigator
60 const initialNavigatorWidth = 225; 61 const initialNavigatorWidth = 225;
61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth); 62 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth);
62 this.editorView.enableShowModeSaving(); 63 this.editorView.enableShowModeSaving();
(...skipping 23 matching lines...) Expand all
86 this._threadsSidebarPane = null; 87 this._threadsSidebarPane = null;
87 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.watch")); 88 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.watch"));
88 // TODO: Force installing listeners from the model, not the UI. 89 // TODO: Force installing listeners from the model, not the UI.
89 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); 90 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane);
90 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane); 91 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane);
91 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); 92 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this));
92 93
93 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); 94 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this));
94 this._updateSidebarPosition(); 95 this._updateSidebarPosition();
95 96
96 this._updateDebuggerButtons(); 97 this._updateDebuggerButtonsAndStatus();
97 this._pauseOnExceptionEnabledChanged(); 98 this._pauseOnExceptionEnabledChanged();
98 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this); 99 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this);
99 100
100 this._liveLocationPool = new WebInspector.LiveLocationPool(); 101 this._liveLocationPool = new WebInspector.LiveLocationPool();
101 102
102 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); 103 this._setTarget(WebInspector.context.flavor(WebInspector.Target));
103 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); 104 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is);
104 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); 105 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this);
105 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this); 106 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this);
106 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this ); 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this );
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 else if (!this._paused) 256 else if (!this._paused)
256 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); 257 WebInspector.context.setFlavor(WebInspector.Target, details.target() );
257 }, 258 },
258 259
259 /** 260 /**
260 * @param {!WebInspector.DebuggerPausedDetails} details 261 * @param {!WebInspector.DebuggerPausedDetails} details
261 */ 262 */
262 _showDebuggerPausedDetails: function(details) 263 _showDebuggerPausedDetails: function(details)
263 { 264 {
264 this._paused = true; 265 this._paused = true;
265 this._updateDebuggerButtons(); 266 this._updateDebuggerButtonsAndStatus();
266 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls); 267 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls);
267 this._toggleDebuggerSidebarButton.setEnabled(false); 268 this._toggleDebuggerSidebarButton.setEnabled(false);
268 window.focus(); 269 window.focus();
269 InspectorFrontendHost.bringToFront(); 270 InspectorFrontendHost.bringToFront();
270 }, 271 },
271 272
272 /** 273 /**
273 * @param {!WebInspector.Event} event 274 * @param {!WebInspector.Event} event
274 */ 275 */
275 _debuggerResumed: function(event) 276 _debuggerResumed: function(event)
(...skipping 10 matching lines...) Expand all
286 287
287 /** 288 /**
288 * @param {!WebInspector.Event} event 289 * @param {!WebInspector.Event} event
289 */ 290 */
290 _debuggerWasEnabled: function(event) 291 _debuggerWasEnabled: function(event)
291 { 292 {
292 var target = /** @type {!WebInspector.Target} */ (event.target.target() ); 293 var target = /** @type {!WebInspector.Target} */ (event.target.target() );
293 if (WebInspector.context.flavor(WebInspector.Target) !== target) 294 if (WebInspector.context.flavor(WebInspector.Target) !== target)
294 return; 295 return;
295 296
296 this._updateDebuggerButtons(); 297 this._updateDebuggerButtonsAndStatus();
297 }, 298 },
298 299
299 /** 300 /**
300 * @param {!WebInspector.Event} event 301 * @param {!WebInspector.Event} event
301 */ 302 */
302 _debuggerReset: function(event) 303 _debuggerReset: function(event)
303 { 304 {
304 this._debuggerResumed(event); 305 this._debuggerResumed(event);
305 }, 306 },
306 307
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 }, 440 },
440 441
441 _pauseOnExceptionEnabledChanged: function() 442 _pauseOnExceptionEnabledChanged: function()
442 { 443 {
443 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); 444 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( );
444 this._pauseOnExceptionButton.setToggled(enabled); 445 this._pauseOnExceptionButton.setToggled(enabled);
445 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); 446 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions"));
446 this._debugToolbarDrawer.classList.toggle("expanded", enabled); 447 this._debugToolbarDrawer.classList.toggle("expanded", enabled);
447 }, 448 },
448 449
449 _updateDebuggerButtons: function() 450 _updateDebuggerButtonsAndStatus: function()
450 { 451 {
451 var currentTarget = WebInspector.context.flavor(WebInspector.Target); 452 var currentTarget = WebInspector.context.flavor(WebInspector.Target);
452 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target); 453 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target);
453 if (!currentDebuggerModel) { 454 if (!currentDebuggerModel) {
454 this._togglePauseAction.setEnabled(false); 455 this._togglePauseAction.setEnabled(false);
455 this._stepOverAction.setEnabled(false); 456 this._stepOverAction.setEnabled(false);
456 this._stepIntoAction.setEnabled(false); 457 this._stepIntoAction.setEnabled(false);
457 this._stepOutAction.setEnabled(false); 458 this._stepOutAction.setEnabled(false);
458 } else if (this._paused) { 459 } else if (this._paused) {
459 this._togglePauseAction.setToggled(true); 460 this._togglePauseAction.setToggled(true);
460 this._togglePauseAction.setEnabled(true); 461 this._togglePauseAction.setEnabled(true);
461 this._stepOverAction.setEnabled(true); 462 this._stepOverAction.setEnabled(true);
462 this._stepIntoAction.setEnabled(true); 463 this._stepIntoAction.setEnabled(true);
463 this._stepOutAction.setEnabled(true); 464 this._stepOutAction.setEnabled(true);
464 } else { 465 } else {
465 this._togglePauseAction.setToggled(false); 466 this._togglePauseAction.setToggled(false);
466 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); 467 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() );
467 this._stepOverAction.setEnabled(false); 468 this._stepOverAction.setEnabled(false);
468 this._stepIntoAction.setEnabled(false); 469 this._stepIntoAction.setEnabled(false);
469 this._stepOutAction.setEnabled(false); 470 this._stepOutAction.setEnabled(false);
470 } 471 }
472
473 var details = currentDebuggerModel ? currentDebuggerModel.debuggerPaused Details() : null;
474 this._debuggerPausedMessage.render(details, WebInspector.debuggerWorkspa ceBinding, WebInspector.breakpointManager);
471 }, 475 },
472 476
473 _clearInterface: function() 477 _clearInterface: function()
474 { 478 {
475 this._sourcesView.clearCurrentExecutionLine(); 479 this._sourcesView.clearCurrentExecutionLine();
476 this._updateDebuggerButtons(); 480 this._updateDebuggerButtonsAndStatus();
477 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ; 481 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ;
478 482
479 if (this._switchToPausedTargetTimeout) 483 if (this._switchToPausedTargetTimeout)
480 clearTimeout(this._switchToPausedTargetTimeout); 484 clearTimeout(this._switchToPausedTargetTimeout);
481 this._liveLocationPool.disposeAll(); 485 this._liveLocationPool.disposeAll();
482 }, 486 },
483 487
484 /** 488 /**
485 * @param {!WebInspector.DebuggerModel} debuggerModel 489 * @param {!WebInspector.DebuggerModel} debuggerModel
486 */ 490 */
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 1052
1049 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); 1053 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this);
1050 1054
1051 // Create vertical box with stack. 1055 // Create vertical box with stack.
1052 var vbox = new WebInspector.VBox(); 1056 var vbox = new WebInspector.VBox();
1053 vbox.element.appendChild(this._debugToolbarDrawer); 1057 vbox.element.appendChild(this._debugToolbarDrawer);
1054 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); 1058 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100);
1055 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this)); 1059 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this));
1056 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); 1060 this._sidebarPaneStack.widget().element.classList.add("overflow-auto");
1057 this._sidebarPaneStack.widget().show(vbox.element); 1061 this._sidebarPaneStack.widget().show(vbox.element);
1062 this._sidebarPaneStack.widget().element.appendChild(this._debuggerPaused Message.element());
1058 vbox.element.appendChild(this._debugToolbar.element); 1063 vbox.element.appendChild(this._debugToolbar.element);
1059 1064
1060 if (this._threadsSidebarPane) 1065 if (this._threadsSidebarPane)
1061 this._sidebarPaneStack.showView(this._threadsSidebarPane); 1066 this._sidebarPaneStack.showView(this._threadsSidebarPane);
1062 1067
1063 if (!vertically) 1068 if (!vertically)
1064 this._sidebarPaneStack.appendView(this._watchSidebarPane); 1069 this._sidebarPaneStack.appendView(this._watchSidebarPane);
1065 1070
1066 this._sidebarPaneStack.showView(this._callstackPane); 1071 this._sidebarPaneStack.showView(this._callstackPane);
1067 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints")); 1072 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints"));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 __proto__: WebInspector.VBox.prototype 1390 __proto__: WebInspector.VBox.prototype
1386 } 1391 }
1387 1392
1388 /** 1393 /**
1389 * @return {boolean} 1394 * @return {boolean}
1390 */ 1395 */
1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1396 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1392 { 1397 {
1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1398 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1394 } 1399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698