author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 3 | 41300fa6a67c |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (C) 2007 Apple Inc. All rights reserved. |
|
3 |
* |
|
4 |
* Redistribution and use in source and binary forms, with or without |
|
5 |
* modification, are permitted provided that the following conditions |
|
6 |
* are met: |
|
7 |
* |
|
8 |
* 1. Redistributions of source code must retain the above copyright |
|
9 |
* notice, this list of conditions and the following disclaimer. |
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright |
|
11 |
* notice, this list of conditions and the following disclaimer in the |
|
12 |
* documentation and/or other materials provided with the distribution. |
|
13 |
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
|
14 |
* its contributors may be used to endorse or promote products derived |
|
15 |
* from this software without specific prior written permission. |
|
16 |
* |
|
17 |
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
|
18 |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
20 |
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
|
21 |
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
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 |
|
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 |
|
26 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 |
*/ |
|
28 |
||
29 |
#include "config.h" |
|
30 |
#include "Console.h" |
|
31 |
||
32 |
#include "CString.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
33 |
#include "Chrome.h" |
0 | 34 |
#include "ChromeClient.h" |
35 |
#include "ConsoleMessage.h" |
|
36 |
#include "Frame.h" |
|
37 |
#include "FrameLoader.h" |
|
38 |
#include "FrameTree.h" |
|
39 |
#include "InspectorController.h" |
|
40 |
#include "Page.h" |
|
41 |
#include "PageGroup.h" |
|
42 |
#include "PlatformString.h" |
|
43 |
||
44 |
#include "ScriptCallStack.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
45 |
#include "ScriptProfile.h" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
46 |
#include "ScriptProfiler.h" |
0 | 47 |
#include <stdio.h> |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
#include <wtf/UnusedParam.h> |
0 | 49 |
|
50 |
namespace WebCore { |
|
51 |
||
52 |
Console::Console(Frame* frame) |
|
53 |
: m_frame(frame) |
|
54 |
{ |
|
55 |
} |
|
56 |
||
57 |
Frame* Console::frame() const |
|
58 |
{ |
|
59 |
return m_frame; |
|
60 |
} |
|
61 |
||
62 |
void Console::disconnectFrame() |
|
63 |
{ |
|
64 |
m_frame = 0; |
|
65 |
} |
|
66 |
||
67 |
static void printSourceURLAndLine(const String& sourceURL, unsigned lineNumber) |
|
68 |
{ |
|
69 |
if (!sourceURL.isEmpty()) { |
|
70 |
if (lineNumber > 0) |
|
71 |
printf("%s:%d: ", sourceURL.utf8().data(), lineNumber); |
|
72 |
else |
|
73 |
printf("%s: ", sourceURL.utf8().data()); |
|
74 |
} |
|
75 |
} |
|
76 |
||
77 |
static bool getFirstArgumentAsString(ScriptState* scriptState, const ScriptCallFrame& callFrame, String& result, bool checkForNullOrUndefined = false) |
|
78 |
{ |
|
79 |
if (!callFrame.argumentCount()) |
|
80 |
return false; |
|
81 |
||
82 |
const ScriptValue& value = callFrame.argumentAt(0); |
|
83 |
if (checkForNullOrUndefined && (value.isNull() || value.isUndefined())) |
|
84 |
return false; |
|
85 |
||
86 |
result = value.toString(scriptState); |
|
87 |
return true; |
|
88 |
} |
|
89 |
||
90 |
static void printMessageSourceAndLevelPrefix(MessageSource source, MessageLevel level) |
|
91 |
{ |
|
92 |
const char* sourceString; |
|
93 |
switch (source) { |
|
94 |
case HTMLMessageSource: |
|
95 |
sourceString = "HTML"; |
|
96 |
break; |
|
97 |
case WMLMessageSource: |
|
98 |
sourceString = "WML"; |
|
99 |
break; |
|
100 |
case XMLMessageSource: |
|
101 |
sourceString = "XML"; |
|
102 |
break; |
|
103 |
case JSMessageSource: |
|
104 |
sourceString = "JS"; |
|
105 |
break; |
|
106 |
case CSSMessageSource: |
|
107 |
sourceString = "CSS"; |
|
108 |
break; |
|
109 |
case OtherMessageSource: |
|
110 |
sourceString = "OTHER"; |
|
111 |
break; |
|
112 |
default: |
|
113 |
ASSERT_NOT_REACHED(); |
|
114 |
sourceString = "UNKNOWN"; |
|
115 |
break; |
|
116 |
} |
|
117 |
||
118 |
const char* levelString; |
|
119 |
switch (level) { |
|
120 |
case TipMessageLevel: |
|
121 |
levelString = "TIP"; |
|
122 |
break; |
|
123 |
case LogMessageLevel: |
|
124 |
levelString = "LOG"; |
|
125 |
break; |
|
126 |
case WarningMessageLevel: |
|
127 |
levelString = "WARN"; |
|
128 |
break; |
|
129 |
case ErrorMessageLevel: |
|
130 |
levelString = "ERROR"; |
|
131 |
break; |
|
132 |
case DebugMessageLevel: |
|
133 |
levelString = "DEBUG"; |
|
134 |
break; |
|
135 |
default: |
|
136 |
ASSERT_NOT_REACHED(); |
|
137 |
levelString = "UNKNOWN"; |
|
138 |
break; |
|
139 |
} |
|
140 |
||
141 |
printf("%s %s:", sourceString, levelString); |
|
142 |
} |
|
143 |
||
144 |
void Console::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) |
|
145 |
{ |
|
146 |
Page* page = this->page(); |
|
147 |
if (!page) |
|
148 |
return; |
|
149 |
||
150 |
if (source == JSMessageSource) |
|
151 |
page->chrome()->client()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL); |
|
152 |
||
153 |
#if ENABLE(INSPECTOR) |
|
154 |
page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL); |
|
155 |
#endif |
|
156 |
||
157 |
if (!Console::shouldPrintExceptions()) |
|
158 |
return; |
|
159 |
||
160 |
printSourceURLAndLine(sourceURL, lineNumber); |
|
161 |
printMessageSourceAndLevelPrefix(source, level); |
|
162 |
||
163 |
printf(" %s\n", message.utf8().data()); |
|
164 |
} |
|
165 |
||
166 |
void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments) |
|
167 |
{ |
|
168 |
Page* page = this->page(); |
|
169 |
if (!page) |
|
170 |
return; |
|
171 |
||
172 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
|
173 |
||
174 |
if (!acceptNoArguments && !lastCaller.argumentCount()) |
|
175 |
return; |
|
176 |
||
177 |
String message; |
|
178 |
if (getFirstArgumentAsString(callStack->state(), lastCaller, message)) |
|
179 |
page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL()); |
|
180 |
||
181 |
#if ENABLE(INSPECTOR) |
|
182 |
page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack); |
|
183 |
#endif |
|
184 |
||
185 |
if (!Console::shouldPrintExceptions()) |
|
186 |
return; |
|
187 |
||
188 |
printSourceURLAndLine(lastCaller.sourceURL().prettyURL(), 0); |
|
189 |
printMessageSourceAndLevelPrefix(JSMessageSource, level); |
|
190 |
||
191 |
for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) { |
|
192 |
String argAsString; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
193 |
if (lastCaller.argumentAt(i).getString(callStack->state(), argAsString)) |
0 | 194 |
printf(" %s", argAsString.utf8().data()); |
195 |
} |
|
196 |
printf("\n"); |
|
197 |
} |
|
198 |
||
199 |
void Console::debug(ScriptCallStack* callStack) |
|
200 |
{ |
|
201 |
// In Firebug, console.debug has the same behavior as console.log. So we'll do the same. |
|
202 |
log(callStack); |
|
203 |
} |
|
204 |
||
205 |
void Console::error(ScriptCallStack* callStack) |
|
206 |
{ |
|
207 |
addMessage(LogMessageType, ErrorMessageLevel, callStack); |
|
208 |
} |
|
209 |
||
210 |
void Console::info(ScriptCallStack* callStack) |
|
211 |
{ |
|
212 |
log(callStack); |
|
213 |
} |
|
214 |
||
215 |
void Console::log(ScriptCallStack* callStack) |
|
216 |
{ |
|
217 |
addMessage(LogMessageType, LogMessageLevel, callStack); |
|
218 |
} |
|
219 |
||
220 |
void Console::dir(ScriptCallStack* callStack) |
|
221 |
{ |
|
222 |
addMessage(ObjectMessageType, LogMessageLevel, callStack); |
|
223 |
} |
|
224 |
||
225 |
void Console::dirxml(ScriptCallStack* callStack) |
|
226 |
{ |
|
227 |
// The standard behavior of our console.log will print the DOM tree for nodes. |
|
228 |
log(callStack); |
|
229 |
} |
|
230 |
||
231 |
void Console::trace(ScriptCallStack* callStack) |
|
232 |
{ |
|
233 |
addMessage(TraceMessageType, LogMessageLevel, callStack, true); |
|
234 |
||
235 |
if (!shouldPrintExceptions()) |
|
236 |
return; |
|
237 |
||
238 |
printf("Stack Trace\n"); |
|
239 |
for (unsigned i = 0; i < callStack->size(); ++i) { |
|
240 |
String functionName = String(callStack->at(i).functionName()); |
|
241 |
printf("\t%s\n", functionName.utf8().data()); |
|
242 |
} |
|
243 |
} |
|
244 |
||
245 |
void Console::assertCondition(bool condition, ScriptCallStack* callStack) |
|
246 |
{ |
|
247 |
if (condition) |
|
248 |
return; |
|
249 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
250 |
addMessage(AssertMessageType, ErrorMessageLevel, callStack, true); |
0 | 251 |
} |
252 |
||
253 |
void Console::count(ScriptCallStack* callStack) |
|
254 |
{ |
|
255 |
#if ENABLE(INSPECTOR) |
|
256 |
Page* page = this->page(); |
|
257 |
if (!page) |
|
258 |
return; |
|
259 |
||
260 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
|
261 |
// Follow Firebug's behavior of counting with null and undefined title in |
|
262 |
// the same bucket as no argument |
|
263 |
String title; |
|
264 |
getFirstArgumentAsString(callStack->state(), lastCaller, title); |
|
265 |
||
266 |
page->inspectorController()->count(title, lastCaller.lineNumber(), lastCaller.sourceURL().string()); |
|
267 |
#else |
|
268 |
UNUSED_PARAM(callStack); |
|
269 |
#endif |
|
270 |
} |
|
271 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
272 |
void Console::markTimeline(ScriptCallStack* callStack) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
273 |
{ |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
274 |
#if ENABLE(INSPECTOR) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
275 |
Page* page = this->page(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
276 |
if (!page) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
277 |
return; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
278 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
279 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
280 |
String message; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
281 |
getFirstArgumentAsString(callStack->state(), lastCaller, message); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
282 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
283 |
page->inspectorController()->markTimeline(message); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
284 |
#else |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
285 |
UNUSED_PARAM(callStack); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
286 |
#endif |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
287 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
288 |
|
0 | 289 |
#if ENABLE(WML) |
290 |
String Console::lastWMLErrorMessage() const |
|
291 |
{ |
|
292 |
Page* page = this->page(); |
|
293 |
if (!page) |
|
294 |
return String(); |
|
295 |
||
296 |
const Vector<ConsoleMessage*>& consoleMessages = page->inspectorController()->consoleMessages(); |
|
297 |
if (consoleMessages.isEmpty()) |
|
298 |
return String(); |
|
299 |
||
300 |
Vector<ConsoleMessage*>::const_iterator it = consoleMessages.begin(); |
|
301 |
const Vector<ConsoleMessage*>::const_iterator end = consoleMessages.end(); |
|
302 |
||
303 |
for (; it != end; ++it) { |
|
304 |
ConsoleMessage* message = *it; |
|
305 |
if (message->source() != WMLMessageSource) |
|
306 |
continue; |
|
307 |
||
308 |
return message->message(); |
|
309 |
} |
|
310 |
||
311 |
return String(); |
|
312 |
} |
|
313 |
#endif |
|
314 |
||
315 |
#if ENABLE(JAVASCRIPT_DEBUGGER) |
|
316 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
317 |
void Console::profile(const String& title, ScriptCallStack* callStack) |
0 | 318 |
{ |
319 |
Page* page = this->page(); |
|
320 |
if (!page) |
|
321 |
return; |
|
322 |
||
323 |
#if ENABLE(INSPECTOR) |
|
324 |
InspectorController* controller = page->inspectorController(); |
|
325 |
// FIXME: log a console message when profiling is disabled. |
|
326 |
if (!controller->profilerEnabled()) |
|
327 |
return; |
|
328 |
#endif |
|
329 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
330 |
String resolvedTitle = title; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
331 |
if (title.isNull()) // no title so give it the next user initiated profile title. |
0 | 332 |
#if ENABLE(INSPECTOR) |
333 |
resolvedTitle = controller->getCurrentUserInitiatedProfileName(true); |
|
334 |
#else |
|
335 |
resolvedTitle = ""; |
|
336 |
#endif |
|
337 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
338 |
ScriptProfiler::start(callStack->state(), resolvedTitle); |
0 | 339 |
|
340 |
#if ENABLE(INSPECTOR) |
|
341 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
|
342 |
controller->addStartProfilingMessageToConsole(resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL()); |
|
343 |
#endif |
|
344 |
} |
|
345 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
346 |
void Console::profileEnd(const String& title, ScriptCallStack* callStack) |
0 | 347 |
{ |
348 |
Page* page = this->page(); |
|
349 |
if (!page) |
|
350 |
return; |
|
351 |
||
352 |
#if ENABLE(INSPECTOR) |
|
353 |
InspectorController* controller = page->inspectorController(); |
|
354 |
if (!controller->profilerEnabled()) |
|
355 |
return; |
|
356 |
#endif |
|
357 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
358 |
RefPtr<ScriptProfile> profile = ScriptProfiler::stop(callStack->state(), title); |
0 | 359 |
if (!profile) |
360 |
return; |
|
361 |
||
362 |
m_profiles.append(profile); |
|
363 |
||
364 |
#if ENABLE(INSPECTOR) |
|
365 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
|
366 |
controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); |
|
367 |
#endif |
|
368 |
} |
|
369 |
||
370 |
#endif |
|
371 |
||
372 |
void Console::time(const String& title) |
|
373 |
{ |
|
374 |
#if ENABLE(INSPECTOR) |
|
375 |
Page* page = this->page(); |
|
376 |
if (!page) |
|
377 |
return; |
|
378 |
||
379 |
// Follow Firebug's behavior of requiring a title that is not null or |
|
380 |
// undefined for timing functions |
|
381 |
if (title.isNull()) |
|
382 |
return; |
|
383 |
||
384 |
page->inspectorController()->startTiming(title); |
|
385 |
#else |
|
386 |
UNUSED_PARAM(title); |
|
387 |
#endif |
|
388 |
} |
|
389 |
||
390 |
void Console::timeEnd(const String& title, ScriptCallStack* callStack) |
|
391 |
{ |
|
392 |
#if ENABLE(INSPECTOR) |
|
393 |
Page* page = this->page(); |
|
394 |
if (!page) |
|
395 |
return; |
|
396 |
||
397 |
// Follow Firebug's behavior of requiring a title that is not null or |
|
398 |
// undefined for timing functions |
|
399 |
if (title.isNull()) |
|
400 |
return; |
|
401 |
||
402 |
double elapsed; |
|
403 |
if (!page->inspectorController()->stopTiming(title, elapsed)) |
|
404 |
return; |
|
405 |
||
406 |
String message = title + String::format(": %.0fms", elapsed); |
|
407 |
||
408 |
const ScriptCallFrame& lastCaller = callStack->at(0); |
|
409 |
page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL().string()); |
|
410 |
#else |
|
411 |
UNUSED_PARAM(title); |
|
412 |
UNUSED_PARAM(callStack); |
|
413 |
#endif |
|
414 |
} |
|
415 |
||
416 |
void Console::group(ScriptCallStack* callStack) |
|
417 |
{ |
|
418 |
#if ENABLE(INSPECTOR) |
|
419 |
Page* page = this->page(); |
|
420 |
if (!page) |
|
421 |
return; |
|
422 |
||
423 |
page->inspectorController()->startGroup(JSMessageSource, callStack); |
|
424 |
#else |
|
425 |
UNUSED_PARAM(callStack); |
|
426 |
#endif |
|
427 |
} |
|
428 |
||
429 |
void Console::groupEnd() |
|
430 |
{ |
|
431 |
#if ENABLE(INSPECTOR) |
|
432 |
Page* page = this->page(); |
|
433 |
if (!page) |
|
434 |
return; |
|
435 |
||
436 |
page->inspectorController()->endGroup(JSMessageSource, 0, String()); |
|
437 |
#endif |
|
438 |
} |
|
439 |
||
440 |
void Console::warn(ScriptCallStack* callStack) |
|
441 |
{ |
|
442 |
addMessage(LogMessageType, WarningMessageLevel, callStack); |
|
443 |
} |
|
444 |
||
445 |
static bool printExceptions = false; |
|
446 |
||
447 |
bool Console::shouldPrintExceptions() |
|
448 |
{ |
|
449 |
return printExceptions; |
|
450 |
} |
|
451 |
||
452 |
void Console::setShouldPrintExceptions(bool print) |
|
453 |
{ |
|
454 |
printExceptions = print; |
|
455 |
} |
|
456 |
||
457 |
Page* Console::page() const |
|
458 |
{ |
|
459 |
if (!m_frame) |
|
460 |
return 0; |
|
461 |
return m_frame->page(); |
|
462 |
} |
|
463 |
||
464 |
} // namespace WebCore |