Commit 0b68bb9d authored by bfulgham@webkit.org's avatar bfulgham@webkit.org

WebCore:

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: http://svn.webkit.org/repository/webkit/trunk@45786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b304a430
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.
......
......@@ -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;
......
......@@ -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()
......
......@@ -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();
......
......@@ -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.
......
......@@ -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;
......
......@@ -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());
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
......
......@@ -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();
......
......@@ -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)
......
......@@ -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));
......
......@@ -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);
}
......
......@@ -979,6 +979,7 @@ WebInspector.addMessageToConsole = function(payload)
{
var consoleMessage = new WebInspector.ConsoleMessage(
payload.source,
payload.type,
payload.level,
payload.line,
payload.url,
......
......@@ -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)
......
......@@ -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; }
......
......@@ -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;
......
......@@ -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;
......
......@@ -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