Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1468)

Unified Diff: Source/core/page/PageConsole.cpp

Issue 18822004: Extension Error Piping - Blink: WebKit Side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/PageConsole.h ('k') | Source/web/ChromeClientImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/PageConsole.cpp
diff --git a/Source/core/page/PageConsole.cpp b/Source/core/page/PageConsole.cpp
index 07bbb252a6ce2974edde7df033fa5d860034e9b2..1c2986125bbbd637313112a818d3af835f815910 100644
--- a/Source/core/page/PageConsole.cpp
+++ b/Source/core/page/PageConsole.cpp
@@ -91,7 +91,23 @@ void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str
if (source == CSSMessageSource)
return;
- page->chrome().client()->addMessageToConsole(source, level, message, lineNumber, url);
+ String stackTrace;
+ if (page->chrome().client()->shouldReportDetailedMessageForSource(url) && callStack)
+ stackTrace = formatStackTraceString(message, callStack);
+
+ page->chrome().client()->addMessageToConsole(source, level, message, lineNumber, url, stackTrace);
+}
+
+// static
abarth-chromium 2013/08/19 19:54:18 Please remove these comments. We don't use them i
Devlin 2013/08/19 20:24:58 Done.
+String PageConsole::formatStackTraceString(const String& originalMessage, PassRefPtr<ScriptCallStack> callStack)
+{
+ String stackTrace;
abarth-chromium 2013/08/19 19:54:18 Please don't ever call String::append. It's horri
Devlin 2013/08/19 20:24:58 Done.
+ for (size_t i = 0; i < callStack->size(); ++i) {
+ const ScriptCallFrame& frame = callStack->at(i);
+ stackTrace.append("\n at " + (frame.functionName().length() ? frame.functionName() : String("(anonymous function)")) + " (" + frame.sourceURL() + ":" + String::number(frame.lineNumber()) + ":" + String::number(frame.columnNumber()) + ")");
abarth-chromium 2013/08/19 19:54:18 Rather than creating all these temporary strings,
Devlin 2013/08/19 20:24:58 Done.
+ }
+
+ return stackTrace;
}
// static
« no previous file with comments | « Source/core/page/PageConsole.h ('k') | Source/web/ChromeClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698