| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 int muteCount = 0; | 63 int muteCount = 0; |
| 64 | 64 |
| 65 } | 65 } |
| 66 | 66 |
| 67 FrameConsole::FrameConsole(LocalFrame& frame) | 67 FrameConsole::FrameConsole(LocalFrame& frame) |
| 68 : m_frame(&frame) | 68 : m_frame(&frame) |
| 69 { | 69 { |
| 70 } | 70 } |
| 71 | 71 |
| 72 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(FrameConsole); | 72 void FrameConsole::addMessage(RawPtr<ConsoleMessage> prpConsoleMessage) |
| 73 | |
| 74 void FrameConsole::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleM
essage) | |
| 75 { | 73 { |
| 76 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 74 RawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
| 77 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) | 75 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) |
| 78 return; | 76 return; |
| 79 | 77 |
| 80 // FIXME: This should not need to reach for the main-frame. | 78 // FIXME: This should not need to reach for the main-frame. |
| 81 // Inspector code should just take the current frame and know how to walk it
self. | 79 // Inspector code should just take the current frame and know how to walk it
self. |
| 82 ExecutionContext* context = frame().document(); | 80 ExecutionContext* context = frame().document(); |
| 83 if (!context) | 81 if (!context) |
| 84 return; | 82 return; |
| 85 if (!messageStorage()) | 83 if (!messageStorage()) |
| 86 return; | 84 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 121 |
| 124 void FrameConsole::reportResourceResponseReceived(DocumentLoader* loader, unsign
ed long requestIdentifier, const ResourceResponse& response) | 122 void FrameConsole::reportResourceResponseReceived(DocumentLoader* loader, unsign
ed long requestIdentifier, const ResourceResponse& response) |
| 125 { | 123 { |
| 126 if (!loader) | 124 if (!loader) |
| 127 return; | 125 return; |
| 128 if (response.httpStatusCode() < 400) | 126 if (response.httpStatusCode() < 400) |
| 129 return; | 127 return; |
| 130 if (response.wasFallbackRequiredByServiceWorker()) | 128 if (response.wasFallbackRequiredByServiceWorker()) |
| 131 return; | 129 return; |
| 132 String message = "Failed to load resource: the server responded with a statu
s of " + String::number(response.httpStatusCode()) + " (" + response.httpStatusT
ext() + ')'; | 130 String message = "Failed to load resource: the server responded with a statu
s of " + String::number(response.httpStatusCode()) + " (" + response.httpStatusT
ext() + ')'; |
| 133 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(N
etworkMessageSource, ErrorMessageLevel, message, response.url().getString()); | 131 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(NetworkMessag
eSource, ErrorMessageLevel, message, response.url().getString()); |
| 134 consoleMessage->setRequestIdentifier(requestIdentifier); | 132 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 135 addMessage(consoleMessage.release()); | 133 addMessage(consoleMessage.release()); |
| 136 } | 134 } |
| 137 | 135 |
| 138 void FrameConsole::mute() | 136 void FrameConsole::mute() |
| 139 { | 137 { |
| 140 muteCount++; | 138 muteCount++; |
| 141 } | 139 } |
| 142 | 140 |
| 143 void FrameConsole::unmute() | 141 void FrameConsole::unmute() |
| (...skipping 29 matching lines...) Expand all Loading... |
| 173 return; | 171 return; |
| 174 ConsoleMessageStorage* storage = messageStorage(); | 172 ConsoleMessageStorage* storage = messageStorage(); |
| 175 if (!storage) | 173 if (!storage) |
| 176 return; | 174 return; |
| 177 StringBuilder message; | 175 StringBuilder message; |
| 178 message.appendLiteral("Failed to load resource"); | 176 message.appendLiteral("Failed to load resource"); |
| 179 if (!error.localizedDescription().isEmpty()) { | 177 if (!error.localizedDescription().isEmpty()) { |
| 180 message.appendLiteral(": "); | 178 message.appendLiteral(": "); |
| 181 message.append(error.localizedDescription()); | 179 message.append(error.localizedDescription()); |
| 182 } | 180 } |
| 183 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(N
etworkMessageSource, ErrorMessageLevel, message.toString(), error.failingURL()); | 181 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(NetworkMessag
eSource, ErrorMessageLevel, message.toString(), error.failingURL()); |
| 184 consoleMessage->setRequestIdentifier(requestIdentifier); | 182 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 185 storage->reportMessage(m_frame->document(), consoleMessage.release()); | 183 storage->reportMessage(m_frame->document(), consoleMessage.release()); |
| 186 } | 184 } |
| 187 | 185 |
| 188 DEFINE_TRACE(FrameConsole) | 186 DEFINE_TRACE(FrameConsole) |
| 189 { | 187 { |
| 190 visitor->trace(m_frame); | 188 visitor->trace(m_frame); |
| 191 } | 189 } |
| 192 | 190 |
| 193 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |