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 10 matching lines...) Expand all Loading... |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "core/frame/FrameConsole.h" | 29 #include "core/frame/FrameConsole.h" |
30 | 30 |
31 #include "bindings/core/v8/ScriptCallStack.h" | 31 #include "bindings/core/v8/SourceLocation.h" |
32 #include "core/frame/FrameHost.h" | 32 #include "core/frame/FrameHost.h" |
33 #include "core/inspector/ConsoleMessage.h" | 33 #include "core/inspector/ConsoleMessage.h" |
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 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 void FrameConsole::reportMessageToClient(ConsoleMessage* consoleMessage) | 86 void FrameConsole::reportMessageToClient(ConsoleMessage* consoleMessage) |
87 { | 87 { |
88 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) | 88 if (muteCount && consoleMessage->source() != ConsoleAPIMessageSource) |
89 return; | 89 return; |
90 if (consoleMessage->source() == NetworkMessageSource) | 90 if (consoleMessage->source() == NetworkMessageSource) |
91 return; | 91 return; |
92 | 92 |
| 93 String url = consoleMessage->location()->url(); |
93 String stackTrace; | 94 String stackTrace; |
94 if (consoleMessage->source() == ConsoleAPIMessageSource) { | 95 if (consoleMessage->source() == ConsoleAPIMessageSource) { |
95 if (!frame().host() || (consoleMessage->scriptArguments() && !consoleMes
sage->scriptArguments()->argumentCount())) | 96 if (!frame().host() || (consoleMessage->scriptArguments() && !consoleMes
sage->scriptArguments()->argumentCount())) |
96 return; | 97 return; |
97 if (!allClientReportingMessageTypes().contains(consoleMessage->type())) | 98 if (!allClientReportingMessageTypes().contains(consoleMessage->type())) |
98 return; | 99 return; |
99 if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(),
consoleMessage->url())) { | 100 if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(),
url)) { |
100 RefPtr<ScriptCallStack> captured = ScriptCallStack::capture(); | 101 OwnPtr<SourceLocation> location = SourceLocation::captureWithFullSta
ckTrace(); |
101 if (captured) | 102 if (!location->isUnknown()) |
102 stackTrace = captured->toString(); | 103 stackTrace = location->toString(); |
103 } | 104 } |
104 } else { | 105 } else { |
105 if (consoleMessage->stackTrace() && frame().chromeClient().shouldReportD
etailedMessageForSource(frame(), consoleMessage->url())) | 106 if (!consoleMessage->location()->isUnknown() && frame().chromeClient().s
houldReportDetailedMessageForSource(frame(), url)) |
106 stackTrace = consoleMessage->stackTrace()->toString(); | 107 stackTrace = consoleMessage->location()->toString(); |
107 } | 108 } |
108 | 109 |
109 frame().chromeClient().addMessageToConsole(m_frame, consoleMessage->source()
, consoleMessage->level(), consoleMessage->message(), consoleMessage->lineNumber
(), consoleMessage->url(), stackTrace); | 110 frame().chromeClient().addMessageToConsole(m_frame, consoleMessage->source()
, consoleMessage->level(), consoleMessage->message(), consoleMessage->location()
->lineNumber(), url, stackTrace); |
110 } | 111 } |
111 | 112 |
112 void FrameConsole::reportWorkerMessage(ConsoleMessage* consoleMessage) | 113 void FrameConsole::reportWorkerMessage(ConsoleMessage* consoleMessage) |
113 { | 114 { |
114 reportMessageToClient(consoleMessage); | 115 reportMessageToClient(consoleMessage); |
115 } | 116 } |
116 | 117 |
117 void FrameConsole::adoptWorkerMessage(ConsoleMessage* consoleMessage) | 118 void FrameConsole::adoptWorkerMessage(ConsoleMessage* consoleMessage) |
118 { | 119 { |
119 addMessageToStorage(consoleMessage); | 120 addMessageToStorage(consoleMessage); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(NetworkMes
sageSource, ErrorMessageLevel, message.toString(), error.failingURL(), requestId
entifier); | 174 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(NetworkMes
sageSource, ErrorMessageLevel, message.toString(), error.failingURL(), requestId
entifier); |
174 storage->reportMessage(m_frame->document(), consoleMessage); | 175 storage->reportMessage(m_frame->document(), consoleMessage); |
175 } | 176 } |
176 | 177 |
177 DEFINE_TRACE(FrameConsole) | 178 DEFINE_TRACE(FrameConsole) |
178 { | 179 { |
179 visitor->trace(m_frame); | 180 visitor->trace(m_frame); |
180 } | 181 } |
181 | 182 |
182 } // namespace blink | 183 } // namespace blink |
OLD | NEW |