Changeset 161678 in webkit
- Timestamp:
- Jan 10, 2014 2:16:17 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161676 r161678 1 2014-01-10 Timothy Hatcher <timothy@apple.com> 2 3 Clean up and fix some issues with stdout formatting of console messages. 4 5 * Fix URLs not printing line numbers unless column number is > 0. 6 * Change "CONSOLEAPI" to "CONSOLE" for the source. 7 * Clean up how console.trace outputs and print URL, line and column for each frame. 8 * Print "(unknown)" for anonymous and native code call frames. 9 10 https://bugs.webkit.org/show_bug.cgi?id=126767 11 12 Reviewed by Joseph Pecoraro. 13 14 * page/Console.cpp: 15 (WebCore::internalAddMessage): 16 * page/PageConsole.cpp: 17 (WebCore::PageConsole::printSourceURLAndPosition): 18 (WebCore::PageConsole::printMessageSourceAndLevelPrefix): 19 * page/PageConsole.h: 20 1 21 2014-01-10 Joseph Pecoraro <pecoraro@apple.com> 2 22 -
trunk/Source/WebCore/page/Console.cpp
r160457 r161678 94 94 95 95 PageConsole::printSourceURLAndPosition(lastCaller.sourceURL(), lastCaller.lineNumber()); 96 PageConsole::printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level); 96 97 printf(": "); 98 99 PageConsole::printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level, printTrace); 97 100 98 101 for (size_t i = 0; i < arguments->argumentCount(); ++i) { … … 103 106 printf("\n"); 104 107 105 if (printTrace) { 106 printf("Stack Trace\n"); 107 for (size_t i = 0; i < callStack->size(); ++i) { 108 String functionName = String(callStack->at(i).functionName()); 109 printf("\t%s\n", functionName.utf8().data()); 110 } 108 if (!printTrace) 109 return; 110 111 for (size_t i = 0; i < callStack->size(); ++i) { 112 const ScriptCallFrame& callFrame = callStack->at(i); 113 114 String functionName = String(callFrame.functionName()); 115 if (functionName.isEmpty()) 116 functionName = ASCIILiteral("(unknown)"); 117 118 printf("%lu: %s (", i, functionName.utf8().data()); 119 120 PageConsole::printSourceURLAndPosition(callFrame.sourceURL(), callFrame.lineNumber()); 121 122 printf(")\n"); 111 123 } 112 124 } -
trunk/Source/WebCore/page/PageConsole.cpp
r160457 r161678 69 69 if (!sourceURL.isEmpty()) { 70 70 if (lineNumber > 0 && columnNumber > 0) 71 printf("%s:%u:%u: ", sourceURL.utf8().data(), lineNumber, columnNumber); 71 printf("%s:%u:%u", sourceURL.utf8().data(), lineNumber, columnNumber); 72 else if (lineNumber > 0) 73 printf("%s:%u", sourceURL.utf8().data(), lineNumber); 72 74 else 73 printf("%s :", sourceURL.utf8().data());74 } 75 } 76 77 void PageConsole::printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level )75 printf("%s", sourceURL.utf8().data()); 76 } 77 } 78 79 void PageConsole::printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level, bool showAsTrace) 78 80 { 79 81 const char* sourceString; … … 89 91 break; 90 92 case ConsoleAPIMessageSource: 91 sourceString = "CONSOLE API";93 sourceString = "CONSOLE"; 92 94 break; 93 95 case StorageMessageSource: … … 134 136 break; 135 137 } 138 139 if (showAsTrace) 140 levelString = "TRACE"; 136 141 137 142 printf("%s %s:", sourceString, levelString); -
trunk/Source/WebCore/page/PageConsole.h
r160374 r161678 50 50 51 51 static void printSourceURLAndPosition(const String& sourceURL, unsigned lineNumber, unsigned columnNumber = 0); 52 static void printMessageSourceAndLevelPrefix(MessageSource, MessageLevel );52 static void printMessageSourceAndLevelPrefix(MessageSource, MessageLevel, bool showAsTrace = false); 53 53 54 54 void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, PassRefPtr<ScriptCallStack> = 0, JSC::ExecState* = 0, unsigned long requestIdentifier = 0);
Note: See TracChangeset
for help on using the changeset viewer.