2010-09-28 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Sep 2010 07:59:52 +0000 (07:59 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Sep 2010 07:59:52 +0000 (07:59 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: move pauseOnExceptionState under control of InspectorState
        It is Inspector Protocol cleanup activity.
        The actual state of this flag can be obtained as a return value of setPauseOnExceptionState command
        or as a value in InspectorState object.

        https://bugs.webkit.org/show_bug.cgi?id=46724

        * inspector/Inspector.idl:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::getInspectorState):
        (WebCore::InspectorController::populateScriptObjects):
        * inspector/InspectorDebuggerAgent.cpp:
        (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState):
        (WebCore::InspectorDebuggerAgent::pauseOnExceptionsState):
        * inspector/InspectorDebuggerAgent.h:
        * inspector/front-end/ScriptsPanel.js:
        (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions):
        * inspector/front-end/inspector.js:
        (WebInspector.doLoadedDone.populateInspectorState):
        (WebInspector.doLoadedDone):
        (WebInspector.reportProtocolError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/Inspector.idl
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorDebuggerAgent.cpp
WebCore/inspector/InspectorDebuggerAgent.h
WebCore/inspector/front-end/ScriptsPanel.js
WebCore/inspector/front-end/inspector.js

index 4976376..6162c51 100644 (file)
@@ -1,3 +1,29 @@
+2010-09-28  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move pauseOnExceptionState under control of InspectorState
+        It is Inspector Protocol cleanup activity.
+        The actual state of this flag can be obtained as a return value of setPauseOnExceptionState command
+        or as a value in InspectorState object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46724
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::getInspectorState):
+        (WebCore::InspectorController::populateScriptObjects):
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState):
+        (WebCore::InspectorDebuggerAgent::pauseOnExceptionsState):
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions):
+        * inspector/front-end/inspector.js:
+        (WebInspector.doLoadedDone.populateInspectorState):
+        (WebInspector.doLoadedDone):
+        (WebInspector.reportProtocolError):
+
 2010-09-28  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Martin Robinson.
index ce2b03f..a08a622 100644 (file)
@@ -130,7 +130,7 @@ module core {
         [handler=Debug] void stepIntoStatement();
         [handler=Debug] void stepOutOfFunction();
 
-        [handler=Debug] void setPauseOnExceptionsState(in long pauseOnExceptionsState);
+        [handler=Debug] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState);
 
         [handler=Debug] void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames);
         [handler=Debug] void getScriptSource(in String sourceID, out String scriptSource);
index d106d56..f2ee2c1 100644 (file)
 #include "StorageArea.h"
 #endif
 
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include "ScriptDebugServer.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -131,6 +127,7 @@ static const char* const monitoringXHRStateName = "monitoringXHREnabled";
 static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled";
 static const char* const searchingForNodeEnabledStateName = "searchingForNodeEnabled";
 static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled";
+static const char* const pauseOnExceptionsStateStateName = "pauseOnExceptionsState";
 
 static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight";
 
@@ -258,6 +255,10 @@ void InspectorController::getInspectorState(RefPtr<InspectorObject>* state)
 {
     (*state)->setBoolean(monitoringXHRStateName, m_monitoringXHR);
     (*state)->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+    if (m_debuggerAgent)
+        (*state)->setNumber(pauseOnExceptionsStateStateName, m_debuggerAgent->pauseOnExceptionsState());
+#endif
 }
 
 void InspectorController::updateInspectorStateCookie()
@@ -675,10 +676,6 @@ void InspectorController::populateScriptObjects()
     for (unsigned i = 0; i < messageCount; ++i)
         m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
 
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-    if (debuggerEnabled())
-        m_frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState());
-#endif
 #if ENABLE(DATABASE)
     DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
     for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
index 9275961..4964c09 100644 (file)
@@ -172,10 +172,15 @@ void InspectorDebuggerAgent::stepOutOfFunction()
     ScriptDebugServer::shared().stepOutOfFunction();
 }
 
-void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState)
+void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState, long* newState)
 {
     ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
-    m_frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState());
+    *newState = ScriptDebugServer::shared().pauseOnExceptionsState();
+}
+
+long InspectorDebuggerAgent::pauseOnExceptionsState()
+{
+    return ScriptDebugServer::shared().pauseOnExceptionsState();
 }
 
 void InspectorDebuggerAgent::clearForPageNavigation()
index f5baabc..8a5379d 100644 (file)
@@ -73,7 +73,8 @@ public:
     void stepIntoStatement();
     void stepOutOfFunction();
 
-    void setPauseOnExceptionsState(long pauseState);
+    void setPauseOnExceptionsState(long pauseState, long* newState);
+    long pauseOnExceptionsState();
 
     void clearForPageNavigation();
 
index b82b996..8283528 100644 (file)
@@ -895,7 +895,7 @@ WebInspector.ScriptsPanel.prototype = {
 
     _togglePauseOnExceptions: function()
     {
-        InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states);
+        InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states, this.updatePauseOnExceptionsState.bind(this));
     },
 
     _togglePause: function()
index fe02cf4..211b4fc 100644 (file)
@@ -592,6 +592,8 @@ WebInspector.doLoadedDone = function()
     function populateInspectorState(inspectorState)
     {
         WebInspector.monitoringXHREnabled = inspectorState.monitoringXHREnabled;
+        if ("pauseOnExceptionsState" in inspectorState)
+            WebInspector.panels.scripts.updatePauseOnExceptionsState(inspectorState.pauseOnExceptionsState);
         if (inspectorState.resourceTrackingEnabled)
             WebInspector.panels.resources.resourceTrackingWasEnabled();
         else
@@ -684,8 +686,8 @@ WebInspector.dispatchMessageFromBackend = function(messageObject)
 WebInspector.reportProtocolError = function(messageObject)
 {
     console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq);
-    for (var error in messageObject.errors)
-        console.error("    " + error);
+    for (var i = 0; i < messageObject.errors.length; ++i)
+        console.error("    " + messageObject.errors[i]);
     WebInspector.removeResponseCallbackEntry(messageObject.seq);
 }
 
@@ -1409,11 +1411,6 @@ WebInspector.debuggerWasEnabled = function()
     this.panels.scripts.debuggerWasEnabled();
 }
 
-WebInspector.updatePauseOnExceptionsState = function(pauseOnExceptionsState)
-{
-    this.panels.scripts.updatePauseOnExceptionsState(pauseOnExceptionsState);
-}
-
 WebInspector.debuggerWasDisabled = function()
 {
     this.panels.scripts.debuggerWasDisabled();