Changeset 53696 in webkit


Ignore:
Timestamp:
Jan 22, 2010 4:52:52 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-01-22 Brian Weinstein <bweinstein@apple.com>

Reviewed by Timothy Hatcher.

Web Inspector: Caught exceptions still pause the debugger.
<https://bugs.webkit.org/show_bug.cgi?id=28622>.

Turn the pauseOnExceptions variable from a bool to an int, because we now have
3 states, in an enum: DontPauseOnExceptions, PauseOnAllExceptions, and
PauseOnUncaughtExceptions. The status button for pausing on exceptions is now
a tri-state button, which cycles from Don't pause (no background) to Pause on All
(blue background) to Pause on Uncaught (purple background).

Also added the ability for a status button to have more than 2 states, and added
style rules for a CSS three state button.

Added a manual test, manual-tests/debugger-caught-uncaught-exceptions.html, that
generates caught and uncaught exceptions.

  • English.lproj/localizedStrings.js: Added updated Action / Click to Action text.
  • inspector/InspectorBackend.cpp: (WebCore::InspectorBackend::pauseOnExceptions): Changed from a bool to an int. (WebCore::InspectorBackend::setPauseOnExceptions): Ditto.
  • inspector/InspectorBackend.h: Ditto.
  • inspector/InspectorBackend.idl: Ditto.
  • inspector/JavaScriptDebugServer.cpp: (WebCore::JavaScriptDebugServer::JavaScriptDebugServer): Changed from bool to PauseOnExceptionsState. (WebCore::JavaScriptDebugServer::setPauseOnExceptions): Ditto. (WebCore::JavaScriptDebugServer::exception): Updated logic to see if we are breaking

on uncaught exceptions, and check if we have a handler.

  • inspector/JavaScriptDebugServer.h: (WebCore::JavaScriptDebugServer::): Changed from bool to PauseOnExceptionsState. (WebCore::JavaScriptDebugServer::pauseOnExceptions): Ditto.
  • inspector/front-end/InspectorBackendStub.js: (.WebInspector.InspectorBackendStub.prototype.pauseOnExceptionsState): Changed from returning false to returning 0 (stub function).
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel): (WebInspector.ScriptsPanel.prototype._updatePauseOnExceptionsButton): Updated to new text/new cycling of variables. (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions): Updated to new text/new cycling of variables.
  • inspector/front-end/StatusBarButton.js: (WebInspector.StatusBarButton): Added the option for a different number of states. (WebInspector.StatusBarButton.prototype.set toggled): Added rules to toggle on/off with multiple states.
  • inspector/front-end/inspector.css: Added rules for toggled-1 and toggled-2.
  • manual-tests/debugger-caught-uncaught-exceptions.html: Added.
