WebCore:
authorbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jul 2009 05:08:46 +0000 (05:08 +0000)
committerbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jul 2009 05:08:46 +0000 (05:08 +0000)
2009-07-12  Keishi Hattori  <casey.hattori@gmail.com>

        Reviewed by Timothy Hatcher.

        Refactor ConsoleMessage to add MessageType attribute.
        https://bugs.webkit.org/show_bug.cgi?id=20625

        * bindings/js/JSCustomXPathNSResolver.cpp:
        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
        * bindings/js/JSDOMWindowBase.cpp:
        (WebCore::JSDOMWindowBase::printErrorMessage):
        * dom/Document.cpp:
        (WebCore::Document::reportException):
        (WebCore::Document::addMessage):
        * dom/Document.h:
        * dom/ScriptExecutionContext.h:
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::reportErrorToConsole):
        * inspector/ConsoleMessage.cpp:
        (WebCore::ConsoleMessage::ConsoleMessage):
        (WebCore::ConsoleMessage::addToConsole):
        (WebCore::ConsoleMessage::isEqual):
        * inspector/ConsoleMessage.h:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::addMessageToConsole):
        (WebCore::InspectorController::startGroup):
        (WebCore::InspectorController::endGroup):
        (WebCore::InspectorController::addProfileFinishedMessageToConsole):
        (WebCore::InspectorController::addStartProfilingMessageToConsole):
        (WebCore::InspectorController::count):
        * inspector/InspectorController.h:
        * inspector/front-end/Console.js:
        (WebInspector.Console.prototype.addMessage):
        (WebInspector.ConsoleMessage): Added type property.
        (WebInspector.ConsoleMessage.prototype.toMessageElement):
        (WebInspector.ConsoleMessage.prototype.toString):
        (WebInspector.ConsoleMessage.prototype.isEqual):
        (WebInspector.ConsoleCommandResult):
        (WebInspector.ConsoleGroup.prototype.addMessage):
        (WebInspector.ConsoleGroup.prototype._titleClicked):
        * inspector/front-end/Resource.js:
        (WebInspector.Resource.prototype._addTip):
        (WebInspector.Resource.prototype._checkWarning):
        * inspector/front-end/inspector.css: Changed ".console-group-title-level" to ".console-group-title"
        * inspector/front-end/inspector.js:
        (WebInspector.addMessageToConsole):
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::printAccessDeniedMessage):
        * loader/EmptyClients.h:
        (WebCore::EmptyChromeClient::addMessageToConsole):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::reportLocalLoadFailed):
        (WebCore::FrameLoader::shouldAllowNavigation):
        * page/ChromeClient.h:
        * page/Console.cpp:
        (WebCore::printMessageSourceAndLevelPrefix):
        (WebCore::Console::addMessage):
        (WebCore::Console::error):
        (WebCore::Console::log):
        (WebCore::Console::dir):
        (WebCore::Console::trace):
        (WebCore::Console::assertCondition):
        (WebCore::Console::timeEnd):
        (WebCore::Console::warn):
        * page/Console.h: Added MessageType enum.
        (WebCore::):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::postMessageTimerFired):
        * page/XSSAuditor.cpp:
        (WebCore::XSSAuditor::canEvaluate):
        (WebCore::XSSAuditor::canLoadExternalScriptFromSrc):
        (WebCore::XSSAuditor::canLoadObject):
        * svg/SVGDocumentExtensions.cpp:
        (WebCore::SVGDocumentExtensions::reportWarning):
        (WebCore::SVGDocumentExtensions::reportError):
        * wml/WMLErrorHandling.cpp:
        (WebCore::reportWMLError):
        * workers/GenericWorkerTask.h: Added GenericWorkerTask8 for the extra argument.
        (WebCore::GenericWorkerTask8::create):
        (WebCore::GenericWorkerTask8::GenericWorkerTask8):
        (WebCore::GenericWorkerTask8::performTask):
        (WebCore::createCallbackTask):
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::addMessage):
        (WebCore::WorkerContext::importScripts):
        * workers/WorkerContext.h:
        * workers/WorkerMessagingProxy.cpp:
        (WebCore::postConsoleMessageTask):
        (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
        * workers/WorkerMessagingProxy.h:
        * workers/WorkerObjectProxy.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::reportUnsafeUsage):
        (WebCore::XMLHttpRequest::didFinishLoading):
        * xml/XSLTProcessor.cpp:
        (WebCore::XSLTProcessor::parseErrorFunc):

WebKit/mac:

2009-07-12  Keishi Hattori  <casey.hattori@gmail.com>

        Reviewed by Timothy Hatcher.

        Refactor ConsoleMessage to add MessageType attribute.
        https://bugs.webkit.org/show_bug.cgi?id=20625

        * WebCoreSupport/WebChromeClient.h:
        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::addMessageToConsole):

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

