| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 jsonObj->setString("source", messageSourceValue(m_source)); | 132 jsonObj->setString("source", messageSourceValue(m_source)); |
| 133 // FIXME: only send out type for ConsoleAPI source messages. | 133 // FIXME: only send out type for ConsoleAPI source messages. |
| 134 jsonObj->setString("type", messageTypeValue(m_type)); | 134 jsonObj->setString("type", messageTypeValue(m_type)); |
| 135 jsonObj->setString("level", messageLevelValue(m_level)); | 135 jsonObj->setString("level", messageLevelValue(m_level)); |
| 136 jsonObj->setNumber("line", static_cast<int>(m_line)); | 136 jsonObj->setNumber("line", static_cast<int>(m_line)); |
| 137 jsonObj->setString("url", m_url); | 137 jsonObj->setString("url", m_url); |
| 138 jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount)); | 138 jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount)); |
| 139 jsonObj->setString("text", m_message); | 139 jsonObj->setString("text", m_message); |
| 140 if (m_source == NetworkMessageSource && !m_requestId.isEmpty()) | 140 if (m_source == NetworkMessageSource && !m_requestId.isEmpty()) |
| 141 jsonObj->setString("networkRequestId", m_requestId); | 141 jsonObj->setString("networkRequestId", m_requestId); |
| 142 if (m_arguments && m_arguments->argumentCount()) { | 142 if (m_arguments) { |
| 143 InjectedScript injectedScript = injectedScriptManager->injectedScriptFor
(m_arguments->globalState()); | 143 RefPtr<InspectorArray> jsonArgs = m_arguments->wrap(injectedScriptManage
r); |
| 144 if (!injectedScript.hasNoValue()) { | 144 if (jsonArgs) |
| 145 RefPtr<InspectorArray> jsonArgs = InspectorArray::create(); | 145 jsonObj->setArray("parameters", jsonArgs.release()); |
| 146 for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) { | |
| 147 RefPtr<InspectorValue> inspectorValue = injectedScript.wrapObjec
t(m_arguments->argumentAt(i), "console"); | |
| 148 if (!inspectorValue) { | |
| 149 ASSERT_NOT_REACHED(); | |
| 150 return; | |
| 151 } | |
| 152 jsonArgs->pushValue(inspectorValue); | |
| 153 } | |
| 154 jsonObj->setArray("parameters", jsonArgs); | |
| 155 } | |
| 156 } | 146 } |
| 157 if (m_callStack) | 147 if (m_callStack) |
| 158 jsonObj->setArray("stackTrace", m_callStack->buildInspectorArray()); | 148 jsonObj->setArray("stackTrace", m_callStack->buildInspectorArray()); |
| 159 frontend->messageAdded(jsonObj); | 149 frontend->messageAdded(jsonObj); |
| 160 } | 150 } |
| 161 | 151 |
| 162 void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend::Console* fron
tend) | 152 void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend::Console* fron
tend) |
| 163 { | 153 { |
| 164 frontend->messageRepeatCountUpdated(m_repeatCount); | 154 frontend->messageRepeatCountUpdated(m_repeatCount); |
| 165 } | 155 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 182 && msg->m_type == m_type | 172 && msg->m_type == m_type |
| 183 && msg->m_level == m_level | 173 && msg->m_level == m_level |
| 184 && msg->m_message == m_message | 174 && msg->m_message == m_message |
| 185 && msg->m_line == m_line | 175 && msg->m_line == m_line |
| 186 && msg->m_url == m_url | 176 && msg->m_url == m_url |
| 187 && msg->m_requestId == m_requestId; | 177 && msg->m_requestId == m_requestId; |
| 188 } | 178 } |
| 189 | 179 |
| 190 void ConsoleMessage::windowCleared(DOMWindow* window) | 180 void ConsoleMessage::windowCleared(DOMWindow* window) |
| 191 { | 181 { |
| 192 if (!m_arguments) | 182 if (!m_arguments || m_arguments->domWindow() != window) |
| 193 return; | |
| 194 if (domWindowFromScriptState(m_arguments->globalState()) != window) | |
| 195 return; | 183 return; |
| 196 if (!m_message) | 184 if (!m_message) |
| 197 m_message = "<message collected>"; | 185 m_message = "<message collected>"; |
| 198 m_arguments.clear(); | 186 m_arguments.clear(); |
| 199 } | 187 } |
| 200 | 188 |
| 201 } // namespace WebCore | 189 } // namespace WebCore |
| 202 | 190 |
| 203 #endif // ENABLE(INSPECTOR) | 191 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |