Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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._debugStatusMessageElement = createElementWithClass("div", "paused-stat us"); | |
| 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 Loading... | |
| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 else if (!this._paused) | 262 else if (!this._paused) |
| 262 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); | 263 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); |
| 263 }, | 264 }, |
| 264 | 265 |
| 265 /** | 266 /** |
| 266 * @param {!WebInspector.DebuggerPausedDetails} details | 267 * @param {!WebInspector.DebuggerPausedDetails} details |
| 267 */ | 268 */ |
| 268 _showDebuggerPausedDetails: function(details) | 269 _showDebuggerPausedDetails: function(details) |
| 269 { | 270 { |
| 270 this._paused = true; | 271 this._paused = true; |
| 271 this._updateDebuggerButtons(); | 272 this._updateDebuggerButtonsAndStatus(); |
| 272 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls); | 273 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls); |
| 273 this._toggleDebuggerSidebarButton.setEnabled(false); | 274 this._toggleDebuggerSidebarButton.setEnabled(false); |
| 274 window.focus(); | 275 window.focus(); |
| 275 InspectorFrontendHost.bringToFront(); | 276 InspectorFrontendHost.bringToFront(); |
| 276 }, | 277 }, |
| 277 | 278 |
| 278 /** | 279 /** |
| 279 * @param {!WebInspector.Event} event | 280 * @param {!WebInspector.Event} event |
| 280 */ | 281 */ |
| 281 _debuggerResumed: function(event) | 282 _debuggerResumed: function(event) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 292 | 293 |
| 293 /** | 294 /** |
| 294 * @param {!WebInspector.Event} event | 295 * @param {!WebInspector.Event} event |
| 295 */ | 296 */ |
| 296 _debuggerWasEnabled: function(event) | 297 _debuggerWasEnabled: function(event) |
| 297 { | 298 { |
| 298 var target = /** @type {!WebInspector.Target} */ (event.target.target() ); | 299 var target = /** @type {!WebInspector.Target} */ (event.target.target() ); |
| 299 if (WebInspector.context.flavor(WebInspector.Target) !== target) | 300 if (WebInspector.context.flavor(WebInspector.Target) !== target) |
| 300 return; | 301 return; |
| 301 | 302 |
| 302 this._updateDebuggerButtons(); | 303 this._updateDebuggerButtonsAndStatus(); |
| 303 }, | 304 }, |
| 304 | 305 |
| 305 /** | 306 /** |
| 306 * @param {!WebInspector.Event} event | 307 * @param {!WebInspector.Event} event |
| 307 */ | 308 */ |
| 308 _debuggerReset: function(event) | 309 _debuggerReset: function(event) |
| 309 { | 310 { |
| 310 this._debuggerResumed(event); | 311 this._debuggerResumed(event); |
| 311 }, | 312 }, |
| 312 | 313 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 }, | 446 }, |
| 446 | 447 |
| 447 _pauseOnExceptionEnabledChanged: function() | 448 _pauseOnExceptionEnabledChanged: function() |
| 448 { | 449 { |
| 449 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); | 450 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); |
| 450 this._pauseOnExceptionButton.setToggled(enabled); | 451 this._pauseOnExceptionButton.setToggled(enabled); |
| 451 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); | 452 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); |
| 452 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 453 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
| 453 }, | 454 }, |
| 454 | 455 |
| 455 _updateDebuggerButtons: function() | 456 _updateDebuggerButtonsAndStatus: function() |
| 456 { | 457 { |
| 457 var currentTarget = WebInspector.context.flavor(WebInspector.Target); | 458 var currentTarget = WebInspector.context.flavor(WebInspector.Target); |
| 458 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target); | 459 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target); |
| 459 if (!currentDebuggerModel) { | 460 if (!currentDebuggerModel) { |
| 460 this._togglePauseAction.setEnabled(false); | 461 this._togglePauseAction.setEnabled(false); |
| 461 this._stepOverAction.setEnabled(false); | 462 this._stepOverAction.setEnabled(false); |
| 462 this._stepIntoAction.setEnabled(false); | 463 this._stepIntoAction.setEnabled(false); |
| 463 this._stepOutAction.setEnabled(false); | 464 this._stepOutAction.setEnabled(false); |
| 464 } else if (this._paused) { | 465 } else if (this._paused) { |
| 465 this._togglePauseAction.setToggled(true); | 466 this._togglePauseAction.setToggled(true); |
| 466 this._togglePauseAction.setEnabled(true); | 467 this._togglePauseAction.setEnabled(true); |
| 467 this._stepOverAction.setEnabled(true); | 468 this._stepOverAction.setEnabled(true); |
| 468 this._stepIntoAction.setEnabled(true); | 469 this._stepIntoAction.setEnabled(true); |
| 469 this._stepOutAction.setEnabled(true); | 470 this._stepOutAction.setEnabled(true); |
| 470 } else { | 471 } else { |
| 471 this._togglePauseAction.setToggled(false); | 472 this._togglePauseAction.setToggled(false); |
| 472 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); | 473 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); |
| 473 this._stepOverAction.setEnabled(false); | 474 this._stepOverAction.setEnabled(false); |
| 474 this._stepIntoAction.setEnabled(false); | 475 this._stepIntoAction.setEnabled(false); |
| 475 this._stepOutAction.setEnabled(false); | 476 this._stepOutAction.setEnabled(false); |
| 476 } | 477 } |
| 478 | |
| 479 var status = this._debugStatusMessageElement; | |
| 480 var details = currentDebuggerModel && currentDebuggerModel.debuggerPause dDetails(); | |
| 481 status.hidden = !details; | |
| 482 status.removeChildren(); | |
| 483 | |
| 484 if (details) { | |
|
lushnikov
2016/10/12 21:26:59
if (details)
status.appendChild(this._buildPau
luoe
2016/10/13 00:36:58
Done with a widget as this._debuggerPausedMessage.
| |
| 485 var mainText = createElement("div"); | |
| 486 var subText = createElement("div"); | |
| 487 if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) { | |
|
lushnikov
2016/10/12 21:26:59
Let's create a widget for this thing!
It will hav
luoe
2016/10/13 00:36:58
Done as DebuggerPausedMessage.js
| |
| 488 mainText = WebInspector.domBreakpointsSidebarPane.createBreakpoi ntHitMainMessage(details); | |
| 489 subText = WebInspector.domBreakpointsSidebarPane.createBreakpoin tHitSubMessage(details); | |
| 490 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .EventListener) { | |
| 491 var eventName = details.auxData["eventName"]; | |
| 492 var eventNameForUI = WebInspector.EventListenerBreakpointsSideba rPane.eventNameForUI(eventName, details.auxData); | |
| 493 mainText.textContent = WebInspector.UIString("Paused on event li stener"); | |
| 494 subText.textContent = eventNameForUI; | |
| 495 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .XHR) { | |
| 496 mainText.textContent = WebInspector.UIString("Paused on XMLHttpR equest"); | |
| 497 subText.textContent = details.auxData["url"] || ""; | |
| 498 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .Exception) { | |
| 499 var description = details.auxData["description"] || details.auxD ata["value"] || ""; | |
| 500 mainText.textContent = WebInspector.UIString("Paused on exceptio n"); | |
| 501 subText.textContent = description.split("\n", 1)[0]; | |
| 502 status.title = description; | |
| 503 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .PromiseRejection) { | |
| 504 var description = details.auxData["description"] || ""; | |
| 505 mainText.textContent = WebInspector.UIString("Paused on promise rejection"); | |
| 506 subText.textContent = description.split("\n", 1)[0]; | |
| 507 status.title = description; | |
| 508 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .Assert) { | |
| 509 mainText.textContent = WebInspector.UIString("Paused on assertio n"); | |
| 510 } else if (details.reason === WebInspector.DebuggerModel.BreakReason .DebugCommand) { | |
| 511 mainText.textContent = WebInspector.UIString("Paused on debugged function"); | |
| 512 } else if (details.callFrames.length) { | |
| 513 var uiLocation = details && details.callFrames.length ? WebInspe ctor.debuggerWorkspaceBinding.rawLocationToUILocation(details.callFrames[0].loca tion()) : null; | |
| 514 var breakpoint = uiLocation ? WebInspector.breakpointManager.fin dBreakpointOnLine(uiLocation.uiSourceCode, uiLocation.lineNumber) : null; | |
| 515 if (breakpoint) | |
| 516 mainText.textContent = WebInspector.UIString("Paused on brea kpoint"); | |
| 517 else | |
| 518 mainText.textContent = WebInspector.UIString("Debugger pause d"); | |
| 519 } else { | |
| 520 console.warn("ScriptsPanel paused, but callFrames.length is zero ."); // TODO remove this once we understand this case better | |
| 521 } | |
| 522 | |
| 523 var errorLike = details.reason === WebInspector.DebuggerModel.BreakR eason.Exception || details.reason === WebInspector.DebuggerModel.BreakReason.Pro miseRejection || details.reason === WebInspector.DebuggerModel.BreakReason.Asser t; | |
| 524 status.classList.toggle("error-reason", errorLike); | |
| 525 status.appendChild(mainText); | |
| 526 status.appendChild(subText); | |
| 527 mainText.classList.add("status-main"); | |
| 528 subText.classList.add("status-sub"); | |
| 529 } | |
| 477 }, | 530 }, |
| 478 | 531 |
| 479 _clearInterface: function() | 532 _clearInterface: function() |
| 480 { | 533 { |
| 481 this._sourcesView.clearCurrentExecutionLine(); | 534 this._sourcesView.clearCurrentExecutionLine(); |
| 482 this._updateDebuggerButtons(); | 535 this._updateDebuggerButtonsAndStatus(); |
| 483 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ; | 536 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ; |
| 484 | 537 |
| 485 if (this._switchToPausedTargetTimeout) | 538 if (this._switchToPausedTargetTimeout) |
| 486 clearTimeout(this._switchToPausedTargetTimeout); | 539 clearTimeout(this._switchToPausedTargetTimeout); |
| 487 this._liveLocationPool.disposeAll(); | 540 this._liveLocationPool.disposeAll(); |
| 488 }, | 541 }, |
| 489 | 542 |
| 490 /** | 543 /** |
| 491 * @param {!WebInspector.DebuggerModel} debuggerModel | 544 * @param {!WebInspector.DebuggerModel} debuggerModel |
| 492 */ | 545 */ |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1054 | 1107 |
| 1055 WebInspector.SourcesPanel.updateResizer(this); | 1108 WebInspector.SourcesPanel.updateResizer(this); |
| 1056 | 1109 |
| 1057 // Create vertical box with stack. | 1110 // Create vertical box with stack. |
| 1058 var vbox = new WebInspector.VBox(); | 1111 var vbox = new WebInspector.VBox(); |
| 1059 vbox.element.appendChild(this._debugToolbarDrawer); | 1112 vbox.element.appendChild(this._debugToolbarDrawer); |
| 1060 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); | 1113 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); |
| 1061 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this)); | 1114 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this)); |
| 1062 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); | 1115 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); |
| 1063 this._sidebarPaneStack.widget().show(vbox.element); | 1116 this._sidebarPaneStack.widget().show(vbox.element); |
| 1117 this._sidebarPaneStack.widget().element.appendChild(this._debugStatusMes sageElement); | |
| 1064 vbox.element.appendChild(this._debugToolbar.element); | 1118 vbox.element.appendChild(this._debugToolbar.element); |
| 1065 | 1119 |
| 1066 if (this._threadsSidebarPane) | 1120 if (this._threadsSidebarPane) |
| 1067 this._sidebarPaneStack.showView(this._threadsSidebarPane); | 1121 this._sidebarPaneStack.showView(this._threadsSidebarPane); |
| 1068 | 1122 |
| 1069 if (!vertically) | 1123 if (!vertically) |
| 1070 this._sidebarPaneStack.appendView(this._watchSidebarPane); | 1124 this._sidebarPaneStack.appendView(this._watchSidebarPane); |
| 1071 | 1125 |
| 1072 this._sidebarPaneStack.showView(this._callstackPane); | 1126 this._sidebarPaneStack.showView(this._callstackPane); |
| 1073 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints")); | 1127 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints")); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 __proto__: WebInspector.VBox.prototype | 1439 __proto__: WebInspector.VBox.prototype |
| 1386 } | 1440 } |
| 1387 | 1441 |
| 1388 /** | 1442 /** |
| 1389 * @return {boolean} | 1443 * @return {boolean} |
| 1390 */ | 1444 */ |
| 1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() | 1445 WebInspector.SourcesPanel.WrapperView.isShowing = function() |
| 1392 { | 1446 { |
| 1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); | 1447 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); |
| 1394 } | 1448 } |
| OLD | NEW |