36 files changed:
WebCore/ChangeLog
WebCore/bindings/js/JSCustomXPathNSResolver.cpp
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/ScriptExecutionContext.h
WebCore/html/HTMLParser.cpp
WebCore/inspector/ConsoleMessage.cpp
WebCore/inspector/ConsoleMessage.h
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/front-end/Console.js
WebCore/inspector/front-end/Resource.js
WebCore/inspector/front-end/inspector.css
WebCore/inspector/front-end/inspector.js
WebCore/loader/DocLoader.cpp
WebCore/loader/EmptyClients.h
WebCore/loader/FrameLoader.cpp
WebCore/page/ChromeClient.h
WebCore/page/Console.cpp
WebCore/page/Console.h
WebCore/page/DOMWindow.cpp
WebCore/page/XSSAuditor.cpp
WebCore/svg/SVGDocumentExtensions.cpp
WebCore/wml/WMLErrorHandling.cpp
WebCore/workers/GenericWorkerTask.h
WebCore/workers/WorkerContext.cpp
WebCore/workers/WorkerContext.h
WebCore/workers/WorkerMessagingProxy.cpp
WebCore/workers/WorkerMessagingProxy.h
WebCore/workers/WorkerObjectProxy.h
WebCore/xml/XMLHttpRequest.cpp
WebCore/xml/XSLTProcessor.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebChromeClient.h
WebKit/mac/WebCoreSupport/WebChromeClient.mm

index 9fe9b66..ec3c770 100644 (file)
@@ -1,3 +1,100 @@
+2009-07-12  Keishi Hattori  <casey.hattori@gmail.com>
+
+        Reviewed by Timothy Hatcher.
+
+        Refactor ConsoleMessage to add MessageType attribute.
+        https://bugs.webkit.org/show_bug.cgi?id=20625
+
+        * bindings/js/JSCustomXPathNSResolver.cpp:
+        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::printErrorMessage):
+        * dom/Document.cpp:
+        (WebCore::Document::reportException):
+        (WebCore::Document::addMessage):
+        * dom/Document.h:
+        * dom/ScriptExecutionContext.h:
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::reportErrorToConsole):
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::ConsoleMessage::ConsoleMessage):
+        (WebCore::ConsoleMessage::addToConsole):
+        (WebCore::ConsoleMessage::isEqual):
+        * inspector/ConsoleMessage.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::addMessageToConsole):
+        (WebCore::InspectorController::startGroup):
+        (WebCore::InspectorController::endGroup):
+        (WebCore::InspectorController::addProfileFinishedMessageToConsole):
+        (WebCore::InspectorController::addStartProfilingMessageToConsole):
+        (WebCore::InspectorController::count):
+        * inspector/InspectorController.h:
+        * inspector/front-end/Console.js:
+        (WebInspector.Console.prototype.addMessage):
+        (WebInspector.ConsoleMessage): Added type property.
+        (WebInspector.ConsoleMessage.prototype.toMessageElement):
+        (WebInspector.ConsoleMessage.prototype.toString):
+        (WebInspector.ConsoleMessage.prototype.isEqual):
+        (WebInspector.ConsoleCommandResult):
+        (WebInspector.ConsoleGroup.prototype.addMessage):
+        (WebInspector.ConsoleGroup.prototype._titleClicked):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype._addTip):
+        (WebInspector.Resource.prototype._checkWarning):
+        * inspector/front-end/inspector.css: Changed ".console-group-title-level" to ".console-group-title"
+        * inspector/front-end/inspector.js:
+        (WebInspector.addMessageToConsole):
+        * loader/DocLoader.cpp:
+        (WebCore::DocLoader::printAccessDeniedMessage):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyChromeClient::addMessageToConsole):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::reportLocalLoadFailed):
+        (WebCore::FrameLoader::shouldAllowNavigation):
+        * page/ChromeClient.h:
+        * page/Console.cpp:
+        (WebCore::printMessageSourceAndLevelPrefix):
+        (WebCore::Console::addMessage):
+        (WebCore::Console::error):
+        (WebCore::Console::log):
+        (WebCore::Console::dir):
+        (WebCore::Console::trace):
+        (WebCore::Console::assertCondition):
+        (WebCore::Console::timeEnd):
+        (WebCore::Console::warn):
+        * page/Console.h: Added MessageType enum.
+        (WebCore::):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessageTimerFired):
+        * page/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::canEvaluate):
+        (WebCore::XSSAuditor::canLoadExternalScriptFromSrc):
+        (WebCore::XSSAuditor::canLoadObject):
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::reportWarning):
+        (WebCore::SVGDocumentExtensions::reportError):
+        * wml/WMLErrorHandling.cpp:
+        (WebCore::reportWMLError):
+        * workers/GenericWorkerTask.h: Added GenericWorkerTask8 for the extra argument.
+        (WebCore::GenericWorkerTask8::create):
+        (WebCore::GenericWorkerTask8::GenericWorkerTask8):
+        (WebCore::GenericWorkerTask8::performTask):
+        (WebCore::createCallbackTask):
+        * workers/WorkerContext.cpp:
+        (WebCore::WorkerContext::addMessage):
+        (WebCore::WorkerContext::importScripts):
+        * workers/WorkerContext.h:
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::postConsoleMessageTask):
+        (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
+        * workers/WorkerMessagingProxy.h:
+        * workers/WorkerObjectProxy.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::reportUnsafeUsage):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        * xml/XSLTProcessor.cpp:
+        (WebCore::XSLTProcessor::parseErrorFunc):
+
 2009-07-12  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 6361e70..ffe8cf5 100644 (file)
@@ -84,7 +84,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
         callType = m_customResolver->getCallData(callData);
         if (callType == CallTypeNone) {
             // FIXME: Pass actual line number and source URL.
-            m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
+            m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
             return String();
         }
         function = m_customResolver;
index 0eefebe..0f419ba 100644 (file)
@@ -99,7 +99,7 @@ void JSDOMWindowBase::printErrorMessage(const String& message) const
     if (settings->privateBrowsingEnabled())
         return;
 
