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

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

Issue 18822004: Extension Error Piping - Blink: WebKit Side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Pass in plain text, per Pavel's suggestion 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
Index: Source/core/page/Console.cpp
diff --git a/Source/core/page/Console.cpp b/Source/core/page/Console.cpp
index bd34162ac01de4fa12be8ecbfa4529726f6c7d9f..a82a3461cdff6fc64f2a03cbe180f856f89ac999 100644
--- a/Source/core/page/Console.cpp
+++ b/Source/core/page/Console.cpp
@@ -69,16 +69,21 @@ static void internalAddMessage(Page* page, MessageType type, MessageLevel level,
if (!acceptNoArguments && !arguments->argumentCount())
return;
- size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize));
- const ScriptCallFrame& lastCaller = callStack->at(0);
-
String message;
bool gotMessage = arguments->getFirstArgumentAsString(message);
InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource, type, level, message, state, arguments);
- if (gotMessage)
- page->chrome().client()->addMessageToConsole(ConsoleAPIMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL());
+ if (gotMessage) {
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1));
+ if (page->chrome().client()->shouldReportDetailedMessageForSource(callStack->at(0).sourceURL())) {
pfeldman 2013/08/08 17:13:52 Is it true that you are now collecting stack trace
Devlin 2013/08/12 16:09:41 Short answer: Nope. Sorry, I didn't upload the co
pfeldman 2013/08/12 16:15:34 Ok!
+ callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture);
+ for (size_t i = 0; i < callStack->size(); ++i) {
+ const ScriptCallFrame& frame = callStack->at(i);
+ message.append("\n at " + (frame.functionName().length() ? frame.functionName() : String("(anonymous function)")) + " (" + frame.sourceURL() + ":" + String::number(frame.lineNumber()) + ":" + String::number(frame.columnNumber()) + ")");
+ }
+ }
+ page->chrome().client()->addMessageToConsole(ConsoleAPIMessageSource, type, level, message, callStack->at(0).lineNumber(), callStack->at(0).sourceURL());
+ }
}
void Console::debug(ScriptState* state, PassRefPtr<ScriptArguments> arguments)

Powered by Google App Engine
This is Rietveld 408576698