OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 return; | 84 return; |
85 | 85 |
86 if (callStack) | 86 if (callStack) |
87 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, callStack, requestIdentifier); | 87 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, callStack, requestIdentifier); |
88 else | 88 else |
89 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, url, lineNumber, columnNumber, state, requestIdentifier); | 89 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, url, lineNumber, columnNumber, state, requestIdentifier); |
90 | 90 |
91 if (source == CSSMessageSource) | 91 if (source == CSSMessageSource) |
92 return; | 92 return; |
93 | 93 |
94 page->chrome().client()->addMessageToConsole(source, level, message, lineNum ber, url); | 94 String stackTrace; |
95 if (page->chrome().client()->shouldReportDetailedMessageForSource(url) && ca llStack) | |
96 stackTrace = formatStackTraceString(message, callStack); | |
97 | |
98 page->chrome().client()->addMessageToConsole(source, level, message, lineNum ber, url, stackTrace); | |
95 } | 99 } |
96 | 100 |
97 // static | 101 // 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.
| |
102 String PageConsole::formatStackTraceString(const String& originalMessage, PassRe fPtr<ScriptCallStack> callStack) | |
103 { | |
104 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.
| |
105 for (size_t i = 0; i < callStack->size(); ++i) { | |
106 const ScriptCallFrame& frame = callStack->at(i); | |
107 stackTrace.append("\n at " + (frame.functionName().length() ? frame.f unctionName() : 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.
| |
108 } | |
109 | |
110 return stackTrace; | |
111 } | |
112 | |
113 // static | |
98 void PageConsole::mute() | 114 void PageConsole::mute() |
99 { | 115 { |
100 muteCount++; | 116 muteCount++; |
101 } | 117 } |
102 | 118 |
103 // static | 119 // static |
104 void PageConsole::unmute() | 120 void PageConsole::unmute() |
105 { | 121 { |
106 ASSERT(muteCount > 0); | 122 ASSERT(muteCount > 0); |
107 muteCount--; | 123 muteCount--; |
108 } | 124 } |
109 | 125 |
110 } // namespace WebCore | 126 } // namespace WebCore |
OLD | NEW |