-    impl()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL.
+    impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL.
 }
 
 ExecState* JSDOMWindowBase::globalExec()
index dbc4ecd..3ee00ad 100644 (file)
@@ -4360,19 +4360,19 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl)
 void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
 {
     if (DOMWindow* window = domWindow())
-        window->console()->addMessage(JSMessageSource, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
+        window->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
 }
 
-void Document::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void Document::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
 {
     switch (destination) {
     case InspectorControllerDestination:
         if (page())
-            page()->inspectorController()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+            page()->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
         return;
     case ConsoleDestination:
         if (DOMWindow* window = domWindow())
-            window->console()->addMessage(source, level, message, lineNumber, sourceURL);
+            window->console()->addMessage(source, type, level, message, lineNumber, sourceURL);
         return;
     }
     ASSERT_NOT_REACHED();
index e011c91..82f0455 100644 (file)
@@ -787,7 +787,7 @@ public:
     void parseDNSPrefetchControlHeader(const String&);
 
     virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
-    virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+    virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
     virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
     virtual void scriptImported(unsigned long, const String&);
     virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
index 7b2f36a..3f8febc 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
         SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
 
         virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
-        virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
+        virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
         virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) = 0;
         virtual void scriptImported(unsigned long, const String&) = 0;
         
index 6693b49..722f4e2 100644 (file)
@@ -1672,7 +1672,7 @@ void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const Atomi
     message.replace("%tag1", tag1);
     message.replace("%tag2", tag2);
 
-    frame->domWindow()->console()->addMessage(HTMLMessageSource,
+    frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, 
         isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel,
         message, lineNumber, m_document->url().string());
 }
index b3c0218..609197e 100644 (file)
@@ -38,8 +38,9 @@
 
 namespace WebCore {
 
-ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, unsigned li, const String& u, unsigned g)
     : m_source(s)
+    , m_type(t)
     , m_level(l)
     , m_message(m)
     , m_line(li)
@@ -49,8 +50,9 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, const String& m,
 {
 }
 
-ConsoleMessage::ConsoleMessage(MessageSource s, MessageLevel l, ScriptCallStack* callStack, unsigned g, bool storeTrace)
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, ScriptCallStack* callStack, unsigned g, bool storeTrace)
     : m_source(s)
+    , m_type(t)
     , m_level(l)
     , m_wrappedArguments(callStack->at(0).argumentCount())
     , m_frames(storeTrace ? callStack->size() : 0)
@@ -77,6 +79,7 @@ void ConsoleMessage::addToConsole(InspectorFrontend* frontend)
 {
     InspectorJSONObject jsonObj = frontend->newInspectorJSONObject();
     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);
@@ -109,6 +112,7 @@ bool ConsoleMessage::isEqual(ScriptState* state, ConsoleMessage* msg) const
     }
 
     return msg->m_source == m_source
+        && msg->m_type == m_type
         && msg->m_level == m_level
         && msg->m_message == m_message
         && msg->m_line == m_line
index 15e6e7e..5b2f7d5 100644 (file)
@@ -44,8 +44,8 @@ namespace WebCore {
 
     class ConsoleMessage {
     public:
-        ConsoleMessage(MessageSource, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);        
-        ConsoleMessage(MessageSource, MessageLevel, ScriptCallStack*, unsigned g, bool storeTrace = false);
+        ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g);        
+        ConsoleMessage(MessageSource, MessageType, MessageLevel, ScriptCallStack*, unsigned g, bool storeTrace = false);
 
         void addToConsole(InspectorFrontend* frontend);
         void incrementCount() { ++m_repeatCount; };
@@ -53,6 +53,7 @@ namespace WebCore {
 
     private:
         MessageSource m_source;
+        MessageType m_type;
         MessageLevel m_level;
         String m_message;
         Vector<ScriptValue> m_wrappedArguments;
index 4271110..4b2dd59 100644 (file)
@@ -395,20 +395,20 @@ void InspectorController::setWindowVisible(bool visible, bool attached)
     m_showAfterVisible = CurrentPanel;
 }
 
-void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, ScriptCallStack* callStack)
+void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, ScriptCallStack* callStack)
 {
     if (!enabled())
         return;
 
-    addConsoleMessage(callStack->state(), new ConsoleMessage(source, level, callStack, m_groupLevel, level == TraceMessageLevel));
+    addConsoleMessage(callStack->state(), new ConsoleMessage(source, type, level, callStack, m_groupLevel, type == TraceMessageType));
 }
 
-void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
 {
     if (!enabled())
         return;
 
-    addConsoleMessage(0, new ConsoleMessage(source, level, message, lineNumber, sourceID, m_groupLevel));
+    addConsoleMessage(0, new ConsoleMessage(source, type, level, message, lineNumber, sourceID, m_groupLevel));
 }
 
 void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMessage* consoleMessage)
@@ -440,7 +440,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call
 {
     ++m_groupLevel;
 
-    addConsoleMessage(callStack->state(), new ConsoleMessage(source, StartGroupMessageLevel, callStack, m_groupLevel));
+    addConsoleMessage(callStack->state(), new ConsoleMessage(source, StartGroupMessageType, LogMessageLevel, callStack, m_groupLevel));
 }
 
 void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
