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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 76 |
77 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, const String& url, unsigned lineNumber, unsigned columnNumber, Pas sRefPtr<ScriptCallStack> callStack, ScriptState* state, unsigned long requestIde ntifier) | 77 void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str ing& message, const String& url, unsigned lineNumber, unsigned columnNumber, Pas sRefPtr<ScriptCallStack> callStack, ScriptState* state, unsigned long requestIde ntifier) |
78 { | 78 { |
79 if (muteCount && source != ConsoleAPIMessageSource) | 79 if (muteCount && source != ConsoleAPIMessageSource) |
80 return; | 80 return; |
81 | 81 |
82 Page* page = this->page(); | 82 Page* page = this->page(); |
83 if (!page) | 83 if (!page) |
84 return; | 84 return; |
85 | 85 |
86 String executionContextURL = page->mainFrame()->document()->url().string(); | |
87 bool reportDetailedMessage = (state && page->chrome().client()->shouldReport DetailedMessageForContext(state->context())) | |
88 || page->chrome().client()->shouldReportDetailedMessageForURL(url) | |
89 || page->chrome().client()->shouldReportDetailedMessageForURL(executionC ontextURL); | |
90 | |
91 OwnPtr<ConsoleMessage> consoleMessage = callStack | |
92 ? adoptPtr(new ConsoleMessage(reportDetailedMessage, source, LogMessageT ype, level, message, executionContextURL, callStack, requestIdentifier)) | |
93 : adoptPtr(new ConsoleMessage(reportDetailedMessage, source, LogMessageT ype, level, message, executionContextURL, url, lineNumber, columnNumber, state, requestIdentifier)); | |
abarth-chromium
2013/07/24 23:59:09
Can you extract some of this logic into a helper f
Devlin
2013/07/25 01:46:00
Done.
| |
94 | |
95 if (source != CSSMessageSource) | |
96 page->chrome().client()->addMessageToConsole(source, level, message, lin eNumber, url, consoleMessage->generateJSONWithoutArguments()->toJSONString()); | |
97 | |
86 if (callStack) | 98 if (callStack) |
87 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, callStack, requestIdentifier); | 99 InspectorInstrumentation::addMessageToConsole(page, consoleMessage.relea se()); |
88 else | 100 else |
89 InspectorInstrumentation::addMessageToConsole(page, source, LogMessageTy pe, level, message, url, lineNumber, columnNumber, state, requestIdentifier); | 101 InspectorInstrumentation::addMessageToConsole(page, consoleMessage.relea se(), true); |
90 | |
91 if (source == CSSMessageSource) | |
92 return; | |
93 | |
94 page->chrome().client()->addMessageToConsole(source, level, message, lineNum ber, url); | |
95 } | 102 } |
96 | 103 |
97 // static | 104 // static |
98 void PageConsole::mute() | 105 void PageConsole::mute() |
99 { | 106 { |
100 muteCount++; | 107 muteCount++; |
101 } | 108 } |
102 | 109 |
103 // static | 110 // static |
104 void PageConsole::unmute() | 111 void PageConsole::unmute() |
105 { | 112 { |
106 ASSERT(muteCount > 0); | 113 ASSERT(muteCount > 0); |
107 muteCount--; | 114 muteCount--; |
108 } | 115 } |
109 | 116 |
110 } // namespace WebCore | 117 } // namespace WebCore |
OLD | NEW |