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 28 matching lines...) Expand all Loading... |
39 this._handleDrop.bind(this)); | 39 this._handleDrop.bind(this)); |
40 | 40 |
41 this._workspace = Workspace.workspace; | 41 this._workspace = Workspace.workspace; |
42 | 42 |
43 this._togglePauseAction = | 43 this._togglePauseAction = |
44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-pau
se')); | 44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-pau
se')); |
45 this._stepOverAction = | 45 this._stepOverAction = |
46 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-over'
)); | 46 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-over'
)); |
47 this._stepIntoAction = | 47 this._stepIntoAction = |
48 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-into'
)); | 48 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-into'
)); |
| 49 this._stepIntoAsyncAction = |
| 50 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-into-
async')); |
49 this._stepOutAction = /** @type {!UI.Action }*/ (UI.actionRegistry.action('d
ebugger.step-out')); | 51 this._stepOutAction = /** @type {!UI.Action }*/ (UI.actionRegistry.action('d
ebugger.step-out')); |
50 this._toggleBreakpointsActiveAction = | 52 this._toggleBreakpointsActiveAction = |
51 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-bre
akpoints-active')); | 53 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-bre
akpoints-active')); |
52 | 54 |
53 this._debugToolbar = this._createDebugToolbar(); | 55 this._debugToolbar = this._createDebugToolbar(); |
54 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); | 56 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); |
55 this._debuggerPausedMessage = new Sources.DebuggerPausedMessage(); | 57 this._debuggerPausedMessage = new Sources.DebuggerPausedMessage(); |
56 | 58 |
57 const initialDebugSidebarWidth = 225; | 59 const initialDebugSidebarWidth = 225; |
58 this._splitWidget = new UI.SplitWidget(true, true, 'sourcesPanelSplitViewSta
te', initialDebugSidebarWidth); | 60 this._splitWidget = new UI.SplitWidget(true, true, 'sourcesPanelSplitViewSta
te', initialDebugSidebarWidth); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 var enabled = Common.moduleSetting('pauseOnExceptionEnabled').get(); | 467 var enabled = Common.moduleSetting('pauseOnExceptionEnabled').get(); |
466 this._pauseOnExceptionButton.setToggled(enabled); | 468 this._pauseOnExceptionButton.setToggled(enabled); |
467 this._pauseOnExceptionButton.setTitle( | 469 this._pauseOnExceptionButton.setTitle( |
468 Common.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on excep
tions')); | 470 Common.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on excep
tions')); |
469 this._debugToolbarDrawer.classList.toggle('expanded', enabled); | 471 this._debugToolbarDrawer.classList.toggle('expanded', enabled); |
470 } | 472 } |
471 | 473 |
472 _updateDebuggerButtonsAndStatus() { | 474 _updateDebuggerButtonsAndStatus() { |
473 var currentTarget = UI.context.flavor(SDK.Target); | 475 var currentTarget = UI.context.flavor(SDK.Target); |
474 var currentDebuggerModel = SDK.DebuggerModel.fromTarget(currentTarget); | 476 var currentDebuggerModel = SDK.DebuggerModel.fromTarget(currentTarget); |
| 477 var details = currentDebuggerModel ? currentDebuggerModel.debuggerPausedDeta
ils() : null; |
475 if (!currentDebuggerModel) { | 478 if (!currentDebuggerModel) { |
476 this._togglePauseAction.setEnabled(false); | 479 this._togglePauseAction.setEnabled(false); |
477 this._stepOverAction.setEnabled(false); | 480 this._stepOverAction.setEnabled(false); |
478 this._stepIntoAction.setEnabled(false); | 481 this._stepIntoAction.setEnabled(false); |
| 482 this._stepIntoAsyncAction.setEnabled(false); |
479 this._stepOutAction.setEnabled(false); | 483 this._stepOutAction.setEnabled(false); |
480 } else if (this._paused) { | 484 } else if (this._paused) { |
481 this._togglePauseAction.setToggled(true); | 485 this._togglePauseAction.setToggled(true); |
482 this._togglePauseAction.setEnabled(true); | 486 this._togglePauseAction.setEnabled(true); |
483 this._stepOverAction.setEnabled(true); | 487 this._stepOverAction.setEnabled(true); |
484 this._stepIntoAction.setEnabled(true); | 488 this._stepIntoAction.setEnabled(true); |
| 489 this._stepIntoAsyncAction.setEnabled(details && details.auxData && details
.auxData['stepIntoAsyncAvailable']); |
485 this._stepOutAction.setEnabled(true); | 490 this._stepOutAction.setEnabled(true); |
486 } else { | 491 } else { |
487 this._togglePauseAction.setToggled(false); | 492 this._togglePauseAction.setToggled(false); |
488 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing()); | 493 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing()); |
489 this._stepOverAction.setEnabled(false); | 494 this._stepOverAction.setEnabled(false); |
490 this._stepIntoAction.setEnabled(false); | 495 this._stepIntoAction.setEnabled(false); |
| 496 this._stepIntoAsyncAction.setEnabled(false); |
491 this._stepOutAction.setEnabled(false); | 497 this._stepOutAction.setEnabled(false); |
492 } | 498 } |
493 | |
494 var details = currentDebuggerModel ? currentDebuggerModel.debuggerPausedDeta
ils() : null; | |
495 this._debuggerPausedMessage.render(details, Bindings.debuggerWorkspaceBindin
g, Bindings.breakpointManager); | 499 this._debuggerPausedMessage.render(details, Bindings.debuggerWorkspaceBindin
g, Bindings.breakpointManager); |
496 } | 500 } |
497 | 501 |
498 _clearInterface() { | 502 _clearInterface() { |
499 this._sourcesView.clearCurrentExecutionLine(); | 503 this._sourcesView.clearCurrentExecutionLine(); |
500 this._updateDebuggerButtonsAndStatus(); | 504 this._updateDebuggerButtonsAndStatus(); |
501 UI.context.setFlavor(SDK.DebuggerPausedDetails, null); | 505 UI.context.setFlavor(SDK.DebuggerPausedDetails, null); |
502 | 506 |
503 if (this._switchToPausedTargetTimeout) | 507 if (this._switchToPausedTargetTimeout) |
504 clearTimeout(this._switchToPausedTargetTimeout); | 508 clearTimeout(this._switchToPausedTargetTimeout); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 */ | 601 */ |
598 _longResume(event) { | 602 _longResume(event) { |
599 var debuggerModel = this._prepareToResume(); | 603 var debuggerModel = this._prepareToResume(); |
600 if (!debuggerModel) | 604 if (!debuggerModel) |
601 return; | 605 return; |
602 | 606 |
603 debuggerModel.skipAllPausesUntilReloadOrTimeout(500); | 607 debuggerModel.skipAllPausesUntilReloadOrTimeout(500); |
604 debuggerModel.resume(); | 608 debuggerModel.resume(); |
605 } | 609 } |
606 | 610 |
607 /** | |
608 * @return {boolean} | |
609 */ | |
610 _stepOver() { | 611 _stepOver() { |
611 var debuggerModel = this._prepareToResume(); | 612 var debuggerModel = this._prepareToResume(); |
612 if (!debuggerModel) | 613 if (!debuggerModel) |
613 return true; | 614 return; |
| 615 debuggerModel.stepOver(); |
| 616 } |
614 | 617 |
615 debuggerModel.stepOver(); | 618 _stepInto() { |
616 return true; | 619 var debuggerModel = this._prepareToResume(); |
| 620 if (!debuggerModel) |
| 621 return; |
| 622 debuggerModel.stepInto(); |
| 623 } |
| 624 |
| 625 _stepIntoAsync() { |
| 626 var debuggerModel = this._prepareToResume(); |
| 627 if (!debuggerModel) |
| 628 return; |
| 629 var details = debuggerModel.debuggerPausedDetails(); |
| 630 if (!details || !details.auxData || !details.auxData['stepIntoAsyncAvailable
']) |
| 631 return; |
| 632 debuggerModel.stepIntoAsync(); |
| 633 } |
| 634 |
| 635 _stepOut() { |
| 636 var debuggerModel = this._prepareToResume(); |
| 637 if (!debuggerModel) |
| 638 return; |
| 639 debuggerModel.stepOut(); |
617 } | 640 } |
618 | 641 |
619 /** | 642 /** |
620 * @return {boolean} | |
621 */ | |
622 _stepInto() { | |
623 var debuggerModel = this._prepareToResume(); | |
624 if (!debuggerModel) | |
625 return true; | |
626 | |
627 debuggerModel.stepInto(); | |
628 return true; | |
629 } | |
630 | |
631 /** | |
632 * @return {boolean} | |
633 */ | |
634 _stepOut() { | |
635 var debuggerModel = this._prepareToResume(); | |
636 if (!debuggerModel) | |
637 return true; | |
638 | |
639 debuggerModel.stepOut(); | |
640 return true; | |
641 } | |
642 | |
643 /** | |
644 * @param {!Workspace.UILocation} uiLocation | 643 * @param {!Workspace.UILocation} uiLocation |
645 */ | 644 */ |
646 _continueToLocation(uiLocation) { | 645 _continueToLocation(uiLocation) { |
647 var executionContext = UI.context.flavor(SDK.ExecutionContext); | 646 var executionContext = UI.context.flavor(SDK.ExecutionContext); |
648 if (!executionContext) | 647 if (!executionContext) |
649 return; | 648 return; |
650 | 649 |
651 // Always use 0 column. | 650 // Always use 0 column. |
652 var rawLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation( | 651 var rawLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation( |
653 SDK.DebuggerModel.fromTarget(executionContext.target()), uiLocation.uiSo
urceCode, uiLocation.lineNumber, 0); | 652 SDK.DebuggerModel.fromTarget(executionContext.target()), uiLocation.uiSo
urceCode, uiLocation.lineNumber, 0); |
(...skipping 22 matching lines...) Expand all Loading... |
676 _createDebugToolbar() { | 675 _createDebugToolbar() { |
677 var debugToolbar = new UI.Toolbar('scripts-debug-toolbar'); | 676 var debugToolbar = new UI.Toolbar('scripts-debug-toolbar'); |
678 | 677 |
679 var longResumeButton = | 678 var longResumeButton = |
680 new UI.ToolbarButton(Common.UIString('Resume with all pauses blocked for
500 ms'), 'largeicon-play'); | 679 new UI.ToolbarButton(Common.UIString('Resume with all pauses blocked for
500 ms'), 'largeicon-play'); |
681 longResumeButton.addEventListener(UI.ToolbarButton.Events.Click, this._longR
esume, this); | 680 longResumeButton.addEventListener(UI.ToolbarButton.Events.Click, this._longR
esume, this); |
682 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._togglePau
seAction, [longResumeButton], [])); | 681 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._togglePau
seAction, [longResumeButton], [])); |
683 | 682 |
684 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOverA
ction)); | 683 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOverA
ction)); |
685 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepIntoA
ction)); | 684 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepIntoA
ction)); |
| 685 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepIntoA
syncAction)); |
686 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOutAc
tion)); | 686 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOutAc
tion)); |
687 debugToolbar.appendSeparator(); | 687 debugToolbar.appendSeparator(); |
688 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._toggleBre
akpointsActiveAction)); | 688 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._toggleBre
akpointsActiveAction)); |
689 | 689 |
690 this._pauseOnExceptionButton = new UI.ToolbarToggle('', 'largeicon-pause-on-
exceptions'); | 690 this._pauseOnExceptionButton = new UI.ToolbarToggle('', 'largeicon-pause-on-
exceptions'); |
691 this._pauseOnExceptionButton.addEventListener(UI.ToolbarButton.Events.Click,
this._togglePauseOnExceptions, this); | 691 this._pauseOnExceptionButton.addEventListener(UI.ToolbarButton.Events.Click,
this._togglePauseOnExceptions, this); |
692 debugToolbar.appendToolbarItem(this._pauseOnExceptionButton); | 692 debugToolbar.appendToolbarItem(this._pauseOnExceptionButton); |
693 | 693 |
694 debugToolbar.appendSeparator(); | 694 debugToolbar.appendSeparator(); |
695 debugToolbar.appendToolbarItem(new UI.ToolbarSettingCheckbox( | 695 debugToolbar.appendToolbarItem(new UI.ToolbarSettingCheckbox( |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 */ | 1247 */ |
1248 handleAction(context, actionId) { | 1248 handleAction(context, actionId) { |
1249 var panel = Sources.SourcesPanel.instance(); | 1249 var panel = Sources.SourcesPanel.instance(); |
1250 switch (actionId) { | 1250 switch (actionId) { |
1251 case 'debugger.step-over': | 1251 case 'debugger.step-over': |
1252 panel._stepOver(); | 1252 panel._stepOver(); |
1253 return true; | 1253 return true; |
1254 case 'debugger.step-into': | 1254 case 'debugger.step-into': |
1255 panel._stepInto(); | 1255 panel._stepInto(); |
1256 return true; | 1256 return true; |
| 1257 case 'debugger.step-into-async': |
| 1258 panel._stepIntoAsync(); |
| 1259 return true; |
1257 case 'debugger.step-out': | 1260 case 'debugger.step-out': |
1258 panel._stepOut(); | 1261 panel._stepOut(); |
1259 return true; | 1262 return true; |
1260 case 'debugger.run-snippet': | 1263 case 'debugger.run-snippet': |
1261 panel._runSnippet(); | 1264 panel._runSnippet(); |
1262 return true; | 1265 return true; |
1263 case 'debugger.toggle-breakpoints-active': | 1266 case 'debugger.toggle-breakpoints-active': |
1264 panel._toggleBreakpointsActive(); | 1267 panel._toggleBreakpointsActive(); |
1265 return true; | 1268 return true; |
1266 case 'debugger.evaluate-selection': | 1269 case 'debugger.evaluate-selection': |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 */ | 1315 */ |
1313 willHide() { | 1316 willHide() { |
1314 UI.inspectorView.setDrawerMinimized(false); | 1317 UI.inspectorView.setDrawerMinimized(false); |
1315 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); | 1318 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); |
1316 } | 1319 } |
1317 | 1320 |
1318 _showViewInWrapper() { | 1321 _showViewInWrapper() { |
1319 this._view.show(this.element); | 1322 this._view.show(this.element); |
1320 } | 1323 } |
1321 }; | 1324 }; |
OLD | NEW |