| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 if (!acceptNoArguments && !arguments->argumentCount()) | 195 if (!acceptNoArguments && !arguments->argumentCount()) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture :
1; | 198 size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture :
1; |
| 199 RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize)); | 199 RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize)); |
| 200 const ScriptCallFrame& lastCaller = callStack->at(0); | 200 const ScriptCallFrame& lastCaller = callStack->at(0); |
| 201 | 201 |
| 202 String message; | 202 String message; |
| 203 bool gotMessage = arguments->getFirstArgumentAsString(message); | 203 bool gotMessage = arguments->getFirstArgumentAsString(message); |
| 204 InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource,
type, level, message, state, arguments.release()); | 204 InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource,
type, level, message, state, arguments); |
| 205 | 205 |
| 206 if (!page->settings() || page->settings()->privateBrowsingEnabled()) | 206 if (!page->settings() || page->settings()->privateBrowsingEnabled()) |
| 207 return; | 207 return; |
| 208 | 208 |
| 209 if (gotMessage) | 209 if (gotMessage) |
| 210 page->chrome()->client()->addMessageToConsole(ConsoleAPIMessageSource, t
ype, level, message, lastCaller.lineNumber(), lastCaller.sourceURL()); | 210 page->chrome()->client()->addMessageToConsole(ConsoleAPIMessageSource, t
ype, level, message, lastCaller.lineNumber(), lastCaller.sourceURL()); |
| 211 | 211 |
| 212 if (printExceptions) { | 212 if (printExceptions) { |
| 213 printSourceURLAndLine(lastCaller.sourceURL(), 0); | 213 printSourceURLAndLine(lastCaller.sourceURL(), lastCaller.lineNumber()); |
| 214 printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level); | 214 printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level); |
| 215 | 215 |
| 216 for (unsigned i = 0; i < arguments->argumentCount(); ++i) { | 216 for (unsigned i = 0; i < arguments->argumentCount(); ++i) { |
| 217 String argAsString; | 217 String argAsString = arguments->argumentAt(i).toString(arguments->gl
obalState()); |
| 218 if (arguments->argumentAt(i).getString(arguments->globalState(), arg
AsString)) | 218 printf(" %s", argAsString.utf8().data()); |
| 219 printf(" %s", argAsString.utf8().data()); | |
| 220 } | 219 } |
| 220 |
| 221 printf("\n"); | 221 printf("\n"); |
| 222 } | 222 } |
| 223 | 223 |
| 224 if (printTrace) { | 224 if (printTrace) { |
| 225 printf("Stack Trace\n"); | 225 printf("Stack Trace\n"); |
| 226 for (unsigned i = 0; i < callStack->size(); ++i) { | 226 for (unsigned i = 0; i < callStack->size(); ++i) { |
| 227 String functionName = String(callStack->at(i).functionName()); | 227 String functionName = String(callStack->at(i).functionName()); |
| 228 printf("\t%s\n", functionName.utf8().data()); | 228 printf("\t%s\n", functionName.utf8().data()); |
| 229 } | 229 } |
| 230 } | 230 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 407 } |
| 408 | 408 |
| 409 Page* Console::page() const | 409 Page* Console::page() const |
| 410 { | 410 { |
| 411 if (!m_frame) | 411 if (!m_frame) |
| 412 return 0; | 412 return 0; |
| 413 return m_frame->page(); | 413 return m_frame->page(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace WebCore | 416 } // namespace WebCore |
| OLD | NEW |