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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 return; | 207 return; |
208 | 208 |
209 event.returnValue = WebInspector.UIString("DevTools have unsaved changes that will be permanently lost."); | 209 event.returnValue = WebInspector.UIString("DevTools have unsaved changes that will be permanently lost."); |
210 WebInspector.showPanel("sources"); | 210 WebInspector.showPanel("sources"); |
211 for (var i = 0; i < unsavedSourceCodes.length; ++i) | 211 for (var i = 0; i < unsavedSourceCodes.length; ++i) |
212 WebInspector.panels.sources.showUISourceCode(unsavedSourceCodes[i]); | 212 WebInspector.panels.sources.showUISourceCode(unsavedSourceCodes[i]); |
213 } | 213 } |
214 window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true) ; | 214 window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true) ; |
215 } | 215 } |
216 | 216 |
217 /** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */ | |
218 WebInspector.SourcesPanel.PauseOnExceptionsStates = [ | |
aandrey
2013/12/23 09:04:10
We will need to keep it in sync with the WebInspec
eustas
2013/12/26 07:35:37
Order shouldn't change, even if enum changes - thi
| |
219 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions, | |
220 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions, | |
221 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions | |
222 ]; | |
223 | |
217 WebInspector.SourcesPanel.prototype = { | 224 WebInspector.SourcesPanel.prototype = { |
218 defaultFocusedElement: function() | 225 defaultFocusedElement: function() |
219 { | 226 { |
220 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement(); | 227 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement(); |
221 }, | 228 }, |
222 | 229 |
223 get paused() | 230 get paused() |
224 { | 231 { |
225 return this._paused; | 232 return this._paused; |
226 }, | 233 }, |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
713 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource)) | 720 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource)) |
714 sourceFrame.focus(); | 721 sourceFrame.focus(); |
715 }, | 722 }, |
716 | 723 |
717 _itemSearchStarted: function(event) | 724 _itemSearchStarted: function(event) |
718 { | 725 { |
719 var searchText = /** @type {string} */ (event.data); | 726 var searchText = /** @type {string} */ (event.data); |
720 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement, searchText); | 727 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement, searchText); |
721 }, | 728 }, |
722 | 729 |
730 _createPauseOnExceptionOptions: function() | |
aandrey
2013/12/23 09:04:10
@return jsdoc missing
eustas
2013/12/26 07:35:37
Done.
| |
731 { | |
732 var excludedOption = this._pauseOnExceptionButtons[0].state; | |
733 var options = this._pauseOnExceptionButtons.slice(1); | |
734 var pauseStates = WebInspector.SourcesPanel.PauseOnExceptionsStates.slic e(0); | |
aandrey
2013/12/23 09:04:10
var pauseStates = WebInspector.DebuggerModel.Pause
| |
735 var j = 0; | |
736 for (var i = 0; i < pauseStates.length; ++i) { | |
737 if (pauseStates[i] !== excludedOption) { | |
738 options[j].state = pauseStates[i]; | |
739 options[j].title = this._pauseOnExceptionStateTitle(pauseStates[ i]); | |
740 j++; | |
741 } | |
742 } | |
743 return options; | |
744 }, | |
745 | |
723 _pauseOnExceptionStateChanged: function() | 746 _pauseOnExceptionStateChanged: function() |
724 { | 747 { |
725 var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionState String.get(); | 748 var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionState String.get(); |
726 switch (pauseOnExceptionsState) { | 749 this._pauseOnExceptionButtons[0].title = this._pauseOnExceptionStateTitl e(pauseOnExceptionsState); |
750 this._pauseOnExceptionButtons[0].state = pauseOnExceptionsState; | |
751 }, | |
752 | |
753 /** | |
754 * @param {!WebInspector.DebuggerModel.PauseOnExceptionsState} state | |
aandrey
2013/12/23 09:04:10
@return missing
eustas
2013/12/26 07:35:37
Done.
| |
755 */ | |
756 _pauseOnExceptionStateTitle: function(state) | |
757 { | |
758 switch (state) { | |
727 case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExcept ions: | 759 case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExcept ions: |
728 this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pa use on exceptions.\nClick to Pause on all exceptions."); | 760 return WebInspector.UIString("Don't pause on exceptions."); |
729 break; | |
730 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExcepti ons: | 761 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExcepti ons: |
731 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); | 762 return WebInspector.UIString("Pause on all exceptions."); |
732 break; | |
733 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtEx ceptions: | 763 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtEx ceptions: |
734 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); | 764 return WebInspector.UIString("Pause on uncaught exceptions."); |
735 break; | |
736 } | 765 } |
737 this._pauseOnExceptionButton.state = pauseOnExceptionsState; | 766 throw("Unexpected PauseOnExceptionsState: " + state); |
aandrey
2013/12/23 09:04:10
2 spaces -> 1
eustas
2013/12/26 07:35:37
Done.
| |
738 }, | 767 }, |
739 | 768 |
740 _updateDebuggerButtons: function() | 769 _updateDebuggerButtons: function() |
741 { | 770 { |
742 if (this._paused) { | 771 if (this._paused) { |
743 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re sume script execution (%s).")) | 772 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re sume script execution (%s).")) |
744 this._pauseButton.state = true; | 773 this._pauseButton.state = true; |
745 this._pauseButton.setLongClickOptionsEnabled((function() { return [ this._longResumeButton ] }).bind(this)); | 774 this._pauseButton.setLongClickOptionsEnabled((function() { return [ this._longResumeButton ] }).bind(this)); |
746 | 775 |
747 this._pauseButton.setEnabled(true); | 776 this._pauseButton.setEnabled(true); |
(...skipping 18 matching lines...) Expand all Loading... | |
766 this.sidebarPanes.scopechain.update(null); | 795 this.sidebarPanes.scopechain.update(null); |
767 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | 796 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); |
768 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); | 797 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); |
769 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); | 798 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); |
770 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); | 799 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); |
771 | 800 |
772 this._clearCurrentExecutionLine(); | 801 this._clearCurrentExecutionLine(); |
773 this._updateDebuggerButtons(); | 802 this._updateDebuggerButtons(); |
774 }, | 803 }, |
775 | 804 |
776 _togglePauseOnExceptions: function() | 805 /** |
806 * @param {!WebInspector.Event} e | |
807 */ | |
808 _togglePauseOnExceptions: function(e) | |
777 { | 809 { |
778 var nextStateMap = {}; | 810 var state = e.target.state; |
aandrey
2013/12/23 09:04:10
@type cast?
eustas
2013/12/26 07:35:37
Done.
| |
811 var toggle = !e.data; | |
779 var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState; | 812 var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState; |
780 nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExce ptions; | 813 if (toggle) { |
781 nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaught Exceptions; | 814 if (state !== stateEnum.DontPauseOnExceptions) |
782 nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseO nExceptions; | 815 state = stateEnum.DontPauseOnExceptions |
783 WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this. _pauseOnExceptionButton.state]); | 816 else |
817 state = WebInspector.settings.lastPauseOnExceptionState.get(); | |
818 } | |
819 if (state !== stateEnum.DontPauseOnExceptions) | |
820 WebInspector.settings.lastPauseOnExceptionState.set(state); | |
821 WebInspector.settings.pauseOnExceptionStateString.set(state); | |
784 }, | 822 }, |
785 | 823 |
786 /** | 824 /** |
787 * @return {boolean} | 825 * @return {boolean} |
788 */ | 826 */ |
789 _runSnippet: function() | 827 _runSnippet: function() |
790 { | 828 { |
791 if (this._currentUISourceCode.project().type() !== WebInspector.projectT ypes.Snippets) | 829 if (this._currentUISourceCode.project().type() !== WebInspector.projectT ypes.Snippets) |
792 return false; | 830 return false; |
793 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._currentUISou rceCode); | 831 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._currentUISou rceCode); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st ep-out", title, handler, WebInspector.SourcesPanelDescriptor.ShortcutKeys.StepOu t); | 1048 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st ep-out", title, handler, WebInspector.SourcesPanelDescriptor.ShortcutKeys.StepOu t); |
1011 debugToolbar.appendChild(this._stepOutButton.element); | 1049 debugToolbar.appendChild(this._stepOutButton.element); |
1012 | 1050 |
1013 // Toggle Breakpoints | 1051 // Toggle Breakpoints |
1014 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 1052 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
1015 this._toggleBreakpointsButton.toggled = false; | 1053 this._toggleBreakpointsButton.toggled = false; |
1016 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); | 1054 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); |
1017 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | 1055 debugToolbar.appendChild(this._toggleBreakpointsButton.element); |
1018 | 1056 |
1019 // Pause on Exception | 1057 // Pause on Exception |
1020 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr ipts-pause-on-exceptions-status-bar-item", 3); | 1058 var pauseStates = WebInspector.SourcesPanel.PauseOnExceptionsStates; |
1021 this._pauseOnExceptionButton.addEventListener("click", this._togglePause OnExceptions, this); | 1059 this._pauseOnExceptionButtons = []; |
1022 debugToolbar.appendChild(this._pauseOnExceptionButton.element); | 1060 for (var i = 0; i < pauseStates.length; ++i) { |
1061 var button = new WebInspector.StatusBarButton("", "scripts-pause-on- exceptions-status-bar-item", 3); | |
1062 button.addEventListener("click", this._togglePauseOnExceptions, this ); | |
1063 this._pauseOnExceptionButtons.push(button); | |
1064 } | |
1065 this._pauseOnExceptionButtons[0].setLongClickOptionsEnabled(this._create PauseOnExceptionOptions.bind(this)); | |
1066 debugToolbar.appendChild(this._pauseOnExceptionButtons[0].element); | |
1023 | 1067 |
1024 return debugToolbar; | 1068 return debugToolbar; |
1025 }, | 1069 }, |
1026 | 1070 |
1027 /** | 1071 /** |
1028 * @param {!WebInspector.StatusBarButton} button | 1072 * @param {!WebInspector.StatusBarButton} button |
1029 * @param {string} buttonTitle | 1073 * @param {string} buttonTitle |
1030 */ | 1074 */ |
1031 _updateButtonTitle: function(button, buttonTitle) | 1075 _updateButtonTitle: function(button, buttonTitle) |
1032 { | 1076 { |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1721 WebInspector.DrawerEditorView = function() | 1765 WebInspector.DrawerEditorView = function() |
1722 { | 1766 { |
1723 WebInspector.View.call(this); | 1767 WebInspector.View.call(this); |
1724 this.element.id = "drawer-editor-view"; | 1768 this.element.id = "drawer-editor-view"; |
1725 this.element.classList.add("vbox"); | 1769 this.element.classList.add("vbox"); |
1726 } | 1770 } |
1727 | 1771 |
1728 WebInspector.DrawerEditorView.prototype = { | 1772 WebInspector.DrawerEditorView.prototype = { |
1729 __proto__: WebInspector.View.prototype | 1773 __proto__: WebInspector.View.prototype |
1730 } | 1774 } |
OLD | NEW |