@@ -450,7 +450,7 @@ void InspectorController::endGroup(MessageSource source, unsigned lineNumber, co
 
     --m_groupLevel;
 
-    addConsoleMessage(0, new ConsoleMessage(source, EndGroupMessageLevel, String(), lineNumber, sourceURL, m_groupLevel));
+    addConsoleMessage(0, new ConsoleMessage(source, EndGroupMessageType, LogMessageLevel, String(), lineNumber, sourceURL, m_groupLevel));
 }
 
 void InspectorController::attachWindow()
@@ -1100,7 +1100,7 @@ void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<Profile>
     message += "/";
     message += UString::from(profile->uid());
     message += "\" finished.";
-    addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceURL);
+    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
 void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL)
@@ -1108,7 +1108,7 @@ void InspectorController::addStartProfilingMessageToConsole(const UString& title
     UString message = "Profile \"webkit-profile://";
     message += encodeWithURLEscapeSequences(title);
     message += "/0\" started.";
-    addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceURL);
+    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
 void InspectorController::addScriptProfile(Profile* profile)
@@ -1508,7 +1508,7 @@ void InspectorController::count(const String& title, unsigned lineNumber, const
     m_counts.add(identifier, count);
 
     String message = String::format("%s: %d", title.utf8().data(), count);
-    addMessageToConsole(JSMessageSource, LogMessageLevel, message, lineNumber, sourceID);
+    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceID);
 }
 
 void InspectorController::startTiming(const String& title)
index 8ba8669..4c90bc5 100644 (file)
@@ -173,8 +173,8 @@ public:
 
     void addResourceSourceToFrame(long identifier, Node* frame);
     bool addSourceToFrame(const String& mimeType, const String& source, Node*);
-    void addMessageToConsole(MessageSource, MessageLevel, ScriptCallStack*);
-    void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
+    void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*);
+    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
     void clearConsoleMessages();
 
     void attachWindow();
