Changeset 246798 in webkit
- Timestamp:
- Jun 25, 2019 11:36:29 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246788 r246798 1 2019-06-25 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Implement console.timeLog 4 https://bugs.webkit.org/show_bug.cgi?id=199184 5 6 Reviewed by Devin Rousso. 7 8 * inspector/console/console-time-expected.txt: 9 * inspector/console/console-time.html: 10 Add new timeLog tests. 11 12 * js/console-expected.txt: 13 New timeLog method. 14 15 * platform/gtk/TestExpectations: 16 * platform/mac/TestExpectations: 17 Unskip test. 18 1 19 2019-06-25 Fujii Hironori <Hironori.Fujii@sony.com> 2 20 -
trunk/LayoutTests/inspector/console/console-time-expected.txt
r200400 r246798 1 Tests for the console.time and console.timeEnd APIs.1 Tests for the console.time, console.timeLog, and console.timeEnd APIs. 2 2 3 3 4 == Running test suite: console.time and console.timeEnd 5 -- Running test case: DefaultLabel 4 == Running test suite: console.time 5 -- Running test case: console.time.DefaultLabel 6 PASS: Should receive a Timing type message. 7 PASS: Message should contain the 'default' label name somewhere. 8 PASS: Should receive a Timing type message. 9 PASS: Message should contain the 'default' label name somewhere. 10 PASS: Should receive a Timing type message. 11 PASS: Message should contain the 'default' label name somewhere. 6 12 PASS: Should receive a Timing type message. 7 13 PASS: Message should contain the 'default' label name somewhere. … … 11 17 PASS: Message should contain the 'default' label name somewhere. 12 18 13 -- Running test case: UserLabels 19 -- Running test case: console.time.UserLabels 20 PASS: Should receive a Timing type message. 21 PASS: Message should contain the 'my-label' label name somewhere. 14 22 PASS: Should receive a Timing type message. 15 23 PASS: Message should contain the 'my-label' label name somewhere. 16 24 17 -- Running test case: MultipleTimers25 -- Running test case: console.time.MultipleTimers 18 26 PASS: Should receive a Timing type message. 19 27 PASS: Message should contain the 'my-label-2' label name somewhere. … … 21 29 PASS: Message should contain the 'my-label-1' label name somewhere. 22 30 23 -- Running test case: WarnWhenExisting31 -- Running test case: console.time.WarnWhenExisting 24 32 PASS: Should receive a Timing type message. 25 33 PASS: Should receive a Warning level message 26 34 PASS: Message should contain the 'default' label name somewhere. 27 35 28 -- Running test case: WarnWhenNotExisting 36 -- Running test case: console.time.WarnWhenNotExisting 37 PASS: Should receive a Timing type message. 38 PASS: Should receive a Warning level message. 39 PASS: Message should contain the 'default' label name somewhere. 29 40 PASS: Should receive a Timing type message. 30 41 PASS: Should receive a Warning level message. 31 42 PASS: Message should contain the 'default' label name somewhere. 32 43 44 -- Running test case: console.time.TimeLogIncreasing 45 PASS: Should receive a Timing type message. 46 PASS: Message should contain the 'my-timelog-label' label name somewhere. 47 PASS: + Initial timer time seen. 48 PASS: Should receive a Timing type message. 49 PASS: Message should contain the 'my-timelog-label' label name somewhere. 50 PASS: + Timer time should be increasing. 51 PASS: Should receive a Timing type message. 52 PASS: Message should contain the 'my-timelog-label' label name somewhere. 53 PASS: + Timer time should be increasing. 54 PASS: Should receive a Timing type message. 55 PASS: Message should contain the 'my-timelog-label' label name somewhere. 56 PASS: + Timer time should be increasing. 57 58 -- Running test case: console.time.TimeLogArguments 59 PASS: Should receive a Timing type message. 60 PASS: timeLog should contain no parameters 61 PASS: Should receive a Timing type message. 62 PASS: timeLog should contain 1 parameters 63 PASS: Should receive a Timing type message. 64 PASS: timeLog should contain 2 parameters 65 PASS: Should receive a Timing type message. 66 PASS: timeEnd should contain no parameters 67 -
trunk/LayoutTests/inspector/console/console-time.html
r236766 r246798 4 4 <script src="../../http/tests/inspector/resources/inspector-test.js"></script> 5 5 <script> 6 function sleepTick() { 7 let now = performance.now(); 8 let until = now + 10; 9 while (performance.now() < until); 10 } 11 6 12 function test() 7 13 { 8 let suite = InspectorTest.createAsyncSuite("console.time and console.timeEnd");9 10 suite.addTestCase({ 11 name: " DefaultLabel",14 let suite = InspectorTest.createAsyncSuite("console.time"); 15 16 suite.addTestCase({ 17 name: "console.time.DefaultLabel", 12 18 description: "Test that default label works as expected.", 13 19 test(resolve, reject) { 14 20 let seen = 0; 15 const expected = 3;21 const expected = 6; 16 22 WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 17 23 function handler(event) { … … 25 31 } 26 32 27 InspectorTest.evaluateInPage("console.time()"); 28 InspectorTest.evaluateInPage("console.timeEnd()"); 29 30 InspectorTest.evaluateInPage("console.time(undefined)"); 31 InspectorTest.evaluateInPage("console.timeEnd('default')"); 32 33 InspectorTest.evaluateInPage("console.time('default')"); 34 InspectorTest.evaluateInPage("console.timeEnd(undefined)"); 35 } 36 }); 37 38 suite.addTestCase({ 39 name: "UserLabels", 33 InspectorTest.evaluateInPage(`console.time()`); 34 InspectorTest.evaluateInPage(`console.timeLog()`); 35 InspectorTest.evaluateInPage(`console.timeEnd()`); 36 37 InspectorTest.evaluateInPage(`console.time(undefined)`); 38 InspectorTest.evaluateInPage(`console.timeLog('default')`); 39 InspectorTest.evaluateInPage(`console.timeEnd('default')`); 40 41 InspectorTest.evaluateInPage(`console.time('default')`); 42 InspectorTest.evaluateInPage(`console.timeLog(undefined)`); 43 InspectorTest.evaluateInPage(`console.timeEnd(undefined)`); 44 } 45 }); 46 47 suite.addTestCase({ 48 name: "console.time.UserLabels", 40 49 description: "Test that user labels works as expected.", 41 50 test(resolve, reject) { 42 WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded) 43 .then((event) => { 51 let seen = 0; 52 const expected = 2; 53 WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 54 function handler(event) { 44 55 let message = event.data.message; 45 56 InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); 46 57 InspectorTest.expectThat(message.messageText.includes("my-label"), "Message should contain the 'my-label' label name somewhere."); 47 }) 48 .then(resolve, reject); 49 50 InspectorTest.evaluateInPage("console.time('my-label')"); 51 InspectorTest.evaluateInPage("console.timeEnd('my-label')"); 52 } 53 }); 54 55 suite.addTestCase({ 56 name: "MultipleTimers", 58 if (++seen === expected) { 59 WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 60 resolve(); 61 } 62 } 63 64 InspectorTest.evaluateInPage(`console.time('my-label')`); 65 InspectorTest.evaluateInPage(`console.timeLog('my-label')`); 66 InspectorTest.evaluateInPage(`console.timeEnd('my-label')`); 67 } 68 }); 69 70 suite.addTestCase({ 71 name: "console.time.MultipleTimers", 57 72 description: "Test that multiple timers running at the same time work as expected.", 58 73 test(resolve, reject) { … … 71 86 } 72 87 73 InspectorTest.evaluateInPage( "console.time('my-label-1')");74 InspectorTest.evaluateInPage( "console.time('my-label-2')");75 InspectorTest.evaluateInPage( "console.timeEnd('my-label-2')");76 InspectorTest.evaluateInPage( "console.timeEnd('my-label-1')");77 } 78 }); 79 80 suite.addTestCase({ 81 name: " WarnWhenExisting",88 InspectorTest.evaluateInPage(`console.time('my-label-1')`); 89 InspectorTest.evaluateInPage(`console.time('my-label-2')`); 90 InspectorTest.evaluateInPage(`console.timeEnd('my-label-2')`); 91 InspectorTest.evaluateInPage(`console.timeEnd('my-label-1')`); 92 } 93 }); 94 95 suite.addTestCase({ 96 name: "console.time.WarnWhenExisting", 82 97 description: "Test for a warning when trying to start an already started timer.", 83 98 test(resolve, reject) { … … 97 112 } 98 113 99 InspectorTest.evaluateInPage( "console.time()");100 InspectorTest.evaluateInPage( "console.time()"); // Warning101 InspectorTest.evaluateInPage( "console.timeEnd()");102 } 103 }); 104 105 suite.addTestCase({ 106 name: " WarnWhenNotExisting",114 InspectorTest.evaluateInPage(`console.time()`); 115 InspectorTest.evaluateInPage(`console.time()`); // Warning 116 InspectorTest.evaluateInPage(`console.timeEnd()`); 117 } 118 }); 119 120 suite.addTestCase({ 121 name: "console.time.WarnWhenNotExisting", 107 122 description: "Test for a warning when trying to start an already started timer.", 108 123 test(resolve, reject) { 109 WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded) 110 .then((event) => { 111 let message = event.data.message; 124 let seen = 0; 125 const expected = 2; 126 WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 127 function handler(event) { 128 let message = event.data.message; 129 if (message.type === WI.ConsoleMessage.MessageType.Clear) 130 return; 131 112 132 InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); 113 133 InspectorTest.expectThat(message.level === WI.ConsoleMessage.MessageLevel.Warning, "Should receive a Warning level message."); 114 134 InspectorTest.expectThat(message.messageText.includes("default"), "Message should contain the 'default' label name somewhere."); 115 }) 116 .then(resolve, reject); 117 118 InspectorTest.evaluateInPage("console.timeEnd()"); 135 if (++seen === expected) { 136 WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 137 resolve(); 138 } 139 } 140 141 InspectorTest.evaluateInPage(`console.timeLog()`); // Warn 142 InspectorTest.evaluateInPage(`console.clear()`); 143 InspectorTest.evaluateInPage(`console.timeEnd()`); // Warn 144 } 145 }); 146 147 suite.addTestCase({ 148 name: "console.time.TimeLogIncreasing", 149 description: "Test for timeLog multiple times with a timer should increase.", 150 test(resolve, reject) { 151 let lastTime = 0; 152 let seen = 0; 153 const expected = 4; 154 WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 155 function handler(event) { 156 let message = event.data.message; 157 InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); 158 InspectorTest.expectThat(message.messageText.includes("my-timelog-label"), "Message should contain the 'my-timelog-label' label name somewhere."); 159 160 let match = message.messageText.match(/^my-timelog-label: (\d+(\.\d+)?ms)/) 161 if (match) { 162 let currentTime = parseFloat(match[1]); 163 if (lastTime) { 164 InspectorTest.assert(currentTime > 15, "At least 15 milliseconds should have elapsed since this is for timeLog 2 and later."); 165 InspectorTest.expectGreaterThan(currentTime, lastTime, "+ Timer time should be increasing."); 166 } else 167 InspectorTest.pass("+ Initial timer time seen."); 168 lastTime = currentTime; 169 } 170 171 if (++seen === expected) { 172 WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 173 resolve(); 174 } 175 } 176 177 InspectorTest.evaluateInPage(`console.time("my-timelog-label")`); 178 InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); 179 InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); 180 InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); 181 InspectorTest.evaluateInPage(`sleepTick(); console.timeEnd("my-timelog-label")`); 182 } 183 }); 184 185 suite.addTestCase({ 186 name: "console.time.TimeLogArguments", 187 description: "Test for timeLog with trailing parameters.", 188 test(resolve, reject) { 189 let seen = 0; 190 const expected = 4; 191 WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 192 function handler(event) { 193 let message = event.data.message; 194 InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); 195 196 switch (seen) { 197 case 0: 198 InspectorTest.expectEqual(message.parameters, undefined, "timeLog should contain no parameters"); 199 break; 200 case 1: 201 InspectorTest.expectEqual(message.parameters.length, 1, "timeLog should contain 1 parameters"); 202 break; 203 case 2: 204 InspectorTest.expectEqual(message.parameters.length, 2, "timeLog should contain 2 parameters"); 205 break; 206 case 3: 207 InspectorTest.expectEqual(message.parameters, undefined, "timeEnd should contain no parameters"); 208 break; 209 } 210 211 if (++seen === expected) { 212 WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); 213 resolve(); 214 } 215 } 216 217 InspectorTest.evaluateInPage(`console.time("x")`); 218 InspectorTest.evaluateInPage(`console.timeLog("x")`); 219 InspectorTest.evaluateInPage(`console.timeLog("x", 1)`); 220 InspectorTest.evaluateInPage(`console.timeLog("x", 2, window)`); 221 InspectorTest.evaluateInPage(`console.timeEnd("x")`); 119 222 } 120 223 }); … … 125 228 </head> 126 229 <body onload="runTest()"> 127 <p>Tests for the console.time and console.timeEnd APIs.</p>230 <p>Tests for the console.time, console.timeLog, and console.timeEnd APIs.</p> 128 231 </body> 129 232 </html> -
trunk/LayoutTests/js/console-expected.txt
r242992 r246798 122 122 PASS descriptor.enumerable is true 123 123 124 console.timeLog 125 PASS typeof console.timeLog is "function" 126 PASS console.timeLog.length is 0 127 PASS descriptor.configurable is true 128 PASS descriptor.writable is true 129 PASS descriptor.enumerable is true 130 124 131 console.timeEnd 125 132 PASS typeof console.timeEnd is "function" -
trunk/LayoutTests/platform/gtk/TestExpectations
r246676 r246798 2136 2136 webkit.org/b/197498 imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html [ Failure Pass ] 2137 2137 2138 webkit.org/b/197499 inspector/console/console-time.html [ Failure Pass ]2139 2140 2138 webkit.org/b/197500 legacy-animation-engine/compositing/repaint/become-overlay-composited-layer.html [ Failure Pass ] 2141 2139 -
trunk/LayoutTests/platform/mac/TestExpectations
r246753 r246798 1090 1090 webkit.org/b/156078 inspector/console/heapSnapshot.html [ Pass Timeout ] 1091 1091 webkit.org/b/182620 inspector/console/clearMessages.html [ Pass Timeout ] 1092 webkit.org/b/158006 inspector/console/console-time.html [ Pass Failure ]1093 1092 webkit.org/b/183880 [ Debug ] inspector/console/messageAdded-from-named-evaluations.html [ Slow ] 1094 1093 webkit.org/b/156634 inspector/formatting/formatting-javascript.html [ Pass Timeout ] -
trunk/Source/JavaScriptCore/ChangeLog
r246792 r246798 1 2019-06-25 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Implement console.timeLog 4 https://bugs.webkit.org/show_bug.cgi?id=199184 5 6 Reviewed by Devin Rousso. 7 8 * inspector/JSGlobalObjectConsoleClient.cpp: 9 (Inspector::JSGlobalObjectConsoleClient::timeLog): 10 * inspector/JSGlobalObjectConsoleClient.h: 11 * inspector/agents/InspectorConsoleAgent.cpp: 12 (Inspector::InspectorConsoleAgent::logTiming): 13 (Inspector::InspectorConsoleAgent::stopTiming): 14 * inspector/agents/InspectorConsoleAgent.h: 15 * runtime/ConsoleClient.h: 16 * runtime/ConsoleObject.cpp: 17 (JSC::ConsoleObject::finishCreation): 18 (JSC::consoleProtoFuncTimeLog): 19 1 20 2019-06-25 Michael Catanzaro <mcatanzaro@igalia.com> 2 21 -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
r244195 r246798 154 154 } 155 155 156 void JSGlobalObjectConsoleClient::timeLog(ExecState*, const String& title, Ref<ScriptArguments>&& arguments) 157 { 158 m_consoleAgent->logTiming(title, WTFMove(arguments)); 159 } 160 156 161 void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& title) 157 162 { -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
r243192 r246798 55 55 void takeHeapSnapshot(JSC::ExecState*, const String& title) override; 56 56 void time(JSC::ExecState*, const String& title) override; 57 void timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) override; 57 58 void timeEnd(JSC::ExecState*, const String& title) override; 58 59 void timeStamp(JSC::ExecState*, Ref<ScriptArguments>&&) override; -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
r243663 r246798 145 145 } 146 146 147 void InspectorConsoleAgent:: stopTiming(const String& title, Ref<ScriptCallStack>&& callStack)147 void InspectorConsoleAgent::logTiming(const String& title, Ref<ScriptArguments>&& arguments) 148 148 { 149 149 if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) … … 163 163 164 164 MonotonicTime startTime = it->value; 165 m_times.remove(it); 166 165 Seconds elapsed = MonotonicTime::now() - startTime; 166 String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); 167 addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(arguments))); 168 } 169 170 void InspectorConsoleAgent::stopTiming(const String& title, Ref<ScriptCallStack>&& callStack) 171 { 172 if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) 173 return; 174 175 ASSERT(!title.isNull()); 176 if (title.isNull()) 177 return; 178 179 auto it = m_times.find(title); 180 if (it == m_times.end()) { 181 // FIXME: Send an enum to the frontend for localization? 182 String warning = makeString("Timer \"", title, "\" does not exist"); 183 addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning)); 184 return; 185 } 186 187 MonotonicTime startTime = it->value; 167 188 Seconds elapsed = MonotonicTime::now() - startTime; 168 189 String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); 169 190 addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(callStack))); 191 192 m_times.remove(it); 170 193 } 171 194 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
r243150 r246798 72 72 73 73 void startTiming(const String& title); 74 void logTiming(const String& title, Ref<ScriptArguments>&&); 74 75 void stopTiming(const String& title, Ref<ScriptCallStack>&&); 75 76 void takeHeapSnapshot(const String& title); -
trunk/Source/JavaScriptCore/runtime/ConsoleClient.h
r242992 r246798 61 61 virtual void takeHeapSnapshot(ExecState*, const String& title) = 0; 62 62 virtual void time(ExecState*, const String& title) = 0; 63 virtual void timeLog(ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) = 0; 63 64 virtual void timeEnd(ExecState*, const String& title) = 0; 64 65 virtual void timeStamp(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; -
trunk/Source/JavaScriptCore/runtime/ConsoleObject.cpp
r242992 r246798 53 53 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*); 54 54 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*); 55 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState*); 55 56 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*); 56 57 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*); … … 93 94 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profileEnd", consoleProtoFuncProfileEnd, static_cast<unsigned>(PropertyAttribute::None), 0); 94 95 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("time", consoleProtoFuncTime, static_cast<unsigned>(PropertyAttribute::None), 0); 96 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeLog", consoleProtoFuncTimeLog, static_cast<unsigned>(PropertyAttribute::None), 0); 95 97 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeEnd", consoleProtoFuncTimeEnd, static_cast<unsigned>(PropertyAttribute::None), 0); 96 98 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeStamp", consoleProtoFuncTimeStamp, static_cast<unsigned>(PropertyAttribute::None), 0); … … 314 316 } 315 317 316 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime End(ExecState* exec)318 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState* exec) 317 319 { 318 320 VM& vm = exec->vm(); … … 330 332 } 331 333 334 client->timeLog(exec, title, Inspector::createScriptArguments(exec, 1)); 335 return JSValue::encode(jsUndefined()); 336 } 337 338 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec) 339 { 340 VM& vm = exec->vm(); 341 auto scope = DECLARE_THROW_SCOPE(vm); 342 ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); 343 if (!client) 344 return JSValue::encode(jsUndefined()); 345 346 String title; 347 if (exec->argumentCount() < 1) 348 title = "default"_s; 349 else { 350 title = valueOrDefaultLabelString(exec, exec->argument(0)); 351 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 352 } 353 332 354 client->timeEnd(exec, title); 333 355 return JSValue::encode(jsUndefined()); -
trunk/Source/WebCore/ChangeLog
r246791 r246798 1 2019-06-25 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Implement console.timeLog 4 https://bugs.webkit.org/show_bug.cgi?id=199184 5 6 Reviewed by Devin Rousso. 7 8 Updated existing tests. 9 10 * inspector/InspectorInstrumentation.cpp: 11 (WebCore::InspectorInstrumentation::logConsoleTimingImpl): 12 * inspector/InspectorInstrumentation.h: 13 (WebCore::InspectorInstrumentation::logConsoleTiming): 14 * page/PageConsoleClient.cpp: 15 (WebCore::PageConsoleClient::timeLog): 16 * page/PageConsoleClient.h: 17 * workers/WorkerConsoleClient.cpp: 18 (WebCore::WorkerConsoleClient::timeLog): 19 * workers/WorkerConsoleClient.h: 20 * worklets/WorkletConsoleClient.cpp: 21 (WebCore::WorkletConsoleClient::timeLog): 22 * worklets/WorkletConsoleClient.h: 23 1 24 2019-06-25 Michael Catanzaro <mcatanzaro@igalia.com> 2 25 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r246490 r246798 887 887 } 888 888 889 void InspectorInstrumentation::logConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, const String& title, Ref<Inspector::ScriptArguments>&& arguments) 890 { 891 if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) 892 return; 893 894 if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) 895 consoleAgent->logTiming(title, WTFMove(arguments)); 896 } 897 889 898 void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title, Ref<ScriptCallStack>&& stack) 890 899 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r246490 r246798 227 227 static void startConsoleTiming(Frame&, const String& title); 228 228 static void startConsoleTiming(WorkerGlobalScope&, const String& title); 229 static void logConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptArguments>&&); 230 static void logConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptArguments>&&); 229 231 static void stopConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); 230 232 static void stopConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptCallStack>&&); … … 405 407 static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title); 406 408 static void startConsoleTimingImpl(InstrumentingAgents&, const String& title); 409 static void logConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptArguments>&&); 407 410 static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); 408 411 static void stopConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptCallStack>&&); … … 1409 1412 } 1410 1413 1414 inline void InspectorInstrumentation::logConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptArguments>&& arguments) 1415 { 1416 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) 1417 logConsoleTimingImpl(*instrumentingAgents, title, WTFMove(arguments)); 1418 } 1419 1420 inline void InspectorInstrumentation::logConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptArguments>&& arguments) 1421 { 1422 logConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(arguments)); 1423 } 1424 1411 1425 inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptCallStack>&& stack) 1412 1426 { -
trunk/Source/WebCore/page/PageConsoleClient.cpp
r244908 r246798 198 198 } 199 199 200 void PageConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) 201 { 202 InspectorInstrumentation::logConsoleTiming(m_page.mainFrame(), title, WTFMove(arguments)); 203 } 204 200 205 void PageConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) 201 206 { -
trunk/Source/WebCore/page/PageConsoleClient.h
r242992 r246798 73 73 void takeHeapSnapshot(JSC::ExecState*, const String& title) override; 74 74 void time(JSC::ExecState*, const String& title) override; 75 void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) override; 75 76 void timeEnd(JSC::ExecState*, const String& title) override; 76 77 void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; -
trunk/Source/WebCore/workers/WorkerConsoleClient.cpp
r242992 r246798 61 61 } 62 62 63 void WorkerConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) 64 { 65 InspectorInstrumentation::logConsoleTiming(m_workerGlobalScope, title, WTFMove(arguments)); 66 } 67 63 68 void WorkerConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) 64 69 { -
trunk/Source/WebCore/workers/WorkerConsoleClient.h
r242992 r246798 49 49 void takeHeapSnapshot(JSC::ExecState*, const String& title) override; 50 50 void time(JSC::ExecState*, const String& title) override; 51 void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) override; 51 52 void timeEnd(JSC::ExecState*, const String& title) override; 52 53 void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; -
trunk/Source/WebCore/worklets/WorkletConsoleClient.cpp
r242992 r246798 56 56 57 57 void WorkletConsoleClient::time(JSC::ExecState*, const String&) { } 58 void WorkletConsoleClient::timeLog(JSC::ExecState*, const String&, Ref<ScriptArguments>&&) { } 58 59 void WorkletConsoleClient::timeEnd(JSC::ExecState*, const String&) { } 59 60 -
trunk/Source/WebCore/worklets/WorkletConsoleClient.h
r242992 r246798 51 51 void takeHeapSnapshot(JSC::ExecState*, const String& title) final; 52 52 void time(JSC::ExecState*, const String& title) final; 53 void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) final; 53 54 void timeEnd(JSC::ExecState*, const String& title) final; 54 55 void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; -
trunk/Source/WebInspectorUI/ChangeLog
r246724 r246798 1 2019-06-25 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Implement console.timeLog 4 https://bugs.webkit.org/show_bug.cgi?id=199184 5 6 Reviewed by Devin Rousso. 7 8 * UserInterface/Views/ConsoleMessageView.js: 9 (WI.ConsoleMessageView.prototype._appendMessageTextAndArguments): 10 Time messages (like timeLog) do not include their messageText 11 in their parameters list. So to behave more like normal logs 12 build a parameter list that includes it at the front. 13 1 14 2019-06-23 Matt Baker <mattbaker@apple.com> 2 15 -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
r245165 r246798 289 289 break; 290 290 291 case WI.ConsoleMessage.MessageType.Timing: { 292 let args = [this._message.messageText]; 293 if (this._extraParameters) 294 args = args.concat(this._extraParameters); 295 this._appendFormattedArguments(element, args); 296 break; 297 } 298 291 299 case WI.ConsoleMessage.MessageType.Image: { 292 300 let img = element.appendChild(document.createElement("img"));
Note: See TracChangeset
for help on using the changeset viewer.