Web Inspector: ConsoleMessage should include line and column number where possible
https://bugs.webkit.org/show_bug.cgi?id=114929
Source/WebCore:
- adds "m_column" to WebCore::ConsoleMessage
- adds "column" to Console.ConsoleMessage in the inspector protocol
- set the column number for console.* functions (Console.cpp)
- set the column number for XSLT errors (XSLTProcessor)
- plumb columnNumber everywhere else it is needed, set it to 0 and file
bugs for all cases missing columnNumber that could provide it.
Reviewed by Timothy Hatcher.
Test: inspector/console/console-url-line-column.html
inspector/console/console-messages-stack-traces.html
* inspector/ConsoleMessage.h:
* inspector/ConsoleMessage.cpp:
(WebCore::ConsoleMessage::ConsoleMessage):
(WebCore::ConsoleMessage::autogenerateMetadata):
(WebCore::ConsoleMessage::addToFrontend):
(WebCore::ConsoleMessage::isEqual):
Add m_column and set it where appropriate.
* inspector/Inspector.json:
Add column property to Console.ConsoleMessage.
* page/Console.cpp:
(WebCore::internalAddMessage):
(WebCore::Console::profile):
Set columnNumber like lineNumber from the last stack frame.
(WebCore::Console::groupEnd):
Line and column are unused in this message type, set both to 0.
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::XSLTProcessor::parseErrorFunc):
* xml/XSLTProcessorQt.cpp:
(WebCore::XSLTMessageHandler::handleMessage):
Add real column numbers, the XSLT handlers already had it available.
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* css/CSSParser.cpp:
(WebCore::CSSParser::logError):
* dom/ScriptExecutionContext.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::addConsoleMessage):
* dom/Document.cpp:
(WebCore::Document::logExceptionToConsole):
(WebCore::Document::addMessage):
* dom/Document.h:
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::addMessageToConsole):
(WebCore::InspectorConsoleAgent::stopTiming):
(WebCore::InspectorConsoleAgent::didFinishXHRLoading):
(WebCore::InspectorConsoleAgent::didReceiveResponse):
(WebCore::InspectorConsoleAgent::didFailLoading):
* inspector/InspectorConsoleAgent.h:
* inspector/InspectorConsoleInstrumentation.h:
(WebCore::InspectorInstrumentation::addMessageToConsole):
(WebCore::InspectorInstrumentation::addStartProfilingMessageToConsole):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::addProfileImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::addProfile):
(WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
(WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
(WebCore::InspectorProfilerAgent::start):
(WebCore::InspectorProfilerAgent::stop):
* inspector/InspectorProfilerAgent.h:
(InspectorProfilerAgent):
* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::addMessageToConsole):
* page/ChromeClient.h:
(WebCore::ChromeClient::addMessageToConsole):
* page/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::logToConsole):
* page/PageConsole.cpp:
(WebCore::PageConsole::addMessage):
* page/PageConsole.h:
* workers/DefaultSharedWorkerRepository.cpp:
(SharedWorkerProxy):
(WebCore::postExceptionTask):
(WebCore::SharedWorkerProxy::postExceptionToWorkerObject):
(WebCore::postConsoleMessageTask):
(WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject):
* workers/SharedWorkerContext.cpp:
(WebCore::SharedWorkerContext::logExceptionToConsole):
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::logExceptionToConsole):
(WebCore::WorkerContext::addConsoleMessage):
(WebCore::WorkerContext::addMessage):
(WebCore::WorkerContext::addMessageToWorkerConsole):
* workers/WorkerContext.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerExceptionTask::create):
(WebCore::WorkerExceptionTask::WorkerExceptionTask):
(WebCore::WorkerExceptionTask::performTask):
(WorkerExceptionTask):
(WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
(WebCore::postConsoleMessageTask):
(WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
* workers/WorkerMessagingProxy.h:
(WorkerMessagingProxy):
* workers/WorkerReportingProxy.h:
(WorkerReportingProxy):
Plumb columnNumber through where appropriate. File bugs where missing.
Source/WebKit/blackberry:
Reviewed by Timothy Hatcher.
* Api/DumpRenderTreeClient.h:
* Api/WebPageClient.h:
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::addMessageToConsole):
* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):
Source/WebKit/efl:
Reviewed by Timothy Hatcher.
* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::addMessageToConsole):
* WebCoreSupport/ChromeClientEfl.h:
(ChromeClientEfl):
Source/WebKit/gtk:
Reviewed by Timothy Hatcher.
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::addMessageToConsole):
* WebCoreSupport/ChromeClientGtk.h:
(ChromeClient):
Source/WebKit/mac:
Reviewed by Timothy Hatcher.
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::addMessageToConsole):
Source/WebKit/qt:
Reviewed by Timothy Hatcher.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::addMessageToConsole):
* WebCoreSupport/ChromeClientQt.h:
Source/WebKit/win:
Reviewed by Timothy Hatcher.
* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::addMessageToConsole):
* WebCoreSupport/WebChromeClient.h:
Source/WebKit/wince:
Reviewed by Timothy Hatcher.
* WebCoreSupport/ChromeClientWinCE.cpp:
(WebKit::ChromeClientWinCE::addMessageToConsole):
* WebCoreSupport/ChromeClientWinCE.h:
Source/WebKit2:
Reviewed by Timothy Hatcher.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::addMessageToConsole):
* WebProcess/WebCoreSupport/WebChromeClient.h:
LayoutTests:
Update a test that was outputting the url and line number of console
method calls, to output the column number as well. Added a test that
verifies that console API messages have stack traces if appropriate.
Reviewed by Timothy Hatcher.
* inspector/console/console-url-and-line-expected.txt: Removed.
* inspector/console/console-url-line-column-expected.txt: Added.
* inspector/console/console-url-line-column.html: Renamed from LayoutTests/inspector/console/console-url-and-line.html.
* inspector/console/console-messages-stack-traces-expected.txt: Added.
* inspector/console/console-messages-stack-traces.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149125 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index 7d0c8fc..e2b3140 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -148,29 +148,29 @@
m_instrumentingAgents->setInspectorProfilerAgent(0);
}
-void InspectorProfilerAgent::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
+void InspectorProfilerAgent::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, unsigned columnNumber, const String& sourceURL)
{
RefPtr<ScriptProfile> profile = prpProfile;
m_profiles.add(profile->uid(), profile);
if (m_frontend && m_state->getBoolean(ProfilerAgentState::profileHeadersRequested))
m_frontend->addProfileHeader(createProfileHeader(*profile));
- addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL);
+ addProfileFinishedMessageToConsole(profile, lineNumber, columnNumber, sourceURL);
}
-void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
+void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, unsigned columnNumber, const String& sourceURL)
{
if (!m_frontend)
return;
RefPtr<ScriptProfile> profile = prpProfile;
String message = makeString(profile->title(), '#', String::number(profile->uid()));
- m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileEndMessageType, DebugMessageLevel, message, sourceURL, lineNumber);
+ m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileEndMessageType, DebugMessageLevel, message, sourceURL, lineNumber, columnNumber);
}
-void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
+void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, unsigned columnNumber, const String& sourceURL)
{
if (!m_frontend)
return;
- m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileMessageType, DebugMessageLevel, title, sourceURL, lineNumber);
+ m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileMessageType, DebugMessageLevel, title, sourceURL, lineNumber, columnNumber);
}
void InspectorProfilerAgent::collectGarbage(WebCore::ErrorString*)
@@ -383,7 +383,7 @@
m_recordingCPUProfile = true;
String title = getCurrentUserInitiatedProfileName(true);
startProfiling(title);
- addStartProfilingMessageToConsole(title, 0, String());
+ addStartProfilingMessageToConsole(title, 0, 0, String());
toggleRecordButton(true);
m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
}
@@ -396,7 +396,7 @@
String title = getCurrentUserInitiatedProfileName();
RefPtr<ScriptProfile> profile = stopProfiling(title);
if (profile)
- addProfile(profile, 0, String());
+ addProfile(profile, 0, 0, String());
toggleRecordButton(false);
m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
}