Title: [114632] trunk/Source/WebCore
Revision
114632
Author
vse...@chromium.org
Date
2012-04-19 08:34:31 -0700 (Thu, 19 Apr 2012)

Log Message

Web Inspector: x-frame security errors logged when typing in the console are annoying.
https://bugs.webkit.org/show_bug.cgi?id=81970

Reviewed by Pavel Feldman.

Parameter DoNotPauseOnExceptions in Runtime.evaluate() renamed to DoNotPauseOnExceptionsAndMuteConsole.
Added this parameter to Runtime.callFunctionOn() and passed true in all call sites.
Added this parameter to Debugger.evaluateOnCallFrame().
Added a flag to console that mutes all messages unless they have ConsoleAPI message source.
This flag is now temporarily set from InspectorRuntimeAgent and InspectorDebuggerAgent for certain injected source calls.

* inspector/Inspector.json:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::asBool):
(WebCore):
(WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
* inspector/InspectorDebuggerAgent.h:
(InspectorDebuggerAgent):
* inspector/InspectorRuntimeAgent.cpp:
(WebCore):
(WebCore::setPauseOnExceptionsState):
(WebCore::InspectorRuntimeAgent::evaluate):
(WebCore::InspectorRuntimeAgent::callFunctionOn):
(WebCore::InspectorRuntimeAgent::getProperties):
* inspector/InspectorRuntimeAgent.h:
(InspectorRuntimeAgent):
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::muteConsole):
(WebCore):
(WebCore::PageDebuggerAgent::unmuteConsole):
* inspector/PageDebuggerAgent.h:
(PageDebuggerAgent):
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::muteConsole):
(WebCore):
(WebCore::PageRuntimeAgent::unmuteConsole):
* inspector/PageRuntimeAgent.h:
(PageRuntimeAgent):
* inspector/WorkerDebuggerAgent.cpp:
(WebCore::WorkerDebuggerAgent::muteConsole):
(WebCore):
(WebCore::WorkerDebuggerAgent::unmuteConsole):
* inspector/WorkerDebuggerAgent.h:
(WorkerDebuggerAgent):
* inspector/WorkerRuntimeAgent.cpp:
(WebCore::WorkerRuntimeAgent::muteConsole):
(WebCore):
(WebCore::WorkerRuntimeAgent::unmuteConsole):
* inspector/WorkerRuntimeAgent.h:
(WorkerRuntimeAgent):
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.prototype.evalInInspectedWindow):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype.evaluateInSelectedCallFrame):
(WebInspector.PresentationCallFrame.prototype.evaluate):
* inspector/front-end/RemoteObject.js:
(WebInspector.RemoteObject.prototype.setPropertyValue):
(WebInspector.RemoteObject.prototype.callFunction):
(WebInspector.RemoteObject.prototype.callFunctionJSON):
* inspector/front-end/WorkerManager.js:
* page/Console.cpp:
(WebCore::Console::addMessage):
(WebCore::Console::warn):
(WebCore):
(WebCore::Console::mute):
(WebCore::Console::unmute):
* page/Console.h:
(Console):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114631 => 114632)


--- trunk/Source/WebCore/ChangeLog	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/ChangeLog	2012-04-19 15:34:31 UTC (rev 114632)
@@ -1,3 +1,74 @@
+2012-04-19  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: x-frame security errors logged when typing in the console are annoying.
+        https://bugs.webkit.org/show_bug.cgi?id=81970
+
+        Reviewed by Pavel Feldman.
+
+        Parameter DoNotPauseOnExceptions in Runtime.evaluate() renamed to DoNotPauseOnExceptionsAndMuteConsole.
+        Added this parameter to Runtime.callFunctionOn() and passed true in all call sites.
+        Added this parameter to Debugger.evaluateOnCallFrame().
+        Added a flag to console that mutes all messages unless they have ConsoleAPI message source.
+        This flag is now temporarily set from InspectorRuntimeAgent and InspectorDebuggerAgent for certain injected source calls.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::asBool):
+        (WebCore):
+        (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
+        * inspector/InspectorDebuggerAgent.h:
+        (InspectorDebuggerAgent):
+        * inspector/InspectorRuntimeAgent.cpp:
+        (WebCore):
+        (WebCore::setPauseOnExceptionsState):
+        (WebCore::InspectorRuntimeAgent::evaluate):
+        (WebCore::InspectorRuntimeAgent::callFunctionOn):
+        (WebCore::InspectorRuntimeAgent::getProperties):
+        * inspector/InspectorRuntimeAgent.h:
+        (InspectorRuntimeAgent):
+        * inspector/PageDebuggerAgent.cpp:
+        (WebCore::PageDebuggerAgent::muteConsole):
+        (WebCore):
+        (WebCore::PageDebuggerAgent::unmuteConsole):
+        * inspector/PageDebuggerAgent.h:
+        (PageDebuggerAgent):
+        * inspector/PageRuntimeAgent.cpp:
+        (WebCore::PageRuntimeAgent::muteConsole):
+        (WebCore):
+        (WebCore::PageRuntimeAgent::unmuteConsole):
+        * inspector/PageRuntimeAgent.h:
+        (PageRuntimeAgent):
+        * inspector/WorkerDebuggerAgent.cpp:
+        (WebCore::WorkerDebuggerAgent::muteConsole):
+        (WebCore):
+        (WebCore::WorkerDebuggerAgent::unmuteConsole):
+        * inspector/WorkerDebuggerAgent.h:
+        (WorkerDebuggerAgent):
+        * inspector/WorkerRuntimeAgent.cpp:
+        (WebCore::WorkerRuntimeAgent::muteConsole):
+        (WebCore):
+        (WebCore::WorkerRuntimeAgent::unmuteConsole):
+        * inspector/WorkerRuntimeAgent.h:
+        (WorkerRuntimeAgent):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.evalInInspectedWindow):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype.evaluateInSelectedCallFrame):
+        (WebInspector.PresentationCallFrame.prototype.evaluate):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.prototype.setPropertyValue):
+        (WebInspector.RemoteObject.prototype.callFunction):
+        (WebInspector.RemoteObject.prototype.callFunctionJSON):
+        * inspector/front-end/WorkerManager.js:
+        * page/Console.cpp:
+        (WebCore::Console::addMessage):
+        (WebCore::Console::warn):
+        (WebCore):
+        (WebCore::Console::mute):
+        (WebCore::Console::unmute):
+        * page/Console.h:
+        (Console):
+
 2012-04-19  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r114628.

Modified: trunk/Source/WebCore/inspector/Inspector.json (114631 => 114632)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-04-19 15:34:31 UTC (rev 114632)
@@ -422,7 +422,7 @@
                     { "name": "_expression_", "type": "string", "description": "_expression_ to evaluate." },
                     { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." },
                     { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation.", "hidden": true },
-                    { "name": "doNotPauseOnExceptions", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions. Overrides setPauseOnException state.", "hidden": true },
+                    { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true },
                     { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Specifies in which frame to perform evaluation.", "hidden": true },
                     { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }
                 ],
@@ -438,6 +438,7 @@
                     { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to call function on." },
                     { "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." },
                     { "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same _javascript_ world as the target object." },
+                    { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true },
                     { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }
                 ],
                 "returns": [
@@ -2336,6 +2337,7 @@
                     { "name": "_expression_", "type": "string", "description": "_expression_ to evaluate." },
                     { "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>)." },
                     { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated _expression_, defaults to false.", "hidden": true },
+                    { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true },
                     { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }
                 ],
                 "returns": [

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -59,6 +59,11 @@
 
 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace-object-group";
 
+static bool asBool(const bool* const b)
+{
+    return b ? *b : false;
+}
+
 InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
     : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger", instrumentingAgents, inspectorState)
     , m_injectedScriptManager(injectedScriptManager)
@@ -476,14 +481,28 @@
         m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState);
 }
 
-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
     if (injectedScript.hasNoValue()) {
         *errorString = "Inspected frame has gone";
         return;
     }
-    injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, _expression_, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, &result, wasThrown);
+
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+        if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions)
+            scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
+        muteConsole();
+    }
+
+    injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, _expression_, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), &result, wasThrown);
+
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+        unmuteConsole();
+        if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState)
+            scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState);
+    }
 }
 
 PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::currentCallFrames()

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -105,6 +105,7 @@
                              const String& _expression_,
                              const String* objectGroup,
                              const bool* includeCommandLineAPI,
+                             const bool* doNotPauseOnExceptionsAndMuteConsole,
                              const bool* returnByValue,
                              RefPtr<TypeBuilder::Runtime::RemoteObject>& result,
                              TypeBuilder::OptOutput<bool>* wasThrown);
@@ -124,6 +125,8 @@
 
     virtual void startListeningScriptDebugServer() = 0;
     virtual void stopListeningScriptDebugServer() = 0;
+    virtual void muteConsole() = 0;
+    virtual void unmuteConsole() = 0;
 
 private:
     void enable();

Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -72,8 +72,19 @@
     m_instrumentingAgents->setInspectorRuntimeAgent(0);
 }
 
-void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, const String* const frameId, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
+#if ENABLE(_javascript__DEBUGGER)
+static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer* scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
 {
+    ASSERT(scriptDebugServer);
+    ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer->pauseOnExceptionsState();
+    if (presentState != newState)
+        scriptDebugServer->setPauseOnExceptionsState(newState);
+    return presentState;
+}
+#endif
+
+void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const String* const frameId, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
+{
     ScriptState* scriptState = 0;
     if (frameId) {
         scriptState = scriptStateForFrameId(*frameId);
@@ -89,24 +100,24 @@
         return;
     }
 #if ENABLE(_javascript__DEBUGGER)
-    ASSERT(m_scriptDebugServer);
-    bool pauseStateChanged = false;
-    ScriptDebugServer::PauseOnExceptionsState presentState = m_scriptDebugServer->pauseOnExceptionsState();
-    if (asBool(doNotPauseOnExceptions) && presentState != ScriptDebugServer::DontPauseOnExceptions) {
-        m_scriptDebugServer->setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
-        pauseStateChanged = true;
-    }
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions;
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+        previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
 #endif
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+        muteConsole();
 
     injectedScript.evaluate(errorString, _expression_, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), &result, wasThrown);
 
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+        unmuteConsole();
 #if ENABLE(_javascript__DEBUGGER)
-    if (pauseStateChanged)
-        m_scriptDebugServer->setPauseOnExceptionsState(presentState);
+        setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
 #endif
+    }
 }
 
-void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const String& objectId, const String& _expression_, const RefPtr<InspectorArray>* const optionalArguments, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
+void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const String& objectId, const String& _expression_, const RefPtr<InspectorArray>* const optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -117,7 +128,22 @@
     if (optionalArguments)
         arguments = (*optionalArguments)->toJSONString();
 
+#if ENABLE(_javascript__DEBUGGER)
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions;
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+        previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+#endif
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+        muteConsole();
+
     injectedScript.callFunctionOn(errorString, objectId, _expression_, arguments, asBool(returnByValue), &result, wasThrown);
+
+    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+        unmuteConsole();
+#if ENABLE(_javascript__DEBUGGER)
+        setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+#endif
+    }
 }
 
 void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >& result)
@@ -127,7 +153,18 @@
         *errorString = "Inspected frame has gone";
         return;
     }
+
+#if ENABLE(_javascript__DEBUGGER)
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+#endif
+    muteConsole();
+
     injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, &result);
+
+    unmuteConsole();
+#if ENABLE(_javascript__DEBUGGER)
+    setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+#endif
 }
 
 void InspectorRuntimeAgent::releaseObject(ErrorString*, const String& objectId)

Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -61,7 +61,7 @@
                   const String& _expression_,
                   const String* objectGroup,
                   const bool* includeCommandLineAPI,
-                  const bool* doNotPauseOnExceptions,
+                  const bool* doNotPauseOnExceptionsAndMuteConsole,
                   const String* frameId,
                   const bool* returnByValue,
                   RefPtr<TypeBuilder::Runtime::RemoteObject>& result,
@@ -70,6 +70,7 @@
                         const String& objectId,
                         const String& _expression_,
                         const RefPtr<InspectorArray>* optionalArguments,
+                        const bool* doNotPauseOnExceptionsAndMuteConsole,
                         const bool* returnByValue,
                         RefPtr<TypeBuilder::Runtime::RemoteObject>& result,
                         TypeBuilder::OptOutput<bool>* wasThrown);
@@ -89,6 +90,8 @@
     InspectorRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);
     virtual ScriptState* scriptStateForFrameId(const String& frameId) = 0;
     virtual ScriptState* getDefaultInspectedState() = 0;
+    virtual void muteConsole() = 0;
+    virtual void unmuteConsole() = 0;
 
 private:
     InjectedScriptManager* m_injectedScriptManager;

Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -34,6 +34,7 @@
 
 #include "PageDebuggerAgent.h"
 
+#include "Console.h"
 #include "PageScriptDebugServer.h"
 
 namespace WebCore {
@@ -68,6 +69,16 @@
     return PageScriptDebugServer::shared();
 }
 
+void PageDebuggerAgent::muteConsole()
+{
+    Console::mute();
+}
+
+void PageDebuggerAgent::unmuteConsole()
+{
+    Console::unmute();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(_javascript__DEBUGGER) && ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/PageDebuggerAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -51,6 +51,8 @@
     virtual void startListeningScriptDebugServer();
     virtual void stopListeningScriptDebugServer();
     virtual PageScriptDebugServer& scriptDebugServer();
+    virtual void muteConsole();
+    virtual void unmuteConsole();
 
     PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
     Page* const m_inspectedPage;

Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -34,6 +34,7 @@
 
 #include "PageRuntimeAgent.h"
 
+#include "Console.h"
 #include "InspectorPageAgent.h"
 #include "Page.h"
 #include "ScriptState.h"
@@ -64,6 +65,16 @@
     return mainWorldScriptState(m_inspectedPage->mainFrame());
 }
 
+void PageRuntimeAgent::muteConsole()
+{
+    Console::mute();
+}
+
+void PageRuntimeAgent::unmuteConsole()
+{
+    Console::unmute();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/PageRuntimeAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -54,6 +54,8 @@
 
     virtual ScriptState* scriptStateForFrameId(const String& frameId);
     virtual ScriptState* getDefaultInspectedState();
+    virtual void muteConsole();
+    virtual void unmuteConsole();
     Page* m_inspectedPage;
     InspectorPageAgent* m_pageAgent;
 };

Modified: trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -124,6 +124,16 @@
     return m_scriptDebugServer;
 }
 
+void WorkerDebuggerAgent::muteConsole()
+{
+    // We don't need to mute console for workers.
+}
+
+void WorkerDebuggerAgent::unmuteConsole()
+{
+    // We don't need to mute console for workers.
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(_javascript__DEBUGGER) && ENABLE(INSPECTOR) && ENABLE(WORKERS)

Modified: trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -56,6 +56,8 @@
     virtual void startListeningScriptDebugServer();
     virtual void stopListeningScriptDebugServer();
     virtual WorkerScriptDebugServer& scriptDebugServer();
+    virtual void muteConsole();
+    virtual void unmuteConsole();
 
     WorkerScriptDebugServer m_scriptDebugServer;
     WorkerContext* m_inspectedWorkerContext;

Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp (114631 => 114632)


--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -58,6 +58,16 @@
     return scriptStateFromWorkerContext(m_workerContext);
 }
 
+void WorkerRuntimeAgent::muteConsole()
+{
+    // We don't need to mute console for workers.
+}
+
+void WorkerRuntimeAgent::unmuteConsole()
+{
+    // We don't need to mute console for workers.
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR) && ENABLE(WORKERS)

Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h (114631 => 114632)


--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -52,6 +52,8 @@
     WorkerRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, WorkerContext*);
     virtual ScriptState* scriptStateForFrameId(const String& frameId);
     virtual ScriptState* getDefaultInspectedState();
+    virtual void muteConsole();
+    virtual void unmuteConsole();
     WorkerContext* m_workerContext;
 };
 

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (114631 => 114632)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-04-19 15:34:31 UTC (rev 114632)
@@ -586,14 +586,14 @@
      * @param {string} _expression_
      * @param {string} objectGroup
      * @param {boolean} includeCommandLineAPI
-     * @param {boolean} doNotPauseOnExceptions
+     * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
      * @param {boolean} returnByValue
      * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback
      */
-    evalInInspectedWindow: function(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, returnByValue, callback)
+    evalInInspectedWindow: function(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback)
     {
         if (WebInspector.debuggerPresentationModel.selectedCallFrame) {
-            WebInspector.debuggerPresentationModel.evaluateInSelectedCallFrame(_expression_, objectGroup, includeCommandLineAPI, returnByValue, callback);
+            WebInspector.debuggerPresentationModel.evaluateInSelectedCallFrame(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback);
             return;
         }
 
@@ -620,7 +620,7 @@
             else
                 callback(WebInspector.RemoteObject.fromPayload(result), !!wasThrown);
         }
-        RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, this._currentEvaluationContextId(), returnByValue, evalCallback);
+        RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, this._currentEvaluationContextId(), returnByValue, evalCallback);
     },
 
     evaluateUsingTextPrompt: function(_expression_, showResultOnly)

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (114631 => 114632)


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-04-19 15:34:31 UTC (rev 114632)
@@ -459,9 +459,14 @@
     },
 
     /**
+     * @param {string} code
+     * @param {string} objectGroup
+     * @param {boolean} includeCommandLineAPI
+     * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
+     * @param {boolean} returnByValue
      * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback
      */
-    evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
+    evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback)
     {
         /**
          * @param {?RuntimeAgent.RemoteObject} result
@@ -478,7 +483,7 @@
                 this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame);
         }
 
-        this.selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluate.bind(this));
+        this.selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, didEvaluate.bind(this));
     },
 
     /**
@@ -684,10 +689,11 @@
      * @param {string} code
      * @param {string} objectGroup
      * @param {boolean} includeCommandLineAPI
+     * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
      * @param {boolean} returnByValue
      * @param {function(?RuntimeAgent.RemoteObject, boolean=)=} callback
      */
-    evaluate: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
+    evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback)
     {
         /**
          * @this {WebInspector.PresentationCallFrame}
@@ -704,7 +710,7 @@
             }
             callback(result, wasThrown);
         }
-        DebuggerAgent.evaluateOnCallFrame(this._callFrame.callFrameId, code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluateOnCallFrame.bind(this));
+        DebuggerAgent.evaluateOnCallFrame(this._callFrame.callFrameId, code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, didEvaluateOnCallFrame.bind(this));
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (114631 => 114632)


--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-04-19 15:34:31 UTC (rev 114632)
@@ -219,7 +219,7 @@
             return;
         }
 
-        RuntimeAgent.evaluate.invoke({_expression_:value, doNotPauseOnExceptions:true}, evaluatedCallback.bind(this));
+        RuntimeAgent.evaluate.invoke({_expression_:value, doNotPauseOnExceptionsAndMuteConsole:true}, evaluatedCallback.bind(this));
 
         /**
          * @param {?Protocol.Error} error
@@ -239,7 +239,7 @@
             }
 
             delete result.description; // Optimize on traffic.
-            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], undefined, propertySetCallback.bind(this));
+            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
             if (result._objectId)
                 RuntimeAgent.releaseObject(result._objectId);
         }
@@ -287,7 +287,7 @@
             callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result));
         }
 
-        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, undefined, mycallback);
+        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, mycallback);
     },
 
     /**
@@ -307,7 +307,7 @@
             callback((error || wasThrown) ? null : result.value);
         }
 
-        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, mycallback);
+        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, true, mycallback);
     },
 
     release: function()

Modified: trunk/Source/WebCore/inspector/front-end/WorkerManager.js (114631 => 114632)


--- trunk/Source/WebCore/inspector/front-end/WorkerManager.js	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/inspector/front-end/WorkerManager.js	2012-04-19 15:34:31 UTC (rev 114632)
@@ -98,7 +98,7 @@
     var _expression_ = "location.href";
     if (WebInspector.queryParamsObject["isSharedWorker"])
         _expression_ += " + (this.name ? ' (' + this.name + ')' : '')";
-    RuntimeAgent.evaluate.invoke({_expression_:_expression_, doNotPauseOnExceptions:true, returnByValue: true}, evalCallback.bind(this));
+    RuntimeAgent.evaluate.invoke({_expression_:_expression_, doNotPauseOnExceptionsAndMuteConsole:true, returnByValue: true}, evalCallback.bind(this));
     
     /**
      * @param {?Protocol.Error} error

Modified: trunk/Source/WebCore/page/Console.cpp (114631 => 114632)


--- trunk/Source/WebCore/page/Console.cpp	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/page/Console.cpp	2012-04-19 15:34:31 UTC (rev 114632)
@@ -55,6 +55,10 @@
 
 namespace WebCore {
 
+namespace {
+    int muteCount = 0;
+}
+
 Console::Console(Frame* frame)
     : DOMWindowProperty(frame)
 {
@@ -128,8 +132,6 @@
     printf("%s %s:", sourceString, levelString);
 }
 
-void addMessage(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>);
-
 void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack)
 {
     addMessage(source, type, level, message, String(), 0, callStack);
@@ -137,6 +139,10 @@
 
 void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack> callStack)
 {
+
+    if (muteCount && source != ConsoleAPIMessageSource)
+        return;
+
     Page* page = this->page();
     if (!page)
         return;
@@ -211,6 +217,11 @@
     addMessage(LogMessageType, LogMessageLevel, arguments, callStack);
 }
 
+void Console::warn(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
+{
+    addMessage(LogMessageType, WarningMessageLevel, arguments, callStack);
+}
+
 void Console::dir(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
 {
     addMessage(DirMessageType, LogMessageLevel, arguments, callStack);
@@ -331,11 +342,19 @@
     InspectorInstrumentation::addMessageToConsole(page(), ConsoleAPIMessageSource, EndGroupMessageType, LogMessageLevel, String(), String(), 0);
 }
 
-void Console::warn(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
+// static
+void Console::mute()
 {
-    addMessage(LogMessageType, WarningMessageLevel, arguments, callStack);
+    muteCount++;
 }
 
+// static
+void Console::unmute()
+{
+    ASSERT(muteCount > 0);
+    muteCount--;
+}
+
 PassRefPtr<MemoryInfo> Console::memory() const
 {
     // FIXME: Because we create a new object here each time,

Modified: trunk/Source/WebCore/page/Console.h (114631 => 114632)


--- trunk/Source/WebCore/page/Console.h	2012-04-19 15:26:32 UTC (rev 114631)
+++ trunk/Source/WebCore/page/Console.h	2012-04-19 15:34:31 UTC (rev 114632)
@@ -81,6 +81,9 @@
     void groupCollapsed(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
     void groupEnd();
 
+    static void mute();
+    static void unmute();
+
     static bool shouldPrintExceptions();
     static void setShouldPrintExceptions(bool);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to