[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

yurys at chromium.org yurys at chromium.org
Wed Dec 22 11:24:40 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b9e20212d4b630ea4df1408c234c2ced243e78a6
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 22 14:33:54 2010 +0000

    2010-07-22  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: should be possible to convert console message arguments to InspectorValues
            https://bugs.webkit.org/show_bug.cgi?id=42457
    
            Now it is possible to convert simple JavaScript objects to
            InspectorValues.
    
            * bindings/js/ScriptValue.cpp:
            (WebCore::jsToInspectorValue):
            (WebCore::ScriptValue::toInspectorValue):
            * bindings/js/ScriptValue.h:
            * bindings/v8/ScriptValue.cpp:
            (WebCore::v8ToInspectorValue):
            (WebCore::ScriptValue::toInspectorValue):
            * bindings/v8/ScriptValue.h:
            * inspector/ConsoleMessage.cpp: console notifications are pushed to RemoteInspectorFrontend instead of InspectorFrontend.
            (WebCore::ConsoleMessage::CallFrame::buildInspectorObject):
            (WebCore::ConsoleMessage::addToFrontend):
            (WebCore::ConsoleMessage::updateRepeatCountInConsole):
            * inspector/ConsoleMessage.h:
            * inspector/InjectedScript.cpp:
            (WebCore::InjectedScript::wrapForConsole): return InspectorValue instead of SerializedScriptValue
            * inspector/InjectedScript.h:
            * inspector/Inspector.idl:
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::clearConsoleMessages): send response directly from the backend
            (WebCore::InspectorBackend::remoteFrontend):
            * inspector/InspectorBackend.h:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::addConsoleMessage):
            (WebCore::InspectorController::clearConsoleMessages): don't send notification to the front end,
            it will be send either from InspectorBackend.cpp if it was a user request or reset message will
            be send to the front end if the messages are cleared due to page navigation.
            (WebCore::InspectorController::populateScriptObjects):
            * inspector/front-end/ConsoleView.js:
            * inspector/front-end/inspector.js:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 908a1bf..8c63a54 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2010-07-22  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: should be possible to convert console message arguments to InspectorValues
+        https://bugs.webkit.org/show_bug.cgi?id=42457
+
+        Now it is possible to convert simple JavaScript objects to
+        InspectorValues.
+
+        * bindings/js/ScriptValue.cpp:
+        (WebCore::jsToInspectorValue):
+        (WebCore::ScriptValue::toInspectorValue):
+        * bindings/js/ScriptValue.h:
+        * bindings/v8/ScriptValue.cpp:
+        (WebCore::v8ToInspectorValue):
+        (WebCore::ScriptValue::toInspectorValue):
+        * bindings/v8/ScriptValue.h:
+        * inspector/ConsoleMessage.cpp: console notifications are pushed to RemoteInspectorFrontend instead of InspectorFrontend.
+        (WebCore::ConsoleMessage::CallFrame::buildInspectorObject):
+        (WebCore::ConsoleMessage::addToFrontend):
+        (WebCore::ConsoleMessage::updateRepeatCountInConsole):
+        * inspector/ConsoleMessage.h:
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::wrapForConsole): return InspectorValue instead of SerializedScriptValue
+        * inspector/InjectedScript.h:
+        * inspector/Inspector.idl:
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::clearConsoleMessages): send response directly from the backend
+        (WebCore::InspectorBackend::remoteFrontend):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::addConsoleMessage):
+        (WebCore::InspectorController::clearConsoleMessages): don't send notification to the front end,
+        it will be send either from InspectorBackend.cpp if it was a user request or reset message will
+        be send to the front end if the messages are cleared due to page navigation.
+        (WebCore::InspectorController::populateScriptObjects):
+        * inspector/front-end/ConsoleView.js:
+        * inspector/front-end/inspector.js:
+
 2010-07-22  Alexander Pavlov  <apavlov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index a52024d..44c6828 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "ScriptValue.h"
 
+#include "InspectorValues.h"
 #include "SerializedScriptValue.h"
 
 #include <JavaScriptCore/APICast.h>
@@ -93,4 +94,60 @@ ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptV
     return ScriptValue(value->deserialize(scriptState, scriptState->lexicalGlobalObject()));
 }
 
+static PassRefPtr<InspectorValue> jsToInspectorValue(ScriptState* scriptState, JSValue value)
+{
+    if (!value) {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    if (value.isNull() || value.isUndefined())
+        return InspectorValue::null();
+    if (value.isBoolean())
+        return InspectorBasicValue::create(value.getBoolean());
+    if (value.isNumber())
+        return InspectorBasicValue::create(value.uncheckedGetNumber());
+    if (value.isString()) {
+        UString s = value.getString(scriptState);
+        return InspectorString::create(String(s.data(), s.size()));
+    }
+    if (value.isObject()) {
+        if (isJSArray(&scriptState->globalData(), value)) {
+            RefPtr<InspectorArray> inspectorArray = InspectorArray::create();
+            JSArray* array = asArray(value);
+            unsigned length = array->length();
+            for (unsigned i = 0; i < length; i++) {
+                JSValue element = array->getIndex(i);
+                RefPtr<InspectorValue> elementValue = jsToInspectorValue(scriptState, element);
+                if (!elementValue) {
+                    ASSERT_NOT_REACHED();
+                    elementValue = InspectorValue::null();
+                }
+                inspectorArray->push(elementValue);
+            }
+            return inspectorArray;
+        }
+        RefPtr<InspectorObject> inspectorObject = InspectorObject::create();
+        JSObject* object = value.getObject();
+        PropertyNameArray propertyNames(scriptState);
+        object->getOwnPropertyNames(scriptState, propertyNames);
+        for (size_t i = 0; i < propertyNames.size(); i++) {
+            const Identifier& name =  propertyNames[i];
+            JSValue propertyValue = object->get(scriptState, name);
+            RefPtr<InspectorValue> inspectorValue = jsToInspectorValue(scriptState, propertyValue);
+            if (!inspectorValue) {
+                ASSERT_NOT_REACHED();
+                inspectorValue = InspectorValue::null();
+            }
+            inspectorObject->set(String(name.data(), name.size()), inspectorValue);
+        }
+        return inspectorObject;
+    }
+    return 0;
+}
+
+PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptState) const
+{
+    return jsToInspectorValue(scriptState, m_value.get());
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index f4f9c68..21ad01c 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -40,6 +40,7 @@
 
 namespace WebCore {
 
+class InspectorValue;
 class SerializedScriptValue;
 
 class ScriptValue {
@@ -61,6 +62,8 @@ public:
 
     static ScriptValue undefined() { return ScriptValue(JSC::jsUndefined()); }
 
+    PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const;
+
 private:
     JSC::ProtectedJSValue m_value;
 };
diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp
index 3aca3c1..449d171 100755
--- a/WebCore/bindings/v8/ScriptValue.cpp
+++ b/WebCore/bindings/v8/ScriptValue.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "ScriptValue.h"
 
+#include "InspectorValues.h"
 #include "ScriptScope.h"
 #include "SerializedScriptValue.h"
 #include "V8Binding.h"
@@ -66,4 +67,60 @@ String ScriptValue::toString(ScriptState*) const
     return toWebCoreString(m_value);
 }
 
+static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value)
+{
+    if (value.IsEmpty()) {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    if (value->IsNull() || value->IsUndefined())
+        return InspectorValue::null();
+    if (value->IsBoolean())
+        return InspectorBasicValue::create(value->BooleanValue());
+    if (value->IsNumber())
+        return InspectorBasicValue::create(value->NumberValue());
+    if (value->IsString())
+        return InspectorString::create(toWebCoreString(value));
+    if (value->IsArray()) {
+        v8::HandleScope handleScope;
+        v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value);
+        RefPtr<InspectorArray> inspectorArray = InspectorArray::create();
+        uint32_t length = array->Length();
+        for (uint32_t i = 0; i < length; i++) {
+            v8::Local<v8::Value> value = array->Get(v8::Int32::New(i));
+            RefPtr<InspectorValue> element = v8ToInspectorValue(value);
+            if (!element) {
+                ASSERT_NOT_REACHED();
+                element = InspectorValue::null();
+            }
+            inspectorArray->push(element);
+        }
+        return inspectorArray;
+    }
+    if (value->IsObject()) {
+        RefPtr<InspectorObject> inspectorObject = InspectorObject::create();
+
+        v8::HandleScope handleScope;
+        v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+        v8::Local<v8::Array> propertyNames = object->GetPropertyNames();
+        uint32_t length = propertyNames->Length();
+        for (uint32_t i = 0; i < length; i++) {
+            v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(i));
+            RefPtr<InspectorValue> propertyValue = v8ToInspectorValue(object->Get(name));
+            if (!propertyValue) {
+                ASSERT_NOT_REACHED();
+                continue;
+            }
+            inspectorObject->set(toWebCoreStringWithNullCheck(name), propertyValue);
+        }
+        return inspectorObject;
+    }
+    return 0;
+}
+
+PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState*) const
+{
+    return v8ToInspectorValue(m_value);
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 8241205..1743da0 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -43,6 +43,7 @@
 
 namespace WebCore {
 
+class InspectorValue;
 class SerializedScriptValue;
 
 class ScriptValue {
@@ -151,6 +152,8 @@ public:
     bool getString(String& result) const;
     String toString(ScriptState*) const;
 
+    PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const;
+
 private:
     mutable v8::Persistent<v8::Value> m_value;
 };
diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp
index 79b5115..aa0b1c0 100644
--- a/WebCore/inspector/ConsoleMessage.cpp
+++ b/WebCore/inspector/ConsoleMessage.cpp
@@ -34,9 +34,10 @@
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
 #include "InspectorFrontend.h"
+#include "InspectorValues.h"
+#include "RemoteInspectorFrontend.h"
 #include "ScriptCallStack.h"
 #include "ScriptObject.h"
-#include "SerializedScriptValue.h"
 
 namespace WebCore {
 
@@ -59,12 +60,12 @@ bool ConsoleMessage::CallFrame::isEqual(const ConsoleMessage::CallFrame& o) cons
         && m_lineNumber == o.m_lineNumber;
 }
 
-ScriptObject ConsoleMessage::CallFrame::buildObject(InspectorFrontend* frontend) const
+PassRefPtr<InspectorObject> ConsoleMessage::CallFrame::buildInspectorObject() const
 {
-    ScriptObject frame = frontend->newScriptObject();
-    frame.set("functionName", m_functionName);
-    frame.set("sourceURL", m_sourceURL.string());
-    frame.set("lineNumber", m_lineNumber);
+    RefPtr<InspectorObject> frame = InspectorObject::create();
+    frame->setString("functionName", m_functionName);
+    frame->setString("sourceURL", m_sourceURL.string());
+    frame->setNumber("lineNumber", m_lineNumber);
     return frame;
 }
 
@@ -109,39 +110,40 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c
 }
 
 #if ENABLE(INSPECTOR)
-void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
+void ConsoleMessage::addToFrontend(RemoteInspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
 {
-    ScriptObject jsonObj = frontend->newScriptObject();
-    jsonObj.set("source", static_cast<int>(m_source));
-    jsonObj.set("type", static_cast<int>(m_type));
-    jsonObj.set("level", static_cast<int>(m_level));
-    jsonObj.set("line", static_cast<int>(m_line));
-    jsonObj.set("url", m_url);
-    jsonObj.set("groupLevel", static_cast<int>(m_groupLevel));
-    jsonObj.set("repeatCount", static_cast<int>(m_repeatCount));
-    jsonObj.set("message", m_message);
+    RefPtr<InspectorObject> jsonObj = InspectorObject::create();
+    jsonObj->setNumber("source", static_cast<int>(m_source));
+    jsonObj->setNumber("type", static_cast<int>(m_type));
+    jsonObj->setNumber("level", static_cast<int>(m_level));
+    jsonObj->setNumber("line", static_cast<int>(m_line));
+    jsonObj->setString("url", m_url);
+    jsonObj->setNumber("groupLevel", static_cast<int>(m_groupLevel));
+    jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount));
+    jsonObj->setString("message", m_message);
     if (!m_arguments.isEmpty()) {
-        ScriptArray jsonArgs = frontend->newScriptArray();
+        RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
         InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get());
         for (unsigned i = 0; i < m_arguments.size(); ++i) {
-            RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(m_arguments[i]);
-            if (!jsonArgs.set(i, serializedValue.get())) {
+            RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments[i]);
+            if (!inspectorValue) {
                 ASSERT_NOT_REACHED();
                 return;
             }
+            jsonArgs->push(inspectorValue);
         }
-        jsonObj.set("parameters", jsonArgs);
+        jsonObj->set("parameters", jsonArgs);
     }
     if (!m_frames.isEmpty()) {
-        ScriptArray frames = frontend->newScriptArray();
+        RefPtr<InspectorArray> frames = InspectorArray::create();
         for (unsigned i = 0; i < m_frames.size(); i++)
-            frames.set(i, m_frames.at(i).buildObject(frontend));
-        jsonObj.set("stackTrace", frames);
+            frames->push(m_frames.at(i).buildInspectorObject());
+        jsonObj->set("stackTrace", frames);
     }
     frontend->addConsoleMessage(jsonObj);
 }
 
-void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend)
+void ConsoleMessage::updateRepeatCountInConsole(RemoteInspectorFrontend* frontend)
 {
     frontend->updateConsoleMessageRepeatCount(m_repeatCount);
 }
diff --git a/WebCore/inspector/ConsoleMessage.h b/WebCore/inspector/ConsoleMessage.h
index 3848dbf..81d32b9 100644
--- a/WebCore/inspector/ConsoleMessage.h
+++ b/WebCore/inspector/ConsoleMessage.h
@@ -40,7 +40,8 @@
 
 namespace WebCore {
 class InjectedScriptHost;
-class InspectorFrontend;
+class InspectorObject;
+class RemoteInspectorFrontend;
 class ScriptCallFrame;
 class ScriptCallStack;
 class ScriptString;
@@ -51,8 +52,8 @@ public:
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, ScriptCallStack*, unsigned g, bool storeTrace = false);
 
 #if ENABLE(INSPECTOR)
-    void addToFrontend(InspectorFrontend*, InjectedScriptHost*);
-    void updateRepeatCountInConsole(InspectorFrontend* frontend);
+    void addToFrontend(RemoteInspectorFrontend*, InjectedScriptHost*);
+    void updateRepeatCountInConsole(RemoteInspectorFrontend* frontend);
 #endif
     void incrementCount() { ++m_repeatCount; }
     bool isEqual(ScriptState*, ConsoleMessage* msg) const;
