weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 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 | |
aroben@apple.com | a7c639a | 2009-12-18 17:38:45 +0000 | [diff] [blame] | 32 | #include "Chrome.h" |
levin@chromium.org | 4e1469c | 2009-07-23 16:52:50 +0000 | [diff] [blame] | 33 | #include "ChromeClient.h" |
mkwst@chromium.org | 236e898 | 2012-12-11 16:10:06 +0000 | [diff] [blame] | 34 | #include "ConsoleAPITypes.h" |
| 35 | #include "ConsoleTypes.h" |
mkwst@chromium.org | d2e0adc | 2012-12-05 10:02:25 +0000 | [diff] [blame] | 36 | #include "Document.h" |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 37 | #include "Frame.h" |
| 38 | #include "FrameLoader.h" |
kmccullough@apple.com | d9e61e0 | 2008-04-24 17:20:01 +0000 | [diff] [blame] | 39 | #include "FrameTree.h" |
yurys@chromium.org | 4fcd1c8 | 2011-01-24 10:20:57 +0000 | [diff] [blame] | 40 | #include "InspectorConsoleInstrumentation.h" |
commit-queue@webkit.org | 4c49a66 | 2011-01-02 22:27:10 +0000 | [diff] [blame] | 41 | #include "InspectorController.h" |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 42 | #include "Page.h" |
commit-queue@webkit.org | 7195ba5 | 2013-03-19 15:54:14 +0000 | [diff] [blame] | 43 | #include "PageConsole.h" |
kmccullough@apple.com | d9e61e0 | 2008-04-24 17:20:01 +0000 | [diff] [blame] | 44 | #include "PageGroup.h" |
yurys@chromium.org | 02ff0d6 | 2010-11-08 14:05:32 +0000 | [diff] [blame] | 45 | #include "ScriptArguments.h" |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 46 | #include "ScriptCallStack.h" |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 47 | #include "ScriptCallStackFactory.h" |
eric@webkit.org | cd8a5d5 | 2010-02-03 10:54:28 +0000 | [diff] [blame] | 48 | #include "ScriptProfile.h" |
| 49 | #include "ScriptProfiler.h" |
mkwst@chromium.org | d2e0adc | 2012-12-05 10:02:25 +0000 | [diff] [blame] | 50 | #include "ScriptableDocumentParser.h" |
mkwst@chromium.org | f7c6179 | 2012-12-11 09:17:59 +0000 | [diff] [blame] | 51 | #include "Settings.h" |
joepeck@webkit.org | a319844 | 2013-12-11 22:40:23 +0000 | [diff] [blame] | 52 | #include <bindings/ScriptValue.h> |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 53 | #include <stdio.h> |
weinig@apple.com | 771c7a2 | 2011-05-01 23:56:41 +0000 | [diff] [blame] | 54 | #include <wtf/text/CString.h> |
weinig@apple.com | 3f5ab02 | 2012-09-06 17:36:48 +0000 | [diff] [blame] | 55 | #include <wtf/text/WTFString.h> |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 56 | |
| 57 | namespace WebCore { |
| 58 | |
| 59 | Console::Console(Frame* frame) |
abarth@webkit.org | 84fe60e | 2012-01-07 08:46:38 +0000 | [diff] [blame] | 60 | : DOMWindowProperty(frame) |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 61 | { |
| 62 | } |
| 63 | |
weinig@apple.com | f25e6ff | 2011-05-11 19:03:20 +0000 | [diff] [blame] | 64 | Console::~Console() |
| 65 | { |
| 66 | } |
| 67 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 68 | static void internalAddMessage(Page* page, MessageType type, MessageLevel level, JSC::ExecState* state, PassRefPtr<ScriptArguments> prpArguments, bool acceptNoArguments = false, bool printTrace = false) |
ddkilzer@apple.com | 9c4dacc | 2009-07-11 05:36:29 +0000 | [diff] [blame] | 69 | { |
yurys@chromium.org | 4fcd1c8 | 2011-01-24 10:20:57 +0000 | [diff] [blame] | 70 | RefPtr<ScriptArguments> arguments = prpArguments; |
yurys@chromium.org | 4fcd1c8 | 2011-01-24 10:20:57 +0000 | [diff] [blame] | 71 | |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 72 | if (!page) |
| 73 | return; |
| 74 | |
yurys@chromium.org | 02ff0d6 | 2010-11-08 14:05:32 +0000 | [diff] [blame] | 75 | if (!acceptNoArguments && !arguments->argumentCount()) |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 76 | return; |
| 77 | |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 78 | size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1; |
| 79 | RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize)); |
| 80 | const ScriptCallFrame& lastCaller = callStack->at(0); |
| 81 | |
mkwst@chromium.org | f7c6179 | 2012-12-11 09:17:59 +0000 | [diff] [blame] | 82 | String message; |
| 83 | bool gotMessage = arguments->getFirstArgumentAsString(message); |
timothy@apple.com | e133ede | 2013-01-16 22:52:45 +0000 | [diff] [blame] | 84 | InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource, type, level, message, state, arguments); |
mkwst@chromium.org | f7c6179 | 2012-12-11 09:17:59 +0000 | [diff] [blame] | 85 | |
akling@apple.com | ff5990f | 2013-08-11 20:30:48 +0000 | [diff] [blame] | 86 | if (page->settings().privateBrowsingEnabled()) |
mkwst@chromium.org | f7c6179 | 2012-12-11 09:17:59 +0000 | [diff] [blame] | 87 | return; |
| 88 | |
| 89 | if (gotMessage) |
akling@apple.com | fedaa63 | 2013-08-19 10:56:27 +0000 | [diff] [blame] | 90 | page->chrome().client().addMessageToConsole(ConsoleAPIMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL()); |
mkwst@chromium.org | f7c6179 | 2012-12-11 09:17:59 +0000 | [diff] [blame] | 91 | |
akling@apple.com | ff5990f | 2013-08-11 20:30:48 +0000 | [diff] [blame] | 92 | if (!page->settings().logsPageMessagesToSystemConsoleEnabled() && !PageConsole::shouldPrintExceptions()) |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 93 | return; |
yurys@chromium.org | 97b7c4a | 2010-11-13 14:50:48 +0000 | [diff] [blame] | 94 | |
commit-queue@webkit.org | ec979f8 | 2013-12-10 18:53:51 +0000 | [diff] [blame] | 95 | PageConsole::printSourceURLAndPosition(lastCaller.sourceURL(), lastCaller.lineNumber()); |
timothy@apple.com | 3fc29ba | 2014-01-10 22:16:17 +0000 | [diff] [blame] | 96 | |
| 97 | printf(": "); |
| 98 | |
| 99 | PageConsole::printMessageSourceAndLevelPrefix(ConsoleAPIMessageSource, level, printTrace); |
timothy@apple.com | e133ede | 2013-01-16 22:52:45 +0000 | [diff] [blame] | 100 | |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 101 | for (size_t i = 0; i < arguments->argumentCount(); ++i) { |
| 102 | String argAsString = arguments->argumentAt(i).toString(arguments->globalState()); |
| 103 | printf(" %s", argAsString.utf8().data()); |
yurys@chromium.org | 97b7c4a | 2010-11-13 14:50:48 +0000 | [diff] [blame] | 104 | } |
| 105 | |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 106 | printf("\n"); |
| 107 | |
timothy@apple.com | 3fc29ba | 2014-01-10 22:16:17 +0000 | [diff] [blame] | 108 | if (!printTrace) |
| 109 | return; |
| 110 | |
| 111 | for (size_t i = 0; i < callStack->size(); ++i) { |
| 112 | const ScriptCallFrame& callFrame = callStack->at(i); |
| 113 | |
| 114 | String functionName = String(callFrame.functionName()); |
| 115 | if (functionName.isEmpty()) |
| 116 | functionName = ASCIILiteral("(unknown)"); |
| 117 | |
joepeck@webkit.org | cb25f56 | 2014-01-11 00:55:15 +0000 | [diff] [blame] | 118 | printf("%lu: %s (", static_cast<unsigned long>(i), functionName.utf8().data()); |
timothy@apple.com | 3fc29ba | 2014-01-10 22:16:17 +0000 | [diff] [blame] | 119 | |
| 120 | PageConsole::printSourceURLAndPosition(callFrame.sourceURL(), callFrame.lineNumber()); |
| 121 | |
| 122 | printf(")\n"); |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 123 | } |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 124 | } |
| 125 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 126 | void Console::debug(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
aroben@apple.com | 4bd0bc4e | 2008-05-22 05:58:51 +0000 | [diff] [blame] | 127 | { |
mkwst@chromium.org | 819c024 | 2013-01-24 20:40:23 +0000 | [diff] [blame] | 128 | internalAddMessage(page(), LogMessageType, DebugMessageLevel, state, arguments); |
aroben@apple.com | 4bd0bc4e | 2008-05-22 05:58:51 +0000 | [diff] [blame] | 129 | } |
| 130 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 131 | void Console::error(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 132 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 133 | internalAddMessage(page(), LogMessageType, ErrorMessageLevel, state, arguments); |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 134 | } |
| 135 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 136 | void Console::info(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 137 | { |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 138 | log(state, arguments); |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 139 | } |
| 140 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 141 | void Console::log(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 142 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 143 | internalAddMessage(page(), LogMessageType, LogMessageLevel, state, arguments); |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 144 | } |
| 145 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 146 | void Console::warn(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
vsevik@chromium.org | 9cd1b01 | 2012-04-19 15:34:31 +0000 | [diff] [blame] | 147 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 148 | internalAddMessage(page(), LogMessageType, WarningMessageLevel, state, arguments); |
vsevik@chromium.org | 9cd1b01 | 2012-04-19 15:34:31 +0000 | [diff] [blame] | 149 | } |
| 150 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 151 | void Console::dir(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
timothy@apple.com | 7310b6a | 2008-08-15 17:35:22 +0000 | [diff] [blame] | 152 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 153 | internalAddMessage(page(), DirMessageType, LogMessageLevel, state, arguments); |
timothy@apple.com | 7310b6a | 2008-08-15 17:35:22 +0000 | [diff] [blame] | 154 | } |
| 155 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 156 | void Console::dirxml(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
timothy@apple.com | 968ebc9 | 2008-09-07 16:48:41 +0000 | [diff] [blame] | 157 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 158 | internalAddMessage(page(), DirXMLMessageType, LogMessageLevel, state, arguments); |
timothy@apple.com | 968ebc9 | 2008-09-07 16:48:41 +0000 | [diff] [blame] | 159 | } |
| 160 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 161 | void Console::table(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
pfeldman@chromium.org | c226870 | 2013-02-18 10:51:37 +0000 | [diff] [blame] | 162 | { |
| 163 | internalAddMessage(page(), TableMessageType, LogMessageLevel, state, arguments); |
| 164 | } |
| 165 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 166 | void Console::clear(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
commit-queue@webkit.org | 8e62831 | 2012-11-06 16:14:27 +0000 | [diff] [blame] | 167 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 168 | internalAddMessage(page(), ClearMessageType, LogMessageLevel, state, arguments, true); |
commit-queue@webkit.org | 8e62831 | 2012-11-06 16:14:27 +0000 | [diff] [blame] | 169 | } |
| 170 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 171 | void Console::trace(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
timothy@apple.com | 345f1af | 2008-09-27 22:18:35 +0000 | [diff] [blame] | 172 | { |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 173 | internalAddMessage(page(), TraceMessageType, LogMessageLevel, state, arguments, true, true); |
timothy@apple.com | 345f1af | 2008-09-27 22:18:35 +0000 | [diff] [blame] | 174 | } |
| 175 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 176 | void Console::assertCondition(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments, bool condition) |
aroben@apple.com | d1b1b1f | 2008-05-20 23:05:51 +0000 | [diff] [blame] | 177 | { |
| 178 | if (condition) |
| 179 | return; |
| 180 | |
timothy@apple.com | d070f9c | 2013-01-17 22:32:22 +0000 | [diff] [blame] | 181 | internalAddMessage(page(), AssertMessageType, ErrorMessageLevel, state, arguments, true); |
aroben@apple.com | d1b1b1f | 2008-05-20 23:05:51 +0000 | [diff] [blame] | 182 | } |
| 183 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 184 | void Console::count(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
timothy@apple.com | 7d08c32 | 2008-08-19 18:33:27 +0000 | [diff] [blame] | 185 | { |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 186 | InspectorInstrumentation::consoleCount(page(), state, arguments); |
timothy@apple.com | 7d08c32 | 2008-08-19 18:33:27 +0000 | [diff] [blame] | 187 | } |
| 188 | |
weinig@apple.com | 1dc3b82 | 2013-09-14 18:29:29 +0000 | [diff] [blame] | 189 | void Console::profile(JSC::ExecState* state, const String& title) |
kmccullough@apple.com | a014dc7 | 2008-04-18 21:50:35 +0000 | [diff] [blame] | 190 | { |
timothy@apple.com | 7dec1b9 | 2008-10-28 20:42:34 +0000 | [diff] [blame] | 191 | Page* page = this->page(); |
| 192 | if (!page) |
| 193 | return; |
| 194 | |
levin@chromium.org | 4e1469c | 2009-07-23 16:52:50 +0000 | [diff] [blame] | 195 | // FIXME: log a console message when profiling is disabled. |
loislo@chromium.org | 043f7d3 | 2011-01-21 12:30:56 +0000 | [diff] [blame] | 196 | if (!InspectorInstrumentation::profilerEnabled(page)) |
timothy@apple.com | 7dec1b9 | 2008-10-28 20:42:34 +0000 | [diff] [blame] | 197 | return; |
| 198 | |
eric@webkit.org | cd8a5d5 | 2010-02-03 10:54:28 +0000 | [diff] [blame] | 199 | String resolvedTitle = title; |
| 200 | if (title.isNull()) // no title so give it the next user initiated profile title. |
loislo@chromium.org | 043f7d3 | 2011-01-21 12:30:56 +0000 | [diff] [blame] | 201 | resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(page, true); |
kmccullough@apple.com | d65049f | 2009-03-03 22:47:49 +0000 | [diff] [blame] | 202 | |
yurys@chromium.org | 02ff0d6 | 2010-11-08 14:05:32 +0000 | [diff] [blame] | 203 | ScriptProfiler::start(state, resolvedTitle); |
kmccullough@apple.com | cd1d51b | 2009-06-22 18:51:22 +0000 | [diff] [blame] | 204 | |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 205 | RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1)); |
kmccullough@apple.com | cd1d51b | 2009-06-22 18:51:22 +0000 | [diff] [blame] | 206 | const ScriptCallFrame& lastCaller = callStack->at(0); |
joepeck@webkit.org | 379c8a1 | 2013-04-25 18:31:05 +0000 | [diff] [blame] | 207 | InspectorInstrumentation::addStartProfilingMessageToConsole(page, resolvedTitle, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL()); |
kmccullough@apple.com | a014dc7 | 2008-04-18 21:50:35 +0000 | [diff] [blame] | 208 | } |
| 209 | |
weinig@apple.com | 1dc3b82 | 2013-09-14 18:29:29 +0000 | [diff] [blame] | 210 | void Console::profileEnd(JSC::ExecState* state, const String& title) |
kmccullough@apple.com | a014dc7 | 2008-04-18 21:50:35 +0000 | [diff] [blame] | 211 | { |
timothy@apple.com | 7dec1b9 | 2008-10-28 20:42:34 +0000 | [diff] [blame] | 212 | Page* page = this->page(); |
| 213 | if (!page) |
| 214 | return; |
| 215 | |
loislo@chromium.org | 043f7d3 | 2011-01-21 12:30:56 +0000 | [diff] [blame] | 216 | if (!InspectorInstrumentation::profilerEnabled(page)) |
timothy@apple.com | 7dec1b9 | 2008-10-28 20:42:34 +0000 | [diff] [blame] | 217 | return; |
| 218 | |
yurys@chromium.org | 02ff0d6 | 2010-11-08 14:05:32 +0000 | [diff] [blame] | 219 | RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title); |
kmccullough@apple.com | 8821934 | 2008-09-30 22:33:30 +0000 | [diff] [blame] | 220 | if (!profile) |
| 221 | return; |
kmccullough@apple.com | b0f4c62 | 2008-09-03 21:53:17 +0000 | [diff] [blame] | 222 | |
kmccullough@apple.com | 0435f78 | 2008-10-22 23:04:00 +0000 | [diff] [blame] | 223 | m_profiles.append(profile); |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 224 | RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1)); |
yurys@chromium.org | 4fcd1c8 | 2011-01-24 10:20:57 +0000 | [diff] [blame] | 225 | InspectorInstrumentation::addProfile(page, profile, callStack); |
kmccullough@apple.com | c9005ae | 2008-06-20 19:36:10 +0000 | [diff] [blame] | 226 | } |
| 227 | |
darin@chromium.org | c593adc | 2008-12-09 20:25:33 +0000 | [diff] [blame] | 228 | void Console::time(const String& title) |
| 229 | { |
caseq@chromium.org | 221060d | 2012-08-10 13:42:47 +0000 | [diff] [blame] | 230 | InspectorInstrumentation::startConsoleTiming(m_frame, title); |
mrowe@apple.com | 8ef6177 | 2008-07-27 05:44:30 +0000 | [diff] [blame] | 231 | } |
| 232 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 233 | void Console::timeEnd(JSC::ExecState* state, const String& title) |
mrowe@apple.com | 8ef6177 | 2008-07-27 05:44:30 +0000 | [diff] [blame] | 234 | { |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 235 | RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state)); |
| 236 | InspectorInstrumentation::stopConsoleTiming(m_frame, title, callStack.release()); |
mrowe@apple.com | 8ef6177 | 2008-07-27 05:44:30 +0000 | [diff] [blame] | 237 | } |
| 238 | |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 239 | void Console::timeStamp(PassRefPtr<ScriptArguments> arguments) |
commit-queue@webkit.org | 058fb45 | 2011-07-15 10:06:31 +0000 | [diff] [blame] | 240 | { |
caseq@chromium.org | 221060d | 2012-08-10 13:42:47 +0000 | [diff] [blame] | 241 | InspectorInstrumentation::consoleTimeStamp(m_frame, arguments); |
commit-queue@webkit.org | 058fb45 | 2011-07-15 10:06:31 +0000 | [diff] [blame] | 242 | } |
| 243 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 244 | void Console::group(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
timothy@apple.com | 7be8b23 | 2008-07-29 18:04:29 +0000 | [diff] [blame] | 245 | { |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 246 | InspectorInstrumentation::addMessageToConsole(page(), ConsoleAPIMessageSource, StartGroupMessageType, LogMessageLevel, String(), state, arguments); |
timothy@apple.com | 7be8b23 | 2008-07-29 18:04:29 +0000 | [diff] [blame] | 247 | } |
| 248 | |
weinig@apple.com | 4da3e8d | 2013-09-14 01:30:06 +0000 | [diff] [blame] | 249 | void Console::groupCollapsed(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments) |
jberlin@webkit.org | 7308614 | 2010-05-26 13:44:21 +0000 | [diff] [blame] | 250 | { |
mkwst@chromium.org | d643a8e | 2012-11-16 12:32:53 +0000 | [diff] [blame] | 251 | InspectorInstrumentation::addMessageToConsole(page(), ConsoleAPIMessageSource, StartGroupCollapsedMessageType, LogMessageLevel, String(), state, arguments); |
jberlin@webkit.org | 7308614 | 2010-05-26 13:44:21 +0000 | [diff] [blame] | 252 | } |
| 253 | |
timothy@apple.com | 7be8b23 | 2008-07-29 18:04:29 +0000 | [diff] [blame] | 254 | void Console::groupEnd() |
| 255 | { |
joepeck@webkit.org | 379c8a1 | 2013-04-25 18:31:05 +0000 | [diff] [blame] | 256 | InspectorInstrumentation::addMessageToConsole(page(), ConsoleAPIMessageSource, EndGroupMessageType, LogMessageLevel, String(), String(), 0, 0); |
timothy@apple.com | 7be8b23 | 2008-07-29 18:04:29 +0000 | [diff] [blame] | 257 | } |
| 258 | |
kmccullough@apple.com | e8ac2f3 | 2008-08-19 16:38:06 +0000 | [diff] [blame] | 259 | Page* Console::page() const |
| 260 | { |
| 261 | if (!m_frame) |
| 262 | return 0; |
kmccullough@apple.com | e8ac2f3 | 2008-08-19 16:38:06 +0000 | [diff] [blame] | 263 | return m_frame->page(); |
| 264 | } |
| 265 | |
weinig | 5e5675e | 2007-10-28 02:11:55 +0000 | [diff] [blame] | 266 | } // namespace WebCore |