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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 /** | 188 /** |
189 * @param {?SDK.Target} target | 189 * @param {?SDK.Target} target |
190 */ | 190 */ |
191 _setTarget(target) { | 191 _setTarget(target) { |
192 if (!target) | 192 if (!target) |
193 return; | 193 return; |
194 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 194 var debuggerModel = target.model(SDK.DebuggerModel); |
195 if (!debuggerModel) | 195 if (!debuggerModel) |
196 return; | 196 return; |
197 | 197 |
198 if (debuggerModel.isPaused()) { | 198 if (debuggerModel.isPaused()) { |
199 this._showDebuggerPausedDetails( | 199 this._showDebuggerPausedDetails( |
200 /** @type {!SDK.DebuggerPausedDetails} */ (debuggerModel.debuggerPause
dDetails())); | 200 /** @type {!SDK.DebuggerPausedDetails} */ (debuggerModel.debuggerPause
dDetails())); |
201 } else { | 201 } else { |
202 this._paused = false; | 202 this._paused = false; |
203 this._clearInterface(); | 203 this._clearInterface(); |
204 this._toggleDebuggerSidebarButton.setEnabled(true); | 204 this._toggleDebuggerSidebarButton.setEnabled(true); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 _pauseOnExceptionEnabledChanged() { | 463 _pauseOnExceptionEnabledChanged() { |
464 var enabled = Common.moduleSetting('pauseOnExceptionEnabled').get(); | 464 var enabled = Common.moduleSetting('pauseOnExceptionEnabled').get(); |
465 this._pauseOnExceptionButton.setToggled(enabled); | 465 this._pauseOnExceptionButton.setToggled(enabled); |
466 this._pauseOnExceptionButton.setTitle( | 466 this._pauseOnExceptionButton.setTitle( |
467 Common.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on excep
tions')); | 467 Common.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on excep
tions')); |
468 this._debugToolbarDrawer.classList.toggle('expanded', enabled); | 468 this._debugToolbarDrawer.classList.toggle('expanded', enabled); |
469 } | 469 } |
470 | 470 |
471 _updateDebuggerButtonsAndStatus() { | 471 _updateDebuggerButtonsAndStatus() { |
472 var currentTarget = UI.context.flavor(SDK.Target); | 472 var currentTarget = UI.context.flavor(SDK.Target); |
473 var currentDebuggerModel = SDK.DebuggerModel.fromTarget(currentTarget); | 473 var currentDebuggerModel = currentTarget ? currentTarget.model(SDK.DebuggerM
odel) : null; |
474 if (!currentDebuggerModel) { | 474 if (!currentDebuggerModel) { |
475 this._togglePauseAction.setEnabled(false); | 475 this._togglePauseAction.setEnabled(false); |
476 this._stepOverAction.setEnabled(false); | 476 this._stepOverAction.setEnabled(false); |
477 this._stepIntoAction.setEnabled(false); | 477 this._stepIntoAction.setEnabled(false); |
478 this._stepOutAction.setEnabled(false); | 478 this._stepOutAction.setEnabled(false); |
479 } else if (this._paused) { | 479 } else if (this._paused) { |
480 this._togglePauseAction.setToggled(true); | 480 this._togglePauseAction.setToggled(true); |
481 this._togglePauseAction.setEnabled(true); | 481 this._togglePauseAction.setEnabled(true); |
482 this._stepOverAction.setEnabled(true); | 482 this._stepOverAction.setEnabled(true); |
483 this._stepIntoAction.setEnabled(true); | 483 this._stepIntoAction.setEnabled(true); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 this._revealInNavigator(uiSourceCode, true); | 554 this._revealInNavigator(uiSourceCode, true); |
555 } | 555 } |
556 | 556 |
557 /** | 557 /** |
558 * @return {boolean} | 558 * @return {boolean} |
559 */ | 559 */ |
560 _togglePause() { | 560 _togglePause() { |
561 var target = UI.context.flavor(SDK.Target); | 561 var target = UI.context.flavor(SDK.Target); |
562 if (!target) | 562 if (!target) |
563 return true; | 563 return true; |
564 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 564 var debuggerModel = target.model(SDK.DebuggerModel); |
565 if (!debuggerModel) | 565 if (!debuggerModel) |
566 return true; | 566 return true; |
567 | 567 |
568 if (this._paused) { | 568 if (this._paused) { |
569 this._paused = false; | 569 this._paused = false; |
570 debuggerModel.resume(); | 570 debuggerModel.resume(); |
571 } else { | 571 } else { |
572 // Make sure pauses didn't stick skipped. | 572 // Make sure pauses didn't stick skipped. |
573 debuggerModel.pause(); | 573 debuggerModel.pause(); |
574 } | 574 } |
575 | 575 |
576 this._clearInterface(); | 576 this._clearInterface(); |
577 return true; | 577 return true; |
578 } | 578 } |
579 | 579 |
580 /** | 580 /** |
581 * @return {?SDK.DebuggerModel} | 581 * @return {?SDK.DebuggerModel} |
582 */ | 582 */ |
583 _prepareToResume() { | 583 _prepareToResume() { |
584 if (!this._paused) | 584 if (!this._paused) |
585 return null; | 585 return null; |
586 | 586 |
587 this._paused = false; | 587 this._paused = false; |
588 | 588 |
589 this._clearInterface(); | 589 this._clearInterface(); |
590 var target = UI.context.flavor(SDK.Target); | 590 var target = UI.context.flavor(SDK.Target); |
591 return target ? SDK.DebuggerModel.fromTarget(target) : null; | 591 return target ? target.model(SDK.DebuggerModel) : null; |
592 } | 592 } |
593 | 593 |
594 /** | 594 /** |
595 * @param {!Common.Event} event | 595 * @param {!Common.Event} event |
596 */ | 596 */ |
597 _longResume(event) { | 597 _longResume(event) { |
598 var debuggerModel = this._prepareToResume(); | 598 var debuggerModel = this._prepareToResume(); |
599 if (!debuggerModel) | 599 if (!debuggerModel) |
600 return; | 600 return; |
601 | 601 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 /** | 642 /** |
643 * @param {!Workspace.UILocation} uiLocation | 643 * @param {!Workspace.UILocation} uiLocation |
644 */ | 644 */ |
645 _continueToLocation(uiLocation) { | 645 _continueToLocation(uiLocation) { |
646 var executionContext = UI.context.flavor(SDK.ExecutionContext); | 646 var executionContext = UI.context.flavor(SDK.ExecutionContext); |
647 if (!executionContext) | 647 if (!executionContext) |
648 return; | 648 return; |
649 | 649 |
650 // Always use 0 column. | 650 // Always use 0 column. |
651 var rawLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation( | 651 var rawLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation( |
652 SDK.DebuggerModel.fromTarget(executionContext.target()), uiLocation.uiSo
urceCode, uiLocation.lineNumber, 0); | 652 executionContext.debuggerModel, uiLocation.uiSourceCode, uiLocation.line
Number, 0); |
653 if (!rawLocation) | 653 if (!rawLocation) |
654 return; | 654 return; |
655 | 655 |
656 if (!this._prepareToResume()) | 656 if (!this._prepareToResume()) |
657 return; | 657 return; |
658 | 658 |
659 rawLocation.continueToLocation(); | 659 rawLocation.continueToLocation(); |
660 } | 660 } |
661 | 661 |
662 _toggleBreakpointsActive() { | 662 _toggleBreakpointsActive() { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 */ | 854 */ |
855 appendUILocationItems(contextMenu, object) { | 855 appendUILocationItems(contextMenu, object) { |
856 if (!(object instanceof Workspace.UILocation)) | 856 if (!(object instanceof Workspace.UILocation)) |
857 return; | 857 return; |
858 var uiLocation = /** @type {!Workspace.UILocation} */ (object); | 858 var uiLocation = /** @type {!Workspace.UILocation} */ (object); |
859 var uiSourceCode = uiLocation.uiSourceCode; | 859 var uiSourceCode = uiLocation.uiSourceCode; |
860 | 860 |
861 var contentType = uiSourceCode.contentType(); | 861 var contentType = uiSourceCode.contentType(); |
862 if (contentType.hasScripts()) { | 862 if (contentType.hasScripts()) { |
863 var target = UI.context.flavor(SDK.Target); | 863 var target = UI.context.flavor(SDK.Target); |
864 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 864 var debuggerModel = target ? target.model(SDK.DebuggerModel) : null; |
865 if (debuggerModel && debuggerModel.isPaused()) { | 865 if (debuggerModel && debuggerModel.isPaused()) { |
866 contextMenu.appendItem( | 866 contextMenu.appendItem( |
867 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc
ation.bind(this, uiLocation)); | 867 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc
ation.bind(this, uiLocation)); |
868 } | 868 } |
869 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc
eCode); | 869 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc
eCode); |
870 } | 870 } |
871 } | 871 } |
872 | 872 |
873 /** | 873 /** |
874 * @param {!Workspace.UISourceCode} uiSourceCode | 874 * @param {!Workspace.UISourceCode} uiSourceCode |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 * @param {!SDK.RemoteObject} global | 950 * @param {!SDK.RemoteObject} global |
951 * @param {?SDK.RemoteObject} result | 951 * @param {?SDK.RemoteObject} result |
952 * @param {boolean=} wasThrown | 952 * @param {boolean=} wasThrown |
953 */ | 953 */ |
954 function didSave(global, result, wasThrown) { | 954 function didSave(global, result, wasThrown) { |
955 global.release(); | 955 global.release(); |
956 if (wasThrown || !result || result.type !== 'string') { | 956 if (wasThrown || !result || result.type !== 'string') { |
957 failedToSave(result); | 957 failedToSave(result); |
958 } else { | 958 } else { |
959 ConsoleModel.consoleModel.evaluateCommandInConsole( | 959 ConsoleModel.consoleModel.evaluateCommandInConsole( |
960 /** @type {!SDK.ExecutionContext} */ (currentExecutionContext), resu
lt.value, | 960 /** @type {!SDK.ExecutionContext} */ (currentExecutionContext), /**
@type {string} */ (result.value), |
961 /* useCommandLineAPI */ false); | 961 /* useCommandLineAPI */ false); |
962 } | 962 } |
963 } | 963 } |
964 | 964 |
965 /** | 965 /** |
966 * @param {?SDK.RemoteObject} result | 966 * @param {?SDK.RemoteObject} result |
967 */ | 967 */ |
968 function failedToSave(result) { | 968 function failedToSave(result) { |
969 var message = Common.UIString('Failed to save to temp variable.'); | 969 var message = Common.UIString('Failed to save to temp variable.'); |
970 if (result) { | 970 if (result) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 */ | 1311 */ |
1312 willHide() { | 1312 willHide() { |
1313 UI.inspectorView.setDrawerMinimized(false); | 1313 UI.inspectorView.setDrawerMinimized(false); |
1314 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); | 1314 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); |
1315 } | 1315 } |
1316 | 1316 |
1317 _showViewInWrapper() { | 1317 _showViewInWrapper() { |
1318 this._view.show(this.element); | 1318 this._view.show(this.element); |
1319 } | 1319 } |
1320 }; | 1320 }; |
OLD | NEW |