Location:
trunk/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53695 r53696  
     12010-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
    1462010-01-22  Ben Murdoch  <benm@google.com>
    247
  • trunk/WebCore/inspector/InspectorBackend.cpp

    r53558 r53696  
    198198}
    199199
    200 bool InspectorBackend::pauseOnExceptions()
    201 {
    202     return JavaScriptDebugServer::shared().pauseOnExceptions();
    203 }
    204 
    205 void InspectorBackend::setPauseOnExceptions(bool pause)
    206 {
    207     JavaScriptDebugServer::shared().setPauseOnExceptions(pause);
     200long InspectorBackend::pauseOnExceptionsState()
     201{
     202    return JavaScriptDebugServer::shared().pauseOnExceptionsState();
     203}
     204
     205void InspectorBackend::setPauseOnExceptionsState(long pauseState)
     206{
     207    JavaScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<JavaScriptDebugServer::PauseOnExceptionsState>(pauseState));
    208208}
    209209
  • trunk/WebCore/inspector/InspectorBackend.h

    r53689 r53696  
    8585    void resumeDebugger();
    8686
    87     bool pauseOnExceptions();
    88     void setPauseOnExceptions(bool pause);
     87    long pauseOnExceptionsState();
     88    void setPauseOnExceptionsState(long pauseState);
    8989
    9090    void stepOverStatementInDebugger();
  • trunk/WebCore/inspector/InspectorBackend.idl

    r53558 r53696  
    6363        void stepOutOfFunctionInDebugger();
    6464
    65         boolean pauseOnExceptions();
    66         void setPauseOnExceptions(in boolean pauseOnExceptions);
     65        long pauseOnExceptionsState();
     66        void setPauseOnExceptionsState(in long pauseOnExceptionsState);
    6767
    6868        boolean profilerEnabled();
  • trunk/WebCore/inspector/JavaScriptDebugServer.cpp

    r53516 r53696  
    7676JavaScriptDebugServer::JavaScriptDebugServer()
    7777    : m_callingListeners(false)
    78     , m_pauseOnExceptions(false)
     78    , m_pauseOnExceptionsState(DontPauseOnExceptions)
    7979    , m_pauseOnNextStatement(false)
    8080    , m_paused(false)
     
    250250}
    251251
    252 void JavaScriptDebugServer::setPauseOnExceptions(bool pause)
    253 {
    254     m_pauseOnExceptions = pause;
     252void JavaScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause)
     253{
     254    m_pauseOnExceptionsState = pause;
    255255}
    256256
     
    543543void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler)
    544544{
    545     UNUSED_PARAM(hasHandler);
    546    
    547545    if (m_paused)
    548546        return;
     
    552550        return;
    553551
    554     if (m_pauseOnExceptions)
     552    if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler))
    555553        m_pauseOnNextStatement = true;
    556554
  • trunk/WebCore/inspector/JavaScriptDebugServer.h

    r53516 r53696  
    6969        void clearBreakpoints();
    7070
    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);
    7378
    7479        void pauseProgram();
     
    137142        ListenerSet m_listeners;
    138143        bool m_callingListeners;
    139         bool m_pauseOnExceptions;
     144        PauseOnExceptionsState m_pauseOnExceptionsState;
    140145        bool m_pauseOnNextStatement;
    141146        bool m_paused;
  • trunk/WebCore/inspector/front-end/InspectorBackendStub.js

    r52547 r53696  
    196196    },
    197197
    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)
    204204    {
    205205    },
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r53558 r53696  
    155155    this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false);
    156156
    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);
    158158    this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
    159159
     
    194194    this.reset();
    195195}
     196
     197// Keep these in sync with WebCore::JavaScriptDebugServer
     198WebInspector.ScriptsPanel.PauseOnExceptionsState = {
     199    DontPauseOnExceptions : 0,
     200    PauseOnAllExceptions : 1,
     201    PauseOnUncaughtExceptions: 2
     202};
    196203
    197204WebInspector.ScriptsPanel.prototype = {
     
    796803        event.preventDefault();
    797804    },
    798 
     805   
    799806    _updatePauseOnExceptionsButton: function()
    800807    {
    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       
    808817    },
    809818
     
    908917    _togglePauseOnExceptions: function()
    909918    {
    910         InspectorBackend.setPauseOnExceptions(!InspectorBackend.pauseOnExceptions());
     919        InspectorBackend.setPauseOnExceptionsState((InspectorBackend.pauseOnExceptionsState() + 1) % this.pauseOnExceptionButton.states);
    911920        this._updatePauseOnExceptionsButton();
    912921    },
  • trunk/WebCore/inspector/front-end/StatusBarButton.js

    r47194 r53696  
    2929 */
    3030
    31 WebInspector.StatusBarButton = function(title, className)
     31WebInspector.StatusBarButton = function(title, className, states)
    3232{
    3333    this.element = document.createElement("button");
     
    4242    this.glyphShadow.className = "glyph shadow";
    4343    this.element.appendChild(this.glyphShadow);
     44   
     45    this.states = states;
     46    if (!states)
     47        this.states = 2;
    4448
     49    if (states == 2)
     50        this._state = false;
     51    else
     52        this._state = 0;
     53   
    4554    this.title = title;
    4655    this.disabled = false;
    47     this._toggled = false;
    4856    this._visible = true;
    4957}
     
    8088        this.element.title = x;
    8189    },
     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    },
    82115
    83116    get toggled()
    84117    {
    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;
    86121    },
    87122
    88123    set toggled(x)
    89124    {
    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;
    98128    },
    99129
  • trunk/WebCore/inspector/front-end/inspector.css

    r53545 r53696  
    367367}
    368368
     369button.status-bar-item.toggled-1 .glyph {
     370    background-color: rgb(66, 129, 235);
     371}
     372
     373button.status-bar-item.toggled-2 .glyph {
     374    background-color: purple;   
     375}
     376
    369377button.status-bar-item:disabled {
    370378    opacity: 0.5;
Note: See TracChangeset for help on using the changeset viewer.