index b34061e..ca9ac00 100644 (file)
@@ -198,7 +198,7 @@ WebInspector.Console.prototype = {
 
         this.messages.push(msg);
 
-        if (msg.level === WebInspector.ConsoleMessage.MessageLevel.EndGroup) {
+        if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
             if (this.groupLevel < 1)
                 return;
 
@@ -206,7 +206,7 @@ WebInspector.Console.prototype = {
 
             this.currentGroup = this.currentGroup.parentGroup;
         } else {
-            if (msg.level === WebInspector.ConsoleMessage.MessageLevel.StartGroup) {
+            if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
                 this.groupLevel++;
 
                 var group = new WebInspector.ConsoleGroup(this.currentGroup, this.groupLevel);
@@ -576,23 +576,24 @@ WebInspector.Console.prototype = {
 
 WebInspector.Console.prototype.__proto__ = WebInspector.View.prototype;
 
-WebInspector.ConsoleMessage = function(source, level, line, url, groupLevel, repeatCount)
+WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLevel, repeatCount)
 {
     this.source = source;
+    this.type = type;
     this.level = level;
     this.line = line;
     this.url = url;
     this.groupLevel = groupLevel;
     this.repeatCount = repeatCount;
-    if (arguments.length > 6)
-        this.setMessageBody(Array.prototype.slice.call(arguments, 6));
+    if (arguments.length > 7)
+        this.setMessageBody(Array.prototype.slice.call(arguments, 7));
 }
 
 WebInspector.ConsoleMessage.prototype = {
     setMessageBody: function(args)
     {
-        switch (this.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Trace:
+        switch (this.type) {
+            case WebInspector.ConsoleMessage.MessageType.Trace:
                 var span = document.createElement("span");
                 span.addStyleClass("console-formatted-trace");
                 var stack = Array.prototype.slice.call(args);
@@ -602,7 +603,7 @@ WebInspector.ConsoleMessage.prototype = {
                 span.appendChild(document.createTextNode(funcNames.join("\n")));
                 this.formattedMessage = span;
                 break;
-            case WebInspector.ConsoleMessage.MessageLevel.Object:
+            case WebInspector.ConsoleMessage.MessageType.Object:
                 this.formattedMessage = this._format(["%O", args[0]]);
                 break;
             default:
@@ -720,8 +721,10 @@ WebInspector.ConsoleMessage.prototype = {
             case WebInspector.ConsoleMessage.MessageLevel.Error:
                 element.addStyleClass("console-error-level");
                 break;
-            case WebInspector.ConsoleMessage.MessageLevel.StartGroup:
-                element.addStyleClass("console-group-title-level");
+        }
+        
+        if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
+            element.addStyleClass("console-group-title");
         }
 
         if (this.elementsTreeOutline) {
@@ -788,6 +791,25 @@ WebInspector.ConsoleMessage.prototype = {
                 break;
         }
 
+        var typeString;
+        switch (this.type) {
+            case WebInspector.ConsoleMessage.MessageType.Log:
+                typeString = "Log";
+                break;
+            case WebInspector.ConsoleMessage.MessageType.Object:
+                typeString = "Object";
+                break;
+            case WebInspector.ConsoleMessage.MessageType.Trace:
+                typeString = "Trace";
+                break;
+            case WebInspector.ConsoleMessage.MessageType.StartGroup:
+                typeString = "Start Group";
+                break;
+            case WebInspector.ConsoleMessage.MessageType.EndGroup:
+                typeString = "End Group";
+                break;
+        }
+        
         var levelString;
         switch (this.level) {
             case WebInspector.ConsoleMessage.MessageLevel.Tip:
@@ -802,21 +824,9 @@ WebInspector.ConsoleMessage.prototype = {
             case WebInspector.ConsoleMessage.MessageLevel.Error:
                 levelString = "Error";
                 break;
-            case WebInspector.ConsoleMessage.MessageLevel.Object:
-                levelString = "Object";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Trace:
-                levelString = "Trace";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.StartGroup:
-                levelString = "Start Group";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.EndGroup:
-                levelString = "End Group";
-                break;
         }
 
-        return sourceString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
+        return sourceString + " " + typeString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
     },
 
     isEqual: function(msg, disreguardGroup)
@@ -825,6 +835,7 @@ WebInspector.ConsoleMessage.prototype = {
             return false;
 
         var ret = (this.source == msg.source)
+            && (this.type == msg.type)
             && (this.level == msg.level)
             && (this.line == msg.line)
             && (this.url == msg.url)
@@ -844,15 +855,19 @@ WebInspector.ConsoleMessage.MessageSource = {
     Other: 5
 }
 
+WebInspector.ConsoleMessage.MessageType = {
+    Log: 0,
+    Object: 1,
+    Trace: 2,
+    StartGroup: 3,
+    EndGroup: 4
+}
+
 WebInspector.ConsoleMessage.MessageLevel = {
     Tip: 0,
     Log: 1,
     Warning: 2,
-    Error: 3,
-    Object: 4,
-    Trace: 5,
-    StartGroup: 6,
-    EndGroup: 7
+    Error: 3
 }
 
 WebInspector.ConsoleCommand = function(command)
@@ -883,7 +898,7 @@ WebInspector.ConsoleCommandResult = function(result, exception, originatingComma
     var line = (exception ? result.line : -1);
     var url = (exception ? result.sourceURL : null);
 
-    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, level, line, url, null, 1, message);
+    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, line, url, null, 1, message);
 
     this.originatingCommand = originatingCommand;
 }
@@ -920,7 +935,7 @@ WebInspector.ConsoleGroup.prototype = {
     {
         var element = msg.toMessageElement();
         
-        if (msg.level === WebInspector.ConsoleMessage.MessageLevel.StartGroup) {
+        if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
             this.messagesElement.parentNode.insertBefore(element, this.messagesElement);
             element.addEventListener("click", this._titleClicked.bind(this), true);
         } else
@@ -932,7 +947,7 @@ WebInspector.ConsoleGroup.prototype = {
 
     _titleClicked: function(event)
     {
-        var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title-level");
+        var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title");
         if (groupTitleElement) {
             var groupElement = groupTitleElement.enclosingNodeOrSelfWithClass("console-group");
             if (groupElement)
index 058f232..85d5cd2 100644 (file)
@@ -489,7 +489,8 @@ WebInspector.Resource.prototype = {
         // Otherwise, we flood the Console with too many tips.
         /*
         var msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
-            WebInspector.ConsoleMessage.MessageLevel.Tip, -1, this.url, null, 1, tip.message);
+            WebInspector.ConsoleMessage.MessageType.Log, WebInspector.ConsoleMessage.MessageLevel.Tip, 
+            -1, this.url, null, 1, tip.message);
         WebInspector.console.addMessage(msg);
         */
     },
@@ -549,6 +550,7 @@ WebInspector.Resource.prototype = {
             case WebInspector.Warnings.IncorrectMIMEType.id:
                 if (!this._mimeTypeIsConsistentWithType())
                     msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
+                        WebInspector.ConsoleMessage.MessageType.Log, 
                         WebInspector.ConsoleMessage.MessageLevel.Warning, -1, this.url, null, 1,
                         String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message,
                         WebInspector.Resource.Type.toString(this.type), this.mimeType));
index c162531..929caa2 100644 (file)
@@ -483,7 +483,7 @@ body.console-visible #console {
     background-image: none;
 }
 
-.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title-level::before {
+.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
     position: absolute;
     display: block;
     content: "";
@@ -529,18 +529,18 @@ body.console-visible #console {
     margin-left: 16px;
 }
 
-.console-group-title-level {
+.console-group-title {
     font-weight: bold;
 }
 
-.console-group-title-level::before {
+.console-group-title::before {
     background-image: url(Images/disclosureTriangleSmallDown.png);
     top: 0.6em;
     width: 11px;
     height: 12px;
 }
 
-.console-group.collapsed .console-group-title-level::before {
+.console-group.collapsed .console-group-title::before {
     background-image: url(Images/disclosureTriangleSmallRight.png);
 }
 
index 9d5bac0..91f2659 100644 (file)
@@ -979,6 +979,7 @@ WebInspector.addMessageToConsole = function(payload)
 {
     var consoleMessage = new WebInspector.ConsoleMessage(
         payload.source,
+        payload.type,
         payload.level,
         payload.line,
         payload.url,
index 06d96bc..0b72f94 100644 (file)
@@ -247,7 +247,7 @@ void DocLoader::printAccessDeniedMessage(const KURL& url) const
                        m_doc->url().string().utf8().data());
 
     // FIXME: provide a real line number and source URL.
-    frame()->domWindow()->console()->addMessage(OtherMessageSource, ErrorMessageLevel, message, 1, String());
+    frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
 }
 
 void DocLoader::setAutoLoadImages(bool enable)
index 96f6c6b..f1c4c5d 100644 (file)
@@ -95,7 +95,7 @@ public:
 
     virtual void setResizable(bool) { }
 
-    virtual void addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, const String&) { }
+    virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) { }
 
     virtual bool canRunBeforeUnloadConfirmPanel() { return false; }
     virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*) { return true; }
index a8a922f..1e51583 100644 (file)
@@ -2389,7 +2389,7 @@ void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url)
     if (!frame)
         return;
 
-    frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String());
+    frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String());
 }
 
 bool FrameLoader::shouldHideReferrer(const KURL& url, const String& referrer)
@@ -2606,7 +2606,7 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
             targetDocument->url().string().utf8().data(), activeDocument->url().string().utf8().data());
 
         // FIXME: should we print to the console of the activeFrame as well?
-        targetFrame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 1, String());
+        targetFrame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
     }
     
     return false;
index 2cfcced..78efa45 100644 (file)
@@ -103,7 +103,7 @@ namespace WebCore {
 
         virtual void setResizable(bool) = 0;
         
-        virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) = 0;
+        virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) = 0;
 
         virtual bool canRunBeforeUnloadConfirmPanel() = 0;
         virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame) = 0;
index 846782a..45ff059 100644 (file)
@@ -128,18 +128,6 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
         case ErrorMessageLevel:
             levelString = "ERROR";
             break;
-        case ObjectMessageLevel:
-            levelString = "OBJECT";
-            break;
-        case TraceMessageLevel:
-            levelString = "TRACE";
-            break;
-        case StartGroupMessageLevel:
-            levelString = "START GROUP";
-            break;
-        case EndGroupMessageLevel:
-            levelString = "END GROUP";
-            break;
         default:
             ASSERT_NOT_REACHED();
             levelString = "UNKNOWN";
@@ -149,16 +137,16 @@ static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel
     printf("%s %s:", sourceString, levelString);
 }
 
-void Console::addMessage(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
 {
     Page* page = this->page();
     if (!page)
         return;
 
     if (source == JSMessageSource || source == WMLMessageSource)
-        page->chrome()->client()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+        page->chrome()->client()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
 
-    page->inspectorController()->addMessageToConsole(source, level, message, lineNumber, sourceURL);
+    page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
 
     if (!Console::shouldPrintExceptions())
         return;
@@ -169,7 +157,7 @@ void Console::addMessage(MessageSource source, MessageLevel level, const String&
     printf(" %s\n", message.utf8().data());
 }
 
-void Console::addMessage(MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
+void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
 {
     Page* page = this->page();
     if (!page)
@@ -182,9 +170,9 @@ void Console::addMessage(MessageLevel level, ScriptCallStack* callStack, bool ac
 
     String message;
     if (getFirstArgumentAsString(callStack->state(), lastCaller, message))
-        page->chrome()->client()->addMessageToConsole(JSMessageSource, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL());
+        page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL());
 
-    page->inspectorController()->addMessageToConsole(JSMessageSource, level, callStack);
+    page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack);
 
     if (!Console::shouldPrintExceptions())
         return;
@@ -208,7 +196,7 @@ void Console::debug(ScriptCallStack* callStack)
 
 void Console::error(ScriptCallStack* callStack)
 {
-    addMessage(ErrorMessageLevel, callStack);
+    addMessage(LogMessageType, ErrorMessageLevel, callStack);
 }
 
 void Console::info(ScriptCallStack* callStack)
@@ -218,12 +206,12 @@ void Console::info(ScriptCallStack* callStack)
 
 void Console::log(ScriptCallStack* callStack)
 {
-    addMessage(LogMessageLevel, callStack);
+    addMessage(LogMessageType, LogMessageLevel, callStack);
 }
 
 void Console::dir(ScriptCallStack* callStack)
 {
-    addMessage(ObjectMessageLevel, callStack);
+    addMessage(ObjectMessageType, LogMessageLevel, callStack);
 }
 
 void Console::dirxml(ScriptCallStack* callStack)
@@ -234,7 +222,7 @@ void Console::dirxml(ScriptCallStack* callStack)
 
 void Console::trace(ScriptCallStack* callStack)
 {
-    addMessage(TraceMessageLevel, callStack, true);
+    addMessage(TraceMessageType, LogMessageLevel, callStack, true);
 
     if (!shouldPrintExceptions())
         return;
@@ -252,7 +240,7 @@ void Console::assertCondition(bool condition, ScriptCallStack* callStack)
         return;
 
     // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=19135> It would be nice to prefix assertion failures with a message like "Assertion failed: ".
-    addMessage(ErrorMessageLevel, callStack, true);
+    addMessage(LogMessageType, ErrorMessageLevel, callStack, true);
 }
 
 void Console::count(ScriptCallStack* callStack)
@@ -350,7 +338,7 @@ void Console::timeEnd(const String& title, ScriptCallStack* callStack)
     String message = title + String::format(": %.0fms", elapsed);
 
     const ScriptCallFrame& lastCaller = callStack->at(0);
-    page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL().string());
+    page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL().string());
 }
 
 void Console::group(ScriptCallStack* callStack)
@@ -373,7 +361,7 @@ void Console::groupEnd()
 
 void Console::warn(ScriptCallStack* callStack)
 {
-    addMessage(WarningMessageLevel, callStack);
+    addMessage(LogMessageType, WarningMessageLevel, callStack);
 }
 
 static bool printExceptions = false;
index 79396ea..64e596d 100644 (file)
@@ -59,16 +59,19 @@ namespace WebCore {
         OtherMessageSource
     };
 
+    enum MessageType {
+        LogMessageType,
+        ObjectMessageType,
+        TraceMessageType,
+        StartGroupMessageType,
+        EndGroupMessageType
+    };
+
     enum MessageLevel {
         TipMessageLevel,
         LogMessageLevel,
         WarningMessageLevel,
-        ErrorMessageLevel,
-        // FIXME: the remaining levels should become a new MessageType enum.
-        ObjectMessageLevel,
-        TraceMessageLevel,
-        StartGroupMessageLevel,
-        EndGroupMessageLevel
+        ErrorMessageLevel
     };
 
     class Console : public RefCounted<Console> {
@@ -78,7 +81,7 @@ namespace WebCore {
         Frame* frame() const;
         void disconnectFrame();
 
-        void addMessage(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+        void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
 
         void debug(ScriptCallStack*);
         void error(ScriptCallStack*);
@@ -108,7 +111,7 @@ namespace WebCore {
 
     private:
         inline Page* page() const;
-        void addMessage(MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
+        void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
 
         Console(Frame*);
 
index eb1981c..8e64fe3 100644 (file)
@@ -634,7 +634,7 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer* t)
         if (!timer->targetOrigin()->isSameSchemeHostPort(document()->securityOrigin())) {
             String message = String::format("Unable to post message to %s. Recipient has origin %s.\n", 
                 timer->targetOrigin()->toString().utf8().data(), document()->securityOrigin()->toString().utf8().data());
-            console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 0, String());
+            console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 0, String());
             return;
         }
     }
index dbb69e7..d87f1ea 100644 (file)
@@ -73,7 +73,7 @@ bool XSSAuditor::canEvaluate(const String& sourceCode) const
 
     if (findInRequest(sourceCode, false, true, false)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
@@ -86,7 +86,7 @@ bool XSSAuditor::canEvaluateJavaScriptURL(const String& code) const
 
     if (findInRequest(code, false, false, true, true)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
@@ -99,7 +99,7 @@ bool XSSAuditor::canCreateInlineEventListener(const String&, const String& code)
 
     if (findInRequest(code)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
@@ -112,7 +112,7 @@ bool XSSAuditor::canLoadExternalScriptFromSrc(const String& url) const
 
     if (findInRequest(url)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request.\n"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
@@ -125,7 +125,7 @@ bool XSSAuditor::canLoadObject(const String& url) const
 
     if (findInRequest(url, false, false)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
@@ -139,7 +139,7 @@ bool XSSAuditor::canSetBaseElementURL(const String& url) const
     KURL baseElementURL(m_frame->document()->url(), url);
     if (m_frame->document()->url().host() != baseElementURL.host() && findInRequest(url)) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute a JavaScript script. Source code of script found within request"));
-        m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, consoleMessage, 1, String());
+        m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
     return true;
index d7169e1..61645f4 100644 (file)
@@ -89,13 +89,13 @@ void SVGDocumentExtensions::unpauseAnimations()
 void SVGDocumentExtensions::reportWarning(const String& message)
 {
     if (Frame* frame = m_doc->frame())
-        frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+        frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
 }
 
 void SVGDocumentExtensions::reportError(const String& message)
 {
     if (Frame* frame = m_doc->frame())
-        frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
+        frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());
 }
 
 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
index a228299..87c8003 100644 (file)
@@ -61,7 +61,7 @@ void reportWMLError(Document* doc, WMLErrorCode error)
         if (!console)
             return;
 
-        console->addMessage(WMLMessageSource, ErrorMessageLevel, errorMessage, 0, String());
+        console->addMessage(WMLMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, 0, String());
     }
 }
 
index 3611fea..d6a9994 100644 (file)
@@ -328,6 +328,56 @@ namespace WebCore {
         P6 m_parameter6;
         P7 m_parameter7;
     };
+    
+    template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+    class GenericWorkerTask8 : public ScriptExecutionContext::Task {
+    public:
+        typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
+        typedef GenericWorkerTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> GenericWorkerTask;
+        typedef typename GenericWorkerTaskTraits<P1>::ParamType Param1;
+        typedef typename GenericWorkerTaskTraits<P2>::ParamType Param2;
+        typedef typename GenericWorkerTaskTraits<P3>::ParamType Param3;
+        typedef typename GenericWorkerTaskTraits<P4>::ParamType Param4;
+        typedef typename GenericWorkerTaskTraits<P5>::ParamType Param5;
+        typedef typename GenericWorkerTaskTraits<P6>::ParamType Param6;
+        typedef typename GenericWorkerTaskTraits<P7>::ParamType Param7;
+        typedef typename GenericWorkerTaskTraits<P8>::ParamType Param8;
+        
+        static PassRefPtr<GenericWorkerTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+        {
+            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8));
+        }
+        
+    private:
+        GenericWorkerTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+        : m_method(method)
+        , m_parameter1(parameter1)
+        , m_parameter2(parameter2)
+        , m_parameter3(parameter3)
+        , m_parameter4(parameter4)
+        , m_parameter5(parameter5)
+        , m_parameter6(parameter6)
+        , m_parameter7(parameter7)
+        , m_parameter8(parameter8)
+        {
+        }
+        
+        virtual void performTask(ScriptExecutionContext* context)
+        {
+            (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7, m_parameter8);
+        }
+        
+    private:
+        Method m_method;
+        P1 m_parameter1;
+        P2 m_parameter2;
+        P3 m_parameter3;
+        P4 m_parameter4;
+        P5 m_parameter5;
+        P6 m_parameter6;
+        P7 m_parameter7;
+        P8 m_parameter8;
+    };
 
     template<typename P1, typename MP1>
     PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
@@ -413,6 +463,21 @@ namespace WebCore {
                 CrossThreadCopier<P7>::copy(parameter7));
     }
 
+    template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+    PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
+                                                                void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
+                                                                const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
+    {
+        return GenericWorkerTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+        typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
+        typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create(
+                                                           method,
+                                                           CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
+                                                           CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
+                                                           CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6),
+                                                           CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8));
+    }
+
 } // namespace WebCore
 
 #endif // ENABLE(WORKERS)
index 9b019b8..8e9fb97 100644 (file)
@@ -146,9 +146,9 @@ void WorkerContext::reportException(const String& errorMessage, int lineNumber,
     m_thread->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
 }
 
-void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
 {
-    m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, level, message, lineNumber, sourceURL);
+    m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL);
 }
 
 void WorkerContext::resourceRetrievedByXMLHttpRequest(unsigned long, const ScriptString&)
@@ -299,7 +299,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, const String& call
         }
 
         scriptExecutionContext()->scriptImported(scriptLoader.identifier(), scriptLoader.script());
-        scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
+        scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
 
         ScriptValue exception;
         m_script->evaluate(ScriptSourceCode(scriptLoader.script(), *it), &exception);
index bcec769..16f43fd 100644 (file)
@@ -74,7 +74,7 @@ namespace WebCore {
         bool hasPendingActivity() const;
 
         virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
-        virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+        virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
         virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
         virtual void scriptImported(unsigned long identifier, const String& sourceString);
 
index 04e61c1..b6e1642 100644 (file)
@@ -255,16 +255,16 @@ void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessag
     m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, sourceURL, this));
 }
     
-static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
 {
     if (messagingProxy->askedToTerminate())
         return;
-    context->addMessage(destination, source, level, message, lineNumber, sourceURL);
+    context->addMessage(destination, source, type, level, message, lineNumber, sourceURL);
 }
 
-void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
+void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
 {
-    m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, level, message, lineNumber, sourceURL));
+    m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, type, level, message, lineNumber, sourceURL));
 }
 
 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread)
index 298d868..f9e1cd4 100644 (file)
@@ -63,7 +63,7 @@ namespace WebCore {
         // (Only use these methods in the worker context thread.)
         virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>);
         virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL);
-        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
+        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
         virtual void confirmMessageFromWorkerObject(bool hasPendingActivity);
         virtual void reportPendingActivity(bool hasPendingActivity);
         virtual void workerContextDestroyed();
index bdbc2bb..c5f4456 100644 (file)
@@ -51,7 +51,7 @@ namespace WebCore {
 
         virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
 
-        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
+        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
 
         virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
 
index 0a8154f..5e20252 100644 (file)
@@ -823,7 +823,7 @@ static void reportUnsafeUsage(ScriptExecutionContext* context, const String& mes
         return;
     // FIXME: It's not good to report the bad usage without indicating what source line it came from.
     // We should pass additional parameters so we can tell the console where the mistake occurred.
-    context->addMessage(ConsoleDestination, JSMessageSource, ErrorMessageLevel, message, 1, String());
+    context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
 }
 
 void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
@@ -1023,7 +1023,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
         m_responseText += m_decoder->flush();
 
     scriptExecutionContext()->resourceRetrievedByXMLHttpRequest(identifier, m_responseText);
-    scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
+    scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
 
     bool hadLoader = m_loader;
     m_loader = 0;
index 3865124..a26fe77 100644 (file)
@@ -99,7 +99,7 @@ void XSLTProcessor::parseErrorFunc(void* userData, xmlError* error)
             break;
     }
 
