| 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 = [ | |
| 219 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions, | |
| 220 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions, | |
| 221 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions | |
| 222 ]; | |
| 223 | |
| 224 WebInspector.SourcesPanel.prototype = { | 217 WebInspector.SourcesPanel.prototype = { |
| 225 /** | 218 /** |
| 226 * @return {!Element} | 219 * @return {!Element} |
| 227 */ | 220 */ |
| 228 defaultFocusedElement: function() | 221 defaultFocusedElement: function() |
| 229 { | 222 { |
| 230 return this._editorContainer.view.defaultFocusedElement() || this._navig
ator.view.defaultFocusedElement(); | 223 return this._editorContainer.view.defaultFocusedElement() || this._navig
ator.view.defaultFocusedElement(); |
| 231 }, | 224 }, |
| 232 | 225 |
| 233 get paused() | 226 get paused() |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev
ent.data.focusSource)) | 716 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev
ent.data.focusSource)) |
| 724 sourceFrame.focus(); | 717 sourceFrame.focus(); |
| 725 }, | 718 }, |
| 726 | 719 |
| 727 _itemSearchStarted: function(event) | 720 _itemSearchStarted: function(event) |
| 728 { | 721 { |
| 729 var searchText = /** @type {string} */ (event.data); | 722 var searchText = /** @type {string} */ (event.data); |
| 730 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, searchText); | 723 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, searchText); |
| 731 }, | 724 }, |
| 732 | 725 |
| 733 /** | |
| 734 * @return {!Array.<!WebInspector.StatusBarButton>} | |
| 735 */ | |
| 736 _createPauseOnExceptionOptions: function() | |
| 737 { | |
| 738 this._pauseOnExceptionButton.title = this._pauseOnExceptionStateTitle(th
is._pauseOnExceptionButton.state); | |
| 739 var excludedOption = this._pauseOnExceptionButton.state; | |
| 740 var pauseStates = WebInspector.SourcesPanel.PauseOnExceptionsStates.slic
e(0); | |
| 741 var options = []; | |
| 742 for (var i = 0; i < pauseStates.length; ++i) { | |
| 743 if (pauseStates[i] === excludedOption) | |
| 744 continue; | |
| 745 var button = new WebInspector.StatusBarButton("", "scripts-pause-on-
exceptions-status-bar-item", 3); | |
| 746 button.addEventListener("click", this._togglePauseOnExceptions, this
); | |
| 747 button.state = pauseStates[i]; | |
| 748 button.title = this._pauseOnExceptionStateTitle(pauseStates[i]); | |
| 749 options.push(button); | |
| 750 } | |
| 751 return options; | |
| 752 }, | |
| 753 | |
| 754 _pauseOnExceptionStateChanged: function() | 726 _pauseOnExceptionStateChanged: function() |
| 755 { | 727 { |
| 756 var state = WebInspector.settings.pauseOnExceptionStateString.get(); | 728 var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionState
String.get(); |
| 757 var nextState; | 729 switch (pauseOnExceptionsState) { |
| 758 if (state === WebInspector.DebuggerModel.PauseOnExceptionsState.DontPaus
eOnExceptions) | 730 case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExcept
ions: |
| 759 nextState = WebInspector.settings.lastPauseOnExceptionState.get(); | 731 this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pa
use on exceptions.\nClick to Pause on all exceptions."); |
| 760 else | 732 break; |
| 761 nextState = WebInspector.DebuggerModel.PauseOnExceptionsState.DontPa
useOnExceptions; | 733 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExcepti
ons: |
| 762 this._pauseOnExceptionButton.title = this._pauseOnExceptionStateTitle(st
ate, nextState); | 734 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on
all exceptions.\nClick to Pause on uncaught exceptions."); |
| 763 this._pauseOnExceptionButton.state = state; | 735 break; |
| 764 }, | 736 case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtEx
ceptions: |
| 765 | 737 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on
uncaught exceptions.\nClick to Not pause on exceptions."); |
| 766 /** | 738 break; |
| 767 * @param {!WebInspector.DebuggerModel.PauseOnExceptionsState} state | |
| 768 * @param {!WebInspector.DebuggerModel.PauseOnExceptionsState=} nextState | |
| 769 * @return {string} | |
| 770 */ | |
| 771 _pauseOnExceptionStateTitle: function(state, nextState) | |
| 772 { | |
| 773 var states = WebInspector.DebuggerModel.PauseOnExceptionsState; | |
| 774 var stateDescription; | |
| 775 if (state === states.DontPauseOnExceptions) { | |
| 776 stateDescription = WebInspector.UIString("Don't pause on exceptions.
"); | |
| 777 } else if (state === states.PauseOnAllExceptions) { | |
| 778 stateDescription = WebInspector.UIString("Pause on exceptions, inclu
ding caught exceptions."); | |
| 779 } else if (state === states.PauseOnUncaughtExceptions) { | |
| 780 stateDescription = WebInspector.UIString("Pause on exceptions."); | |
| 781 } else { | |
| 782 throw "Unexpected state: " + state; | |
| 783 } | 739 } |
| 784 var nextStateDescription; | 740 this._pauseOnExceptionButton.state = pauseOnExceptionsState; |
| 785 if (nextState === states.DontPauseOnExceptions) { | |
| 786 nextStateDescription = WebInspector.UIString("Click to Not pause on
exceptions."); | |
| 787 } else if (nextState === states.PauseOnAllExceptions) { | |
| 788 nextStateDescription = WebInspector.UIString("Click to Pause on exce
ptions, including caught exceptions."); | |
| 789 } else if (nextState === states.PauseOnUncaughtExceptions) { | |
| 790 nextStateDescription = WebInspector.UIString("Click to Pause on exce
ptions."); | |
| 791 } | |
| 792 return nextState ? String.sprintf("%s\n%s", stateDescription, nextStateD
escription) : stateDescription; | |
| 793 }, | 741 }, |
| 794 | 742 |
| 795 _updateDebuggerButtons: function() | 743 _updateDebuggerButtons: function() |
| 796 { | 744 { |
| 797 if (this._paused) { | 745 if (this._paused) { |
| 798 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) | 746 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) |
| 799 this._pauseButton.state = true; | 747 this._pauseButton.state = true; |
| 800 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); | 748 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); |
| 801 | 749 |
| 802 this._pauseButton.setEnabled(true); | 750 this._pauseButton.setEnabled(true); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 821 this.sidebarPanes.scopechain.update(null); | 769 this.sidebarPanes.scopechain.update(null); |
| 822 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | 770 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); |
| 823 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); | 771 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); |
| 824 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); | 772 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); |
| 825 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); | 773 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); |
| 826 | 774 |
| 827 this._clearCurrentExecutionLine(); | 775 this._clearCurrentExecutionLine(); |
| 828 this._updateDebuggerButtons(); | 776 this._updateDebuggerButtons(); |
| 829 }, | 777 }, |
| 830 | 778 |
| 831 /** | 779 _togglePauseOnExceptions: function() |
| 832 * @param {!WebInspector.Event} e | |
| 833 */ | |
| 834 _togglePauseOnExceptions: function(e) | |
| 835 { | 780 { |
| 836 var target = /** @type {!WebInspector.StatusBarButton} */ (e.target); | 781 var nextStateMap = {}; |
| 837 var state = /** @type {!WebInspector.DebuggerModel.PauseOnExceptionsStat
e} */ (target.state); | |
| 838 var toggle = !e.data; | |
| 839 var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState; | 782 var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState; |
| 840 if (toggle) { | 783 nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExce
ptions; |
| 841 if (state !== stateEnum.DontPauseOnExceptions) | 784 nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaught
Exceptions; |
| 842 state = stateEnum.DontPauseOnExceptions | 785 nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseO
nExceptions; |
| 843 else | 786 WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this.
_pauseOnExceptionButton.state]); |
| 844 state = WebInspector.settings.lastPauseOnExceptionState.get(); | |
| 845 } | |
| 846 if (state !== stateEnum.DontPauseOnExceptions) | |
| 847 WebInspector.settings.lastPauseOnExceptionState.set(state); | |
| 848 WebInspector.settings.pauseOnExceptionStateString.set(state); | |
| 849 }, | 787 }, |
| 850 | 788 |
| 851 /** | 789 /** |
| 852 * @return {boolean} | 790 * @return {boolean} |
| 853 */ | 791 */ |
| 854 _runSnippet: function() | 792 _runSnippet: function() |
| 855 { | 793 { |
| 856 if (this._currentUISourceCode.project().type() !== WebInspector.projectT
ypes.Snippets) | 794 if (this._currentUISourceCode.project().type() !== WebInspector.projectT
ypes.Snippets) |
| 857 return false; | 795 return false; |
| 858 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._currentUISou
rceCode); | 796 WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._currentUISou
rceCode); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 | 1015 |
| 1078 // Toggle Breakpoints | 1016 // Toggle Breakpoints |
| 1079 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 1017 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
| 1080 this._toggleBreakpointsButton.toggled = false; | 1018 this._toggleBreakpointsButton.toggled = false; |
| 1081 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | 1019 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); |
| 1082 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | 1020 debugToolbar.appendChild(this._toggleBreakpointsButton.element); |
| 1083 | 1021 |
| 1084 // Pause on Exception | 1022 // Pause on Exception |
| 1085 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item", 3); | 1023 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item", 3); |
| 1086 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); | 1024 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); |
| 1087 this._pauseOnExceptionButton.setLongClickOptionsEnabled(this._createPaus
eOnExceptionOptions.bind(this)); | |
| 1088 debugToolbar.appendChild(this._pauseOnExceptionButton.element); | 1025 debugToolbar.appendChild(this._pauseOnExceptionButton.element); |
| 1089 | 1026 |
| 1090 return debugToolbar; | 1027 return debugToolbar; |
| 1091 }, | 1028 }, |
| 1092 | 1029 |
| 1093 /** | 1030 /** |
| 1094 * @param {!WebInspector.StatusBarButton} button | 1031 * @param {!WebInspector.StatusBarButton} button |
| 1095 * @param {string} buttonTitle | 1032 * @param {string} buttonTitle |
| 1096 */ | 1033 */ |
| 1097 _updateButtonTitle: function(button, buttonTitle) | 1034 _updateButtonTitle: function(button, buttonTitle) |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 WebInspector.DrawerEditorView = function() | 1726 WebInspector.DrawerEditorView = function() |
| 1790 { | 1727 { |
| 1791 WebInspector.View.call(this); | 1728 WebInspector.View.call(this); |
| 1792 this.element.id = "drawer-editor-view"; | 1729 this.element.id = "drawer-editor-view"; |
| 1793 this.element.classList.add("vbox"); | 1730 this.element.classList.add("vbox"); |
| 1794 } | 1731 } |
| 1795 | 1732 |
| 1796 WebInspector.DrawerEditorView.prototype = { | 1733 WebInspector.DrawerEditorView.prototype = { |
| 1797 __proto__: WebInspector.View.prototype | 1734 __proto__: WebInspector.View.prototype |
| 1798 } | 1735 } |
| OLD | NEW |