Changeset 53696 in webkit
- Timestamp:
- Jan 22, 2010 4:52:52 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53695 r53696 1 2010-01-22 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Caught exceptions still pause the debugger. 6 <https://bugs.webkit.org/show_bug.cgi?id=28622>. 7 8 Turn the pauseOnExceptions variable from a bool to an int, because we now have 9 3 states, in an enum: DontPauseOnExceptions, PauseOnAllExceptions, and 10 PauseOnUncaughtExceptions. The status button for pausing on exceptions is now 11 a tri-state button, which cycles from Don't pause (no background) to Pause on All 12 (blue background) to Pause on Uncaught (purple background). 13 14 Also added the ability for a status button to have more than 2 states, and added 15 style rules for a CSS three state button. 16 17 Added a manual test, manual-tests/debugger-caught-uncaught-exceptions.html, that 18 generates caught and uncaught exceptions. 19 20 * English.lproj/localizedStrings.js: Added updated Action / Click to Action text. 21 * inspector/InspectorBackend.cpp: 22 (WebCore::InspectorBackend::pauseOnExceptions): Changed from a bool to an int. 23 (WebCore::InspectorBackend::setPauseOnExceptions): Ditto. 24 * inspector/InspectorBackend.h: Ditto. 25 * inspector/InspectorBackend.idl: Ditto. 26 * inspector/JavaScriptDebugServer.cpp: 27 (WebCore::JavaScriptDebugServer::JavaScriptDebugServer): Changed from bool to PauseOnExceptionsState. 28 (WebCore::JavaScriptDebugServer::setPauseOnExceptions): Ditto. 29 (WebCore::JavaScriptDebugServer::exception): Updated logic to see if we are breaking 30 on uncaught exceptions, and check if we have a handler. 31 * inspector/JavaScriptDebugServer.h: 32 (WebCore::JavaScriptDebugServer::): Changed from bool to PauseOnExceptionsState. 33 (WebCore::JavaScriptDebugServer::pauseOnExceptions): Ditto. 34 * inspector/front-end/InspectorBackendStub.js: 35 (.WebInspector.InspectorBackendStub.prototype.pauseOnExceptionsState): Changed from returning false to returning 0 (stub function). 36 * inspector/front-end/ScriptsPanel.js: 37 (WebInspector.ScriptsPanel): 38 (WebInspector.ScriptsPanel.prototype._updatePauseOnExceptionsButton): Updated to new text/new cycling of variables. 39 (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions): Updated to new text/new cycling of variables. 40 * inspector/front-end/StatusBarButton.js: 41 (WebInspector.StatusBarButton): Added the option for a different number of states. 42 (WebInspector.StatusBarButton.prototype.set toggled): Added rules to toggle on/off with multiple states. 43 * inspector/front-end/inspector.css: Added rules for toggled-1 and toggled-2. 44 * manual-tests/debugger-caught-uncaught-exceptions.html: Added. 45 1 46 2010-01-22 Ben Murdoch <benm@google.com> 2 47 -
trunk/WebCore/inspector/InspectorBackend.cpp
r53558 r53696 198 198 } 199 199 200 bool InspectorBackend::pauseOnExceptions()201 { 202 return JavaScriptDebugServer::shared().pauseOnExceptions ();203 } 204 205 void InspectorBackend::setPauseOnExceptions (bool pause)206 { 207 JavaScriptDebugServer::shared().setPauseOnExceptions (pause);200 long InspectorBackend::pauseOnExceptionsState() 201 { 202 return JavaScriptDebugServer::shared().pauseOnExceptionsState(); 203 } 204 205 void InspectorBackend::setPauseOnExceptionsState(long pauseState) 206 { 207 JavaScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<JavaScriptDebugServer::PauseOnExceptionsState>(pauseState)); 208 208 } 209 209 -
trunk/WebCore/inspector/InspectorBackend.h
r53689 r53696 85 85 void resumeDebugger(); 86 86 87 bool pauseOnExceptions();88 void setPauseOnExceptions (bool pause);87 long pauseOnExceptionsState(); 88 void setPauseOnExceptionsState(long pauseState); 89 89 90 90 void stepOverStatementInDebugger(); -
trunk/WebCore/inspector/InspectorBackend.idl
r53558 r53696 63 63 void stepOutOfFunctionInDebugger(); 64 64 65 boolean pauseOnExceptions();66 void setPauseOnExceptions (in boolean pauseOnExceptions);65 long pauseOnExceptionsState(); 66 void setPauseOnExceptionsState(in long pauseOnExceptionsState); 67 67 68 68 boolean profilerEnabled(); -
trunk/WebCore/inspector/JavaScriptDebugServer.cpp
r53516 r53696 76 76 JavaScriptDebugServer::JavaScriptDebugServer() 77 77 : m_callingListeners(false) 78 , m_pauseOnExceptions (false)78 , m_pauseOnExceptionsState(DontPauseOnExceptions) 79 79 , m_pauseOnNextStatement(false) 80 80 , m_paused(false) … … 250 250 } 251 251 252 void JavaScriptDebugServer::setPauseOnExceptions (boolpause)253 { 254 m_pauseOnExceptions = pause;252 void JavaScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause) 253 { 254 m_pauseOnExceptionsState = pause; 255 255 } 256 256 … … 543 543 void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler) 544 544 { 545 UNUSED_PARAM(hasHandler);546 547 545 if (m_paused) 548 546 return; … … 552 550 return; 553 551 554 if (m_pauseOnExceptions )552 if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler)) 555 553 m_pauseOnNextStatement = true; 556 554 -
trunk/WebCore/inspector/JavaScriptDebugServer.h
r53516 r53696 69 69 void clearBreakpoints(); 70 70 71 bool pauseOnExceptions() const { return m_pauseOnExceptions; } 72 void setPauseOnExceptions(bool); 71 enum PauseOnExceptionsState { 72 DontPauseOnExceptions, 73 PauseOnAllExceptions, 74 PauseOnUncaughtExceptions 75 }; 76 PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; } 77 void setPauseOnExceptionsState(PauseOnExceptionsState); 73 78 74 79 void pauseProgram(); … … 137 142 ListenerSet m_listeners; 138 143 bool m_callingListeners; 139 bool m_pauseOnExceptions;144 PauseOnExceptionsState m_pauseOnExceptionsState; 140 145 bool m_pauseOnNextStatement; 141 146 bool m_paused; -
trunk/WebCore/inspector/front-end/InspectorBackendStub.js
r52547 r53696 196 196 }, 197 197 198 pauseOnExceptions : function()199 { 200 return false;201 }, 202 203 setPauseOnExceptions : function(value)198 pauseOnExceptionsState: function() 199 { 200 return 0; 201 }, 202 203 setPauseOnExceptionsState: function(value) 204 204 { 205 205 }, -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r53558 r53696 155 155 this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false); 156 156 157 this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item" );157 this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3); 158 158 this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); 159 159 … … 194 194 this.reset(); 195 195 } 196 197 // Keep these in sync with WebCore::JavaScriptDebugServer 198 WebInspector.ScriptsPanel.PauseOnExceptionsState = { 199 DontPauseOnExceptions : 0, 200 PauseOnAllExceptions : 1, 201 PauseOnUncaughtExceptions: 2 202 }; 196 203 197 204 WebInspector.ScriptsPanel.prototype = { … … 796 803 event.preventDefault(); 797 804 }, 798 805 799 806 _updatePauseOnExceptionsButton: function() 800 807 { 801 if (InspectorBackend.pauseOnExceptions()) { 802 this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions."); 803 this.pauseOnExceptionButton.toggled = true; 804 } else { 805 this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on exceptions."); 806 this.pauseOnExceptionButton.toggled = false; 807 } 808 if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) 809 this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); 810 else if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions) 811 this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); 812 else if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) 813 this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); 814 815 this.pauseOnExceptionButton.state = InspectorBackend.pauseOnExceptionsState(); 816 808 817 }, 809 818 … … 908 917 _togglePauseOnExceptions: function() 909 918 { 910 InspectorBackend.setPauseOnExceptions (!InspectorBackend.pauseOnExceptions());919 InspectorBackend.setPauseOnExceptionsState((InspectorBackend.pauseOnExceptionsState() + 1) % this.pauseOnExceptionButton.states); 911 920 this._updatePauseOnExceptionsButton(); 912 921 }, -
trunk/WebCore/inspector/front-end/StatusBarButton.js
r47194 r53696 29 29 */ 30 30 31 WebInspector.StatusBarButton = function(title, className )31 WebInspector.StatusBarButton = function(title, className, states) 32 32 { 33 33 this.element = document.createElement("button"); … … 42 42 this.glyphShadow.className = "glyph shadow"; 43 43 this.element.appendChild(this.glyphShadow); 44 45 this.states = states; 46 if (!states) 47 this.states = 2; 44 48 49 if (states == 2) 50 this._state = false; 51 else 52 this._state = 0; 53 45 54 this.title = title; 46 55 this.disabled = false; 47 this._toggled = false;48 56 this._visible = true; 49 57 } … … 80 88 this.element.title = x; 81 89 }, 90 91 get state() 92 { 93 return this._state; 94 }, 95 96 set state(x) 97 { 98 if (this._state === x) 99 return; 100 101 if (this.states === 2) { 102 if (x) 103 this.element.addStyleClass("toggled-on"); 104 else 105 this.element.removeStyleClass("toggled-on"); 106 } else { 107 if (x !== 0) { 108 this.element.removeStyleClass("toggled-" + this._state); 109 this.element.addStyleClass("toggled-" + x); 110 } else 111 this.element.removeStyleClass("toggled-" + this._state); 112 } 113 this._state = x; 114 }, 82 115 83 116 get toggled() 84 117 { 85 return this._toggled; 118 if (this.states !== 2) 119 throw("Only used toggled when there are 2 states, otherwise, use state"); 120 return this.state; 86 121 }, 87 122 88 123 set toggled(x) 89 124 { 90 if (this._toggled === x) 91 return; 92 93 if (x) 94 this.element.addStyleClass("toggled-on"); 95 else 96 this.element.removeStyleClass("toggled-on"); 97 this._toggled = x; 125 if (this.states !== 2) 126 throw("Only used toggled when there are 2 states, otherwise, use state"); 127 this.state = x; 98 128 }, 99 129 -
trunk/WebCore/inspector/front-end/inspector.css
r53545 r53696 367 367 } 368 368 369 button.status-bar-item.toggled-1 .glyph { 370 background-color: rgb(66, 129, 235); 371 } 372 373 button.status-bar-item.toggled-2 .glyph { 374 background-color: purple; 375 } 376 369 377 button.status-bar-item:disabled { 370 378 opacity: 0.5;
Note: See TracChangeset
for help on using the changeset viewer.