-    console->addMessage(XMLMessageSource, level, error->message, error->line, error->file);
+    console->addMessage(XMLMessageSource, LogMessageType, level, error->message, error->line, error->file);
 }
 
 // FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals.
index f7d66fb..b5fee23 100644 (file)
@@ -1,3 +1,14 @@
+2009-07-12  Keishi Hattori  <casey.hattori@gmail.com>
+
+        Reviewed by Timothy Hatcher.
+
+        Refactor ConsoleMessage to add MessageType attribute.
+        https://bugs.webkit.org/show_bug.cgi?id=20625
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::addMessageToConsole):
+
 2009-07-11  Simon Fraser  <simon.fraser@apple.com>
 
         Enable support for accelerated compositing and 3d transforms on Leopard.
index 1436a7f..ea00efd 100644 (file)
@@ -73,7 +73,7 @@ public:
     
     virtual void setResizable(bool);
     
-    virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageLevel level, const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceURL);
+    virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceURL);
 
     virtual bool canRunBeforeUnloadConfirmPanel();
     virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, WebCore::Frame* frame);
index 417d796..e3aaa31 100644 (file)
@@ -301,7 +301,7 @@ void WebChromeClient::setResizable(bool b)
     [[m_webView _UIDelegateForwarder] webView:m_webView setResizable:b];
 }
 
-void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned int lineNumber, const String& sourceURL)
+void WebChromeClient::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned int lineNumber, const String& sourceURL)
 {
     id delegate = [m_webView UIDelegate];
     SEL selector = @selector(webView:addMessageToConsole:);