@@ -66,7 +67,7 @@ private:
         explicit CallFrame(const ScriptCallFrame& frame);
         CallFrame();
         bool isEqual(const CallFrame& o) const;
-        ScriptObject buildObject(InspectorFrontend* frontend) const;
+        PassRefPtr<InspectorObject> buildInspectorObject() const;
 
     private:
         String m_functionName;
diff --git a/WebCore/inspector/InjectedScript.cpp b/WebCore/inspector/InjectedScript.cpp
index 2e35e4b..5f2fb74 100644
--- a/WebCore/inspector/InjectedScript.cpp
+++ b/WebCore/inspector/InjectedScript.cpp
@@ -33,6 +33,7 @@
 
 #if ENABLE(INSPECTOR)
 
+#include "InspectorValues.h"
 #include "PlatformString.h"
 #include "SerializedScriptValue.h"
 #include "ScriptFunctionCall.h"
@@ -73,7 +74,7 @@ PassRefPtr<SerializedScriptValue> InjectedScript::callFrames()
 }
 #endif
 
-PassRefPtr<SerializedScriptValue> InjectedScript::wrapForConsole(ScriptValue value)
+PassRefPtr<InspectorValue> InjectedScript::wrapForConsole(ScriptValue value)
 {
     ASSERT(!hasNoValue());
     ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObjectForConsole");
@@ -82,8 +83,8 @@ PassRefPtr<SerializedScriptValue> InjectedScript::wrapForConsole(ScriptValue val
     bool hadException = false;
     ScriptValue r = wrapFunction.call(hadException);
     if (hadException)
-        return SerializedScriptValue::create("<exception>");
-    return r.serialize(m_injectedScriptObject.scriptState());
+        return InspectorString::create("<exception>");
+    return r.toInspectorValue(m_injectedScriptObject.scriptState());
 }
 
 void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup)
diff --git a/WebCore/inspector/InjectedScript.h b/WebCore/inspector/InjectedScript.h
index 1e9b787..f6b6e19 100644
--- a/WebCore/inspector/InjectedScript.h
+++ b/WebCore/inspector/InjectedScript.h
@@ -38,6 +38,7 @@
 
 namespace WebCore {
 
+class InspectorValue;
 class SerializedScriptValue;
 class String;
 
@@ -52,7 +53,7 @@ public:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     PassRefPtr<SerializedScriptValue> callFrames();
 #endif
-    PassRefPtr<SerializedScriptValue> wrapForConsole(ScriptValue);
+    PassRefPtr<InspectorValue> wrapForConsole(ScriptValue);
     void releaseWrapperObjectGroup(const String&);
 
 private:
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index 84a56fc..155bfcd 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -32,6 +32,7 @@
 
 module core {
     interface [Conditional=INSPECTOR] Inspector {
+        [notify] void addConsoleMessage(out Object messageObj);
         [notify] void addRecordToTimeline(out Object record);
         [notify] void addNodesToSearchResult(out Array nodeIds);
         [notify] void attributesUpdated(out long id, out Array attributes);
@@ -41,6 +42,8 @@ module core {
         [notify] void setChildNodes(out long parentId, out Array nodes);
         [notify] void setDetachedRoot(out Object root);
         [notify] void setDocument(out Value root);
+        [notify] void updateConsoleMessageExpiredCount(out unsigned long count);
+        [notify] void updateConsoleMessageRepeatCount(out unsigned long count);
 
         void storeLastActivePanel(in String panelName);
 
@@ -117,7 +120,7 @@ module core {
         void searchCanceled();
         void pushNodeByPathToFrontend(in long callId, in String path, out long nodeId);
 
-        void clearConsoleMessages();
+        void clearConsoleMessages(in long callId);
 
         void highlightDOMNode(in long nodeId);
         void hideDOMNodeHighlight();
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 5bcc052..f27b812 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -49,6 +49,7 @@
 #include "InspectorResource.h"
 #include "Page.h"
 #include "Pasteboard.h"
+#include "RemoteInspectorFrontend.h"
 #include "ScriptArray.h"
 #include "ScriptBreakpoint.h"
 #include "SerializedScriptValue.h"
@@ -412,10 +413,13 @@ void InspectorBackend::pushNodeByPathToFrontend(long callId, const String& path)
         domAgent->pushNodeByPathToFrontend(callId, path);
 }
 
-void InspectorBackend::clearConsoleMessages()
+void InspectorBackend::clearConsoleMessages(long callId)
 {
-    if (m_inspectorController)
+    if (m_inspectorController) {
         m_inspectorController->clearConsoleMessages();
+        if (RemoteInspectorFrontend* frontend = remoteFrontend())
+            frontend->didClearConsoleMessages(callId);
+    }
 }
 
 void InspectorBackend::getStyles(long callId, long nodeId, bool authorOnly)
@@ -597,6 +601,13 @@ InspectorFrontend* InspectorBackend::inspectorFrontend()
     return m_inspectorController->m_frontend.get();
 }
 
+RemoteInspectorFrontend* InspectorBackend::remoteFrontend()
+{
+    if (!m_inspectorController)
+        return 0;
+    return m_inspectorController->m_remoteFrontend.get();
+}
+
 void InspectorBackend::addScriptToEvaluateOnLoad(const String& source)
 {
     if (m_inspectorController)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index b5f1f16..16d53c0 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -43,6 +43,7 @@ class InspectorApplicationCacheAgent;
 class InspectorDOMAgent;
 class InspectorFrontend;
 class Node;
+class RemoteInspectorFrontend;
 class Storage;
 
 class InspectorBackend : public RefCounted<InspectorBackend>
@@ -133,7 +134,7 @@ public:
     void searchCanceled();
     void pushNodeByPathToFrontend(long callId, const String& path);
 
-    void clearConsoleMessages();
+    void clearConsoleMessages(long callId);
 
     void getStyles(long callId, long nodeId, bool authOnly);
     void getAllStyles(long callId);
@@ -179,6 +180,7 @@ private:
     InspectorApplicationCacheAgent* inspectorApplicationCacheAgent();
 #endif
     InspectorFrontend* inspectorFrontend();
+    RemoteInspectorFrontend* remoteFrontend();
     Node* nodeForId(long nodeId);
 
     InspectorController* m_inspectorController;
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 5ac61ab..5941358 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -107,7 +107,7 @@ module core {
         void searchCanceled();
         void pushNodeByPathToFrontend(in long callId, in DOMString path);
 
-        void clearConsoleMessages();
+        void clearConsoleMessages(in long callId);
 
         void highlightDOMNode(in long nodeId);
         void hideDOMNodeHighlight();
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 8879b8e..18b95ab 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -363,12 +363,12 @@ void InspectorController::addConsoleMessage(ScriptState* scriptState, PassOwnPtr
     if (m_previousMessage && m_previousMessage->isEqual(scriptState, consoleMessage.get())) {
         m_previousMessage->incrementCount();
         if (m_frontend)
-            m_previousMessage->updateRepeatCountInConsole(m_frontend.get());
+            m_previousMessage->updateRepeatCountInConsole(m_remoteFrontend.get());
     } else {
         m_previousMessage = consoleMessage.get();
         m_consoleMessages.append(consoleMessage);
         if (m_frontend)
-            m_previousMessage->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
+            m_previousMessage->addToFrontend(m_remoteFrontend.get(), m_injectedScriptHost.get());
     }
 
     if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
@@ -386,8 +386,6 @@ void InspectorController::clearConsoleMessages()
     m_injectedScriptHost->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console");
     if (m_domAgent)
         m_domAgent->releaseDanglingNodes();
-    if (m_frontend)
-        m_frontend->clearConsoleMessages();
 }
 
 void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack, bool collapsed)
@@ -656,10 +654,10 @@ void InspectorController::populateScriptObjects()
     m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
 
     if (m_expiredConsoleMessageCount)
-        m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
+        m_remoteFrontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
     unsigned messageCount = m_consoleMessages.size();
     for (unsigned i = 0; i < messageCount; ++i)
-        m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
+        m_consoleMessages[i]->addToFrontend(m_remoteFrontend.get(), m_injectedScriptHost.get());
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     if (m_debuggerEnabled)
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index d4119a1..e16c89e 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -296,7 +296,7 @@ WebInspector.ConsoleView.prototype = {
 
     requestClearMessages: function()
     {
-        InspectorBackend.clearConsoleMessages();
+        InspectorBackend.clearConsoleMessages(WebInspector.Callback.wrap(this.clearMessages.bind(this)));
     },
 
     clearMessages: function()
@@ -1127,3 +1127,5 @@ WebInspector.ConsoleGroup.prototype = {
         event.preventDefault();
     }
 }
+
+WebInspector.didClearConsoleMessages = WebInspector.Callback.processCallback;
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 5ec7081..0adf057 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1129,11 +1129,6 @@ WebInspector.showAuditsPanel = function()
     this.currentPanel = this.panels.audits;
 }
 
-WebInspector.clearConsoleMessages = function()
-{
-    WebInspector.console.clearMessages();
-}
-
 WebInspector.selectDatabase = function(o)
 {
     WebInspector.showStoragePanel();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list