| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 59 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
| 60 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) | 60 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 // FIXME: This should not need to reach for the main-frame. | 63 // FIXME: This should not need to reach for the main-frame. |
| 64 // Inspector code should just take the current frame and know how to walk it
self. | 64 // Inspector code should just take the current frame and know how to walk it
self. |
| 65 ExecutionContext* context = m_frame.document(); | 65 ExecutionContext* context = m_frame.document(); |
| 66 if (!context) | 66 if (!context) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 InspectorInstrumentation::addMessageToConsole(context, consoleMessage.get())
; | |
| 70 | |
| 71 if (consoleMessage->source() == CSSMessageSource) | |
| 72 return; | |
| 73 | |
| 74 String messageURL; | 69 String messageURL; |
| 75 unsigned lineNumber = 0; | 70 unsigned lineNumber = 0; |
| 76 if (consoleMessage->callStack()) { | 71 if (consoleMessage->callStack() && consoleMessage->callStack()->size()) { |
| 77 lineNumber = consoleMessage->callStack()->at(0).lineNumber(); | 72 lineNumber = consoleMessage->callStack()->at(0).lineNumber(); |
| 78 messageURL = consoleMessage->callStack()->at(0).sourceURL(); | 73 messageURL = consoleMessage->callStack()->at(0).sourceURL(); |
| 79 } else { | 74 } else { |
| 80 lineNumber = consoleMessage->lineNumber(); | 75 lineNumber = consoleMessage->lineNumber(); |
| 81 messageURL = consoleMessage->url(); | 76 messageURL = consoleMessage->url(); |
| 82 } | 77 } |
| 83 | 78 |
| 79 messageStorage()->reportMessage(consoleMessage); |
| 80 |
| 81 if (consoleMessage->source() == CSSMessageSource) |
| 82 return; |
| 83 |
| 84 RefPtrWillBeRawPtr<ScriptCallStack> reportedCallStack = nullptr; | 84 RefPtrWillBeRawPtr<ScriptCallStack> reportedCallStack = nullptr; |
| 85 if (consoleMessage->source() != ConsoleAPIMessageSource) { | 85 if (consoleMessage->source() != ConsoleAPIMessageSource) { |
| 86 if (consoleMessage->callStack() && m_frame.chromeClient().shouldReportDe
tailedMessageForSource(messageURL)) | 86 if (consoleMessage->callStack() && m_frame.chromeClient().shouldReportDe
tailedMessageForSource(messageURL)) |
| 87 reportedCallStack = consoleMessage->callStack(); | 87 reportedCallStack = consoleMessage->callStack(); |
| 88 } else { | 88 } else { |
| 89 if (!m_frame.host() || (consoleMessage->scriptArguments() && consoleMess
age->scriptArguments()->argumentCount() == 0)) | 89 if (!m_frame.host() || (consoleMessage->scriptArguments() && consoleMess
age->scriptArguments()->argumentCount() == 0)) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 MessageType type = consoleMessage->type(); | 92 MessageType type = consoleMessage->type(); |
| 93 if (type == StartGroupMessageType || type == EndGroupMessageType || type
== StartGroupCollapsedMessageType) | 93 if (type == StartGroupMessageType || type == EndGroupMessageType || type
== StartGroupCollapsedMessageType) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 { | 125 { |
| 126 muteCount++; | 126 muteCount++; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void FrameConsole::unmute() | 129 void FrameConsole::unmute() |
| 130 { | 130 { |
| 131 ASSERT(muteCount > 0); | 131 ASSERT(muteCount > 0); |
| 132 muteCount--; | 132 muteCount--; |
| 133 } | 133 } |
| 134 | 134 |
| 135 ConsoleMessageStorage* FrameConsole::messageStorage() |
| 136 { |
| 137 LocalFrame* curFrame = &m_frame; |
| 138 Frame* topFrame = curFrame->tree().top(); |
| 139 ASSERT(topFrame->isLocalFrame()); |
| 140 LocalFrame* localTopFrame = toLocalFrame(topFrame); |
| 141 if (localTopFrame != curFrame) |
| 142 return localTopFrame->console().messageStorage(); |
| 143 if (!m_consoleMessageStorage) |
| 144 m_consoleMessageStorage = ConsoleMessageStorage::create(&m_frame); |
| 145 return m_consoleMessageStorage.get(); |
| 146 } |
| 147 |
| 135 void FrameConsole::adoptWorkerConsoleMessages(WorkerGlobalScopeProxy* proxy) | 148 void FrameConsole::adoptWorkerConsoleMessages(WorkerGlobalScopeProxy* proxy) |
| 136 { | 149 { |
| 137 InspectorInstrumentation::adoptWorkerConsoleMessages(m_frame.document(), pro
xy); | 150 InspectorInstrumentation::adoptWorkerConsoleMessages(m_frame.document(), pro
xy); |
| 138 } | 151 } |
| 139 | 152 |
| 140 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |