| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/inspector/ConsoleMessageStorage.h" | 34 #include "core/inspector/ConsoleMessageStorage.h" |
| 35 #include "core/inspector/InspectorConsoleInstrumentation.h" | 35 #include "core/inspector/InspectorConsoleInstrumentation.h" |
| 36 #include "core/page/ChromeClient.h" | 36 #include "core/page/ChromeClient.h" |
| 37 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
| 38 #include "platform/network/ResourceError.h" | 38 #include "platform/network/ResourceError.h" |
| 39 #include "platform/network/ResourceResponse.h" | 39 #include "platform/network/ResourceResponse.h" |
| 40 #include "wtf/text/StringBuilder.h" | 40 #include "wtf/text/StringBuilder.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 static const HashSet<int>& allClientReportingMessageTypes() | |
| 45 { | |
| 46 DEFINE_STATIC_LOCAL(HashSet<int>, types, ()); | |
| 47 if (types.isEmpty()) { | |
| 48 types.add(LogMessageType); | |
| 49 types.add(DirMessageType); | |
| 50 types.add(DirXMLMessageType); | |
| 51 types.add(TableMessageType); | |
| 52 types.add(TraceMessageType); | |
| 53 types.add(ClearMessageType); | |
| 54 types.add(AssertMessageType); | |
| 55 } | |
| 56 return types; | |
| 57 } | |
| 58 | |
| 59 namespace { | 44 namespace { |
| 60 | 45 |
| 61 int muteCount = 0; | 46 int muteCount = 0; |
| 62 | 47 |
| 63 } | 48 } |
| 64 | 49 |
| 65 FrameConsole::FrameConsole(LocalFrame& frame) | 50 FrameConsole::FrameConsole(LocalFrame& frame) |
| 66 : m_frame(&frame) | 51 : m_frame(&frame) |
| 67 { | 52 { |
| 68 } | 53 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 void FrameConsole::reportMessageToClient(ConsoleMessage* consoleMessage) | 71 void FrameConsole::reportMessageToClient(ConsoleMessage* consoleMessage) |
| 87 { | 72 { |
| 88 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) | 73 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) |
| 89 return; | 74 return; |
| 90 if (consoleMessage->source() == NetworkMessageSource) | 75 if (consoleMessage->source() == NetworkMessageSource) |
| 91 return; | 76 return; |
| 92 | 77 |
| 93 String url = consoleMessage->location()->url(); | 78 String url = consoleMessage->location()->url(); |
| 94 String stackTrace; | 79 String stackTrace; |
| 95 if (consoleMessage->source() == ConsoleAPIMessageSource) { | 80 if (consoleMessage->source() == ConsoleAPIMessageSource) { |
| 96 if (!frame().host() || (consoleMessage->scriptArguments() && !consoleMes
sage->scriptArguments()->argumentCount())) | 81 if (!frame().host()) |
| 97 return; | |
| 98 if (!allClientReportingMessageTypes().contains(consoleMessage->type())) | |
| 99 return; | 82 return; |
| 100 if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(),
url)) { | 83 if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(),
url)) { |
| 101 OwnPtr<SourceLocation> location = SourceLocation::captureWithFullSta
ckTrace(); | 84 OwnPtr<SourceLocation> location = SourceLocation::captureWithFullSta
ckTrace(); |
| 102 if (!location->isUnknown()) | 85 if (!location->isUnknown()) |
| 103 stackTrace = location->toString(); | 86 stackTrace = location->toString(); |
| 104 } | 87 } |
| 105 } else { | 88 } else { |
| 106 if (!consoleMessage->location()->isUnknown() && frame().chromeClient().s
houldReportDetailedMessageForSource(frame(), url)) | 89 if (!consoleMessage->location()->isUnknown() && frame().chromeClient().s
houldReportDetailedMessageForSource(frame(), url)) |
| 107 stackTrace = consoleMessage->location()->toString(); | 90 stackTrace = consoleMessage->location()->toString(); |
| 108 } | 91 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(NetworkMes
sageSource, ErrorMessageLevel, message.toString(), error.failingURL(), requestId
entifier); | 157 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(NetworkMes
sageSource, ErrorMessageLevel, message.toString(), error.failingURL(), requestId
entifier); |
| 175 storage->reportMessage(m_frame->document(), consoleMessage); | 158 storage->reportMessage(m_frame->document(), consoleMessage); |
| 176 } | 159 } |
| 177 | 160 |
| 178 DEFINE_TRACE(FrameConsole) | 161 DEFINE_TRACE(FrameConsole) |
| 179 { | 162 { |
| 180 visitor->trace(m_frame); | 163 visitor->trace(m_frame); |
| 181 } | 164 } |
| 182 | 165 |
| 183 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |