WebKit Bugzilla
Attachment 372843 Details for
Bug 199184
: Web Inspector: Implement console.timeLog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] For Landing
timeLog-landing.patch (text/plain), 38.47 KB, created by
Joseph Pecoraro
on 2019-06-25 10:53:43 PDT
(
hide
)
Description:
[PATCH] For Landing
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2019-06-25 10:53:43 PDT
Size:
38.47 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 81a485538cb..e37909b8ac5 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2019-06-24 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Web Inspector: Implement console.timeLog >+ https://bugs.webkit.org/show_bug.cgi?id=199184 >+ >+ Reviewed by Devin Rousso. >+ >+ * inspector/console/console-time-expected.txt: >+ * inspector/console/console-time.html: >+ Add new timeLog tests. >+ >+ * js/console-expected.txt: >+ New timeLog method. >+ >+ * platform/gtk/TestExpectations: >+ * platform/mac/TestExpectations: >+ Unskip test. >+ > 2019-06-25 Fujii Hironori <Hironori.Fujii@sony.com> > > Unreviewed test gardening >diff --git a/LayoutTests/inspector/console/console-time-expected.txt b/LayoutTests/inspector/console/console-time-expected.txt >index 640d7aeba0a..dbe691709ee 100644 >--- a/LayoutTests/inspector/console/console-time-expected.txt >+++ b/LayoutTests/inspector/console/console-time-expected.txt >@@ -1,8 +1,14 @@ >-Tests for the console.time and console.timeEnd APIs. >+Tests for the console.time, console.timeLog, and console.timeEnd APIs. > > >-== Running test suite: console.time and console.timeEnd >--- Running test case: DefaultLabel >+== Running test suite: console.time >+-- Running test case: console.time.DefaultLabel >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'default' label name somewhere. >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'default' label name somewhere. >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'default' label name somewhere. > PASS: Should receive a Timing type message. > PASS: Message should contain the 'default' label name somewhere. > PASS: Should receive a Timing type message. >@@ -10,23 +16,52 @@ PASS: Message should contain the 'default' label name somewhere. > PASS: Should receive a Timing type message. > PASS: Message should contain the 'default' label name somewhere. > >--- Running test case: UserLabels >+-- Running test case: console.time.UserLabels >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'my-label' label name somewhere. > PASS: Should receive a Timing type message. > PASS: Message should contain the 'my-label' label name somewhere. > >--- Running test case: MultipleTimers >+-- Running test case: console.time.MultipleTimers > PASS: Should receive a Timing type message. > PASS: Message should contain the 'my-label-2' label name somewhere. > PASS: Should receive a Timing type message. > PASS: Message should contain the 'my-label-1' label name somewhere. > >--- Running test case: WarnWhenExisting >+-- Running test case: console.time.WarnWhenExisting > PASS: Should receive a Timing type message. > PASS: Should receive a Warning level message > PASS: Message should contain the 'default' label name somewhere. > >--- Running test case: WarnWhenNotExisting >+-- Running test case: console.time.WarnWhenNotExisting > PASS: Should receive a Timing type message. > PASS: Should receive a Warning level message. > PASS: Message should contain the 'default' label name somewhere. >+PASS: Should receive a Timing type message. >+PASS: Should receive a Warning level message. >+PASS: Message should contain the 'default' label name somewhere. >+ >+-- Running test case: console.time.TimeLogIncreasing >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'my-timelog-label' label name somewhere. >+PASS: + Initial timer time seen. >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'my-timelog-label' label name somewhere. >+PASS: + Timer time should be increasing. >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'my-timelog-label' label name somewhere. >+PASS: + Timer time should be increasing. >+PASS: Should receive a Timing type message. >+PASS: Message should contain the 'my-timelog-label' label name somewhere. >+PASS: + Timer time should be increasing. >+ >+-- Running test case: console.time.TimeLogArguments >+PASS: Should receive a Timing type message. >+PASS: timeLog should contain no parameters >+PASS: Should receive a Timing type message. >+PASS: timeLog should contain 1 parameters >+PASS: Should receive a Timing type message. >+PASS: timeLog should contain 2 parameters >+PASS: Should receive a Timing type message. >+PASS: timeEnd should contain no parameters > >diff --git a/LayoutTests/inspector/console/console-time.html b/LayoutTests/inspector/console/console-time.html >index 05f44ca9c03..93dcede71f0 100644 >--- a/LayoutTests/inspector/console/console-time.html >+++ b/LayoutTests/inspector/console/console-time.html >@@ -3,16 +3,22 @@ > <head> > <script src="../../http/tests/inspector/resources/inspector-test.js"></script> > <script> >+function sleepTick() { >+ let now = performance.now(); >+ let until = now + 10; >+ while (performance.now() < until); >+} >+ > function test() > { >- let suite = InspectorTest.createAsyncSuite("console.time and console.timeEnd"); >+ let suite = InspectorTest.createAsyncSuite("console.time"); > > suite.addTestCase({ >- name: "DefaultLabel", >+ name: "console.time.DefaultLabel", > description: "Test that default label works as expected.", > test(resolve, reject) { > let seen = 0; >- const expected = 3; >+ const expected = 6; > WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); > function handler(event) { > let message = event.data.message; >@@ -24,36 +30,45 @@ function test() > } > } > >- InspectorTest.evaluateInPage("console.time()"); >- InspectorTest.evaluateInPage("console.timeEnd()"); >+ InspectorTest.evaluateInPage(`console.time()`); >+ InspectorTest.evaluateInPage(`console.timeLog()`); >+ InspectorTest.evaluateInPage(`console.timeEnd()`); > >- InspectorTest.evaluateInPage("console.time(undefined)"); >- InspectorTest.evaluateInPage("console.timeEnd('default')"); >+ InspectorTest.evaluateInPage(`console.time(undefined)`); >+ InspectorTest.evaluateInPage(`console.timeLog('default')`); >+ InspectorTest.evaluateInPage(`console.timeEnd('default')`); > >- InspectorTest.evaluateInPage("console.time('default')"); >- InspectorTest.evaluateInPage("console.timeEnd(undefined)"); >+ InspectorTest.evaluateInPage(`console.time('default')`); >+ InspectorTest.evaluateInPage(`console.timeLog(undefined)`); >+ InspectorTest.evaluateInPage(`console.timeEnd(undefined)`); > } > }); > > suite.addTestCase({ >- name: "UserLabels", >+ name: "console.time.UserLabels", > description: "Test that user labels works as expected.", > test(resolve, reject) { >- WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded) >- .then((event) => { >+ let seen = 0; >+ const expected = 2; >+ WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ function handler(event) { > let message = event.data.message; > InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); > InspectorTest.expectThat(message.messageText.includes("my-label"), "Message should contain the 'my-label' label name somewhere."); >- }) >- .then(resolve, reject); >+ if (++seen === expected) { >+ WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ resolve(); >+ } >+ } > >- InspectorTest.evaluateInPage("console.time('my-label')"); >- InspectorTest.evaluateInPage("console.timeEnd('my-label')"); >+ InspectorTest.evaluateInPage(`console.time('my-label')`); >+ InspectorTest.evaluateInPage(`console.timeLog('my-label')`); >+ InspectorTest.evaluateInPage(`console.timeEnd('my-label')`); > } > }); > > suite.addTestCase({ >- name: "MultipleTimers", >+ name: "console.time.MultipleTimers", > description: "Test that multiple timers running at the same time work as expected.", > test(resolve, reject) { > let seen = 0; >@@ -70,15 +85,15 @@ function test() > } > } > >- InspectorTest.evaluateInPage("console.time('my-label-1')"); >- InspectorTest.evaluateInPage("console.time('my-label-2')"); >- InspectorTest.evaluateInPage("console.timeEnd('my-label-2')"); >- InspectorTest.evaluateInPage("console.timeEnd('my-label-1')"); >+ InspectorTest.evaluateInPage(`console.time('my-label-1')`); >+ InspectorTest.evaluateInPage(`console.time('my-label-2')`); >+ InspectorTest.evaluateInPage(`console.timeEnd('my-label-2')`); >+ InspectorTest.evaluateInPage(`console.timeEnd('my-label-1')`); > } > }); > > suite.addTestCase({ >- name: "WarnWhenExisting", >+ name: "console.time.WarnWhenExisting", > description: "Test for a warning when trying to start an already started timer.", > test(resolve, reject) { > WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >@@ -96,26 +111,114 @@ function test() > } > } > >- InspectorTest.evaluateInPage("console.time()"); >- InspectorTest.evaluateInPage("console.time()"); // Warning >- InspectorTest.evaluateInPage("console.timeEnd()"); >+ InspectorTest.evaluateInPage(`console.time()`); >+ InspectorTest.evaluateInPage(`console.time()`); // Warning >+ InspectorTest.evaluateInPage(`console.timeEnd()`); > } > }); > > suite.addTestCase({ >- name: "WarnWhenNotExisting", >+ name: "console.time.WarnWhenNotExisting", > description: "Test for a warning when trying to start an already started timer.", > test(resolve, reject) { >- WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded) >- .then((event) => { >+ let seen = 0; >+ const expected = 2; >+ WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ function handler(event) { > let message = event.data.message; >+ if (message.type === WI.ConsoleMessage.MessageType.Clear) >+ return; >+ > InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); > InspectorTest.expectThat(message.level === WI.ConsoleMessage.MessageLevel.Warning, "Should receive a Warning level message."); > InspectorTest.expectThat(message.messageText.includes("default"), "Message should contain the 'default' label name somewhere."); >- }) >- .then(resolve, reject); >+ if (++seen === expected) { >+ WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ resolve(); >+ } >+ } > >- InspectorTest.evaluateInPage("console.timeEnd()"); >+ InspectorTest.evaluateInPage(`console.timeLog()`); // Warn >+ InspectorTest.evaluateInPage(`console.clear()`); >+ InspectorTest.evaluateInPage(`console.timeEnd()`); // Warn >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "console.time.TimeLogIncreasing", >+ description: "Test for timeLog multiple times with a timer should increase.", >+ test(resolve, reject) { >+ let lastTime = 0; >+ let seen = 0; >+ const expected = 4; >+ WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ function handler(event) { >+ let message = event.data.message; >+ InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); >+ InspectorTest.expectThat(message.messageText.includes("my-timelog-label"), "Message should contain the 'my-timelog-label' label name somewhere."); >+ >+ let match = message.messageText.match(/^my-timelog-label: (\d+(\.\d+)?ms)/) >+ if (match) { >+ let currentTime = parseFloat(match[1]); >+ if (lastTime) { >+ InspectorTest.assert(currentTime > 15, "At least 15 milliseconds should have elapsed since this is for timeLog 2 and later."); >+ InspectorTest.expectGreaterThan(currentTime, lastTime, "+ Timer time should be increasing."); >+ } else >+ InspectorTest.pass("+ Initial timer time seen."); >+ lastTime = currentTime; >+ } >+ >+ if (++seen === expected) { >+ WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ resolve(); >+ } >+ } >+ >+ InspectorTest.evaluateInPage(`console.time("my-timelog-label")`); >+ InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); >+ InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); >+ InspectorTest.evaluateInPage(`sleepTick(); console.timeLog("my-timelog-label")`); >+ InspectorTest.evaluateInPage(`sleepTick(); console.timeEnd("my-timelog-label")`); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "console.time.TimeLogArguments", >+ description: "Test for timeLog with trailing parameters.", >+ test(resolve, reject) { >+ let seen = 0; >+ const expected = 4; >+ WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ function handler(event) { >+ let message = event.data.message; >+ InspectorTest.expectThat(message.type === WI.ConsoleMessage.MessageType.Timing, "Should receive a Timing type message."); >+ >+ switch (seen) { >+ case 0: >+ InspectorTest.expectEqual(message.parameters, undefined, "timeLog should contain no parameters"); >+ break; >+ case 1: >+ InspectorTest.expectEqual(message.parameters.length, 1, "timeLog should contain 1 parameters"); >+ break; >+ case 2: >+ InspectorTest.expectEqual(message.parameters.length, 2, "timeLog should contain 2 parameters"); >+ break; >+ case 3: >+ InspectorTest.expectEqual(message.parameters, undefined, "timeEnd should contain no parameters"); >+ break; >+ } >+ >+ if (++seen === expected) { >+ WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, handler); >+ resolve(); >+ } >+ } >+ >+ InspectorTest.evaluateInPage(`console.time("x")`); >+ InspectorTest.evaluateInPage(`console.timeLog("x")`); >+ InspectorTest.evaluateInPage(`console.timeLog("x", 1)`); >+ InspectorTest.evaluateInPage(`console.timeLog("x", 2, window)`); >+ InspectorTest.evaluateInPage(`console.timeEnd("x")`); > } > }); > >@@ -124,6 +227,6 @@ function test() > </script> > </head> > <body onload="runTest()"> >-<p>Tests for the console.time and console.timeEnd APIs.</p> >+<p>Tests for the console.time, console.timeLog, and console.timeEnd APIs.</p> > </body> > </html> >diff --git a/LayoutTests/js/console-expected.txt b/LayoutTests/js/console-expected.txt >index b6bf724ea6d..63f7d47667f 100644 >--- a/LayoutTests/js/console-expected.txt >+++ b/LayoutTests/js/console-expected.txt >@@ -121,6 +121,13 @@ PASS descriptor.configurable is true > PASS descriptor.writable is true > PASS descriptor.enumerable is true > >+console.timeLog >+PASS typeof console.timeLog is "function" >+PASS console.timeLog.length is 0 >+PASS descriptor.configurable is true >+PASS descriptor.writable is true >+PASS descriptor.enumerable is true >+ > console.timeEnd > PASS typeof console.timeEnd is "function" > PASS console.timeEnd.length is 0 >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index e7aa4e42a76..52f85dcee1e 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -2135,8 +2135,6 @@ webkit.org/b/197498 imported/w3c/web-platform-tests/web-animations/interfaces/An > webkit.org/b/197498 imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html [ Failure Pass ] > webkit.org/b/197498 imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events.html [ Failure Pass ] > >-webkit.org/b/197499 inspector/console/console-time.html [ Failure Pass ] >- > webkit.org/b/197500 legacy-animation-engine/compositing/repaint/become-overlay-composited-layer.html [ Failure Pass ] > > webkit.org/b/197501 fast/images/animated-webp.html [ ImageOnlyFailure Pass ] >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 999a96f8ae5..01c09f76420 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1089,7 +1089,6 @@ webkit.org/b/155607 inspector/heap/snapshot.html [ Pass Failure ] > webkit.org/b/143719 inspector/console/console-api.html [ Pass Timeout ] > webkit.org/b/156078 inspector/console/heapSnapshot.html [ Pass Timeout ] > webkit.org/b/182620 inspector/console/clearMessages.html [ Pass Timeout ] >-webkit.org/b/158006 inspector/console/console-time.html [ Pass Failure ] > webkit.org/b/183880 [ Debug ] inspector/console/messageAdded-from-named-evaluations.html [ Slow ] > webkit.org/b/156634 inspector/formatting/formatting-javascript.html [ Pass Timeout ] > webkit.org/b/158948 inspector/timeline [ Pass Timeout ] >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index fef3421e2a1..62a2797e85c 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,22 @@ >+2019-06-24 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Web Inspector: Implement console.timeLog >+ https://bugs.webkit.org/show_bug.cgi?id=199184 >+ >+ Reviewed by Devin Rousso. >+ >+ * inspector/JSGlobalObjectConsoleClient.cpp: >+ (Inspector::JSGlobalObjectConsoleClient::timeLog): >+ * inspector/JSGlobalObjectConsoleClient.h: >+ * inspector/agents/InspectorConsoleAgent.cpp: >+ (Inspector::InspectorConsoleAgent::logTiming): >+ (Inspector::InspectorConsoleAgent::stopTiming): >+ * inspector/agents/InspectorConsoleAgent.h: >+ * runtime/ConsoleClient.h: >+ * runtime/ConsoleObject.cpp: >+ (JSC::ConsoleObject::finishCreation): >+ (JSC::consoleProtoFuncTimeLog): >+ > 2019-06-25 Michael Catanzaro <mcatanzaro@igalia.com> > > REGRESSION(r245586): static assertion failed: Match result and EncodedMatchResult should be the same size >diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >index 0cd9227d9f8..fcdcc491c6d 100644 >--- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >@@ -153,6 +153,11 @@ void JSGlobalObjectConsoleClient::time(ExecState*, const String& title) > m_consoleAgent->startTiming(title); > } > >+void JSGlobalObjectConsoleClient::timeLog(ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+{ >+ m_consoleAgent->logTiming(title, WTFMove(arguments)); >+} >+ > void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& title) > { > m_consoleAgent->stopTiming(title, createScriptCallStackForConsole(exec, 1)); >diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >index 419470004c1..8bfeada8494 100644 >--- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >@@ -54,6 +54,7 @@ protected: > void profileEnd(JSC::ExecState*, const String& title) override; > void takeHeapSnapshot(JSC::ExecState*, const String& title) override; > void time(JSC::ExecState*, const String& title) override; >+ void timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) override; > void timeEnd(JSC::ExecState*, const String& title) override; > void timeStamp(JSC::ExecState*, Ref<ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<ScriptArguments>&&) override; >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >index c62b6e83f5c..0386837fbbc 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >@@ -144,6 +144,29 @@ void InspectorConsoleAgent::startTiming(const String& title) > } > } > >+void InspectorConsoleAgent::logTiming(const String& title, Ref<ScriptArguments>&& arguments) >+{ >+ if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) >+ return; >+ >+ ASSERT(!title.isNull()); >+ if (title.isNull()) >+ return; >+ >+ auto it = m_times.find(title); >+ if (it == m_times.end()) { >+ // FIXME: Send an enum to the frontend for localization? >+ String warning = makeString("Timer \"", title, "\" does not exist"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning)); >+ return; >+ } >+ >+ MonotonicTime startTime = it->value; >+ Seconds elapsed = MonotonicTime::now() - startTime; >+ String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(arguments))); >+} >+ > void InspectorConsoleAgent::stopTiming(const String& title, Ref<ScriptCallStack>&& callStack) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) >@@ -162,11 +185,11 @@ void InspectorConsoleAgent::stopTiming(const String& title, Ref<ScriptCallStack> > } > > MonotonicTime startTime = it->value; >- m_times.remove(it); >- > Seconds elapsed = MonotonicTime::now() - startTime; > String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); > addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(callStack))); >+ >+ m_times.remove(it); > } > > void InspectorConsoleAgent::takeHeapSnapshot(const String& title) >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >index f0b6aae2398..3c3d605e087 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >@@ -71,6 +71,7 @@ public: > void addMessageToConsole(std::unique_ptr<ConsoleMessage>); > > void startTiming(const String& title); >+ void logTiming(const String& title, Ref<ScriptArguments>&&); > void stopTiming(const String& title, Ref<ScriptCallStack>&&); > void takeHeapSnapshot(const String& title); > void count(JSC::ExecState*, Ref<ScriptArguments>&&); >diff --git a/Source/JavaScriptCore/runtime/ConsoleClient.h b/Source/JavaScriptCore/runtime/ConsoleClient.h >index 53abb50e9fc..b3a846b12ff 100644 >--- a/Source/JavaScriptCore/runtime/ConsoleClient.h >+++ b/Source/JavaScriptCore/runtime/ConsoleClient.h >@@ -60,6 +60,7 @@ public: > virtual void profileEnd(ExecState*, const String& title) = 0; > virtual void takeHeapSnapshot(ExecState*, const String& title) = 0; > virtual void time(ExecState*, const String& title) = 0; >+ virtual void timeLog(ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) = 0; > virtual void timeEnd(ExecState*, const String& title) = 0; > virtual void timeStamp(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; > virtual void record(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; >diff --git a/Source/JavaScriptCore/runtime/ConsoleObject.cpp b/Source/JavaScriptCore/runtime/ConsoleObject.cpp >index 37c40d3ab7d..4bdfaebb347 100644 >--- a/Source/JavaScriptCore/runtime/ConsoleObject.cpp >+++ b/Source/JavaScriptCore/runtime/ConsoleObject.cpp >@@ -52,6 +52,7 @@ static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*); >+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*); > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState*); >@@ -92,6 +93,7 @@ void ConsoleObject::finishCreation(VM& vm, JSGlobalObject* globalObject) > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profile", consoleProtoFuncProfile, static_cast<unsigned>(PropertyAttribute::None), 0); > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profileEnd", consoleProtoFuncProfileEnd, static_cast<unsigned>(PropertyAttribute::None), 0); > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("time", consoleProtoFuncTime, static_cast<unsigned>(PropertyAttribute::None), 0); >+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeLog", consoleProtoFuncTimeLog, static_cast<unsigned>(PropertyAttribute::None), 0); > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeEnd", consoleProtoFuncTimeEnd, static_cast<unsigned>(PropertyAttribute::None), 0); > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeStamp", consoleProtoFuncTimeStamp, static_cast<unsigned>(PropertyAttribute::None), 0); > JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("takeHeapSnapshot", consoleProtoFuncTakeHeapSnapshot, static_cast<unsigned>(PropertyAttribute::None), 0); >@@ -313,6 +315,26 @@ static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec) > return JSValue::encode(jsUndefined()); > } > >+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState* exec) >+{ >+ VM& vm = exec->vm(); >+ auto scope = DECLARE_THROW_SCOPE(vm); >+ ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); >+ if (!client) >+ return JSValue::encode(jsUndefined()); >+ >+ String title; >+ if (exec->argumentCount() < 1) >+ title = "default"_s; >+ else { >+ title = valueOrDefaultLabelString(exec, exec->argument(0)); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); >+ } >+ >+ client->timeLog(exec, title, Inspector::createScriptArguments(exec, 1)); >+ return JSValue::encode(jsUndefined()); >+} >+ > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec) > { > VM& vm = exec->vm(); >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 704f598299e..7296bf1127d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2019-06-24 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Web Inspector: Implement console.timeLog >+ https://bugs.webkit.org/show_bug.cgi?id=199184 >+ >+ Reviewed by Devin Rousso. >+ >+ Updated existing tests. >+ >+ * inspector/InspectorInstrumentation.cpp: >+ (WebCore::InspectorInstrumentation::logConsoleTimingImpl): >+ * inspector/InspectorInstrumentation.h: >+ (WebCore::InspectorInstrumentation::logConsoleTiming): >+ * page/PageConsoleClient.cpp: >+ (WebCore::PageConsoleClient::timeLog): >+ * page/PageConsoleClient.h: >+ * workers/WorkerConsoleClient.cpp: >+ (WebCore::WorkerConsoleClient::timeLog): >+ * workers/WorkerConsoleClient.h: >+ * worklets/WorkletConsoleClient.cpp: >+ (WebCore::WorkletConsoleClient::timeLog): >+ * worklets/WorkletConsoleClient.h: >+ > 2019-06-25 Michael Catanzaro <mcatanzaro@igalia.com> > > Add user agent quirk for bankofamerica.com >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp >index 9b1d2fcf3db..2ec77986d25 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp >+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp >@@ -886,6 +886,15 @@ void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instr > consoleAgent->startTiming(title); > } > >+void InspectorInstrumentation::logConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+{ >+ if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) >+ return; >+ >+ if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->logTiming(title, WTFMove(arguments)); >+} >+ > void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title, Ref<ScriptCallStack>&& stack) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h >index 9d132c5d761..1f75137fb5e 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.h >+++ b/Source/WebCore/inspector/InspectorInstrumentation.h >@@ -226,6 +226,8 @@ public: > static void takeHeapSnapshot(Frame&, const String& title); > static void startConsoleTiming(Frame&, const String& title); > static void startConsoleTiming(WorkerGlobalScope&, const String& title); >+ static void logConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptArguments>&&); >+ static void logConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptArguments>&&); > static void stopConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); > static void stopConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptCallStack>&&); > static void consoleTimeStamp(Frame&, Ref<Inspector::ScriptArguments>&&); >@@ -404,6 +406,7 @@ private: > static void takeHeapSnapshotImpl(InstrumentingAgents&, const String& title); > static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title); > static void startConsoleTimingImpl(InstrumentingAgents&, const String& title); >+ static void logConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptArguments>&&); > static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); > static void stopConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptCallStack>&&); > static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, Ref<Inspector::ScriptArguments>&&); >@@ -1408,6 +1411,17 @@ inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& work > startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title); > } > >+inline void InspectorInstrumentation::logConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+{ >+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) >+ logConsoleTimingImpl(*instrumentingAgents, title, WTFMove(arguments)); >+} >+ >+inline void InspectorInstrumentation::logConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+{ >+ logConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(arguments)); >+} >+ > inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptCallStack>&& stack) > { > if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) >diff --git a/Source/WebCore/page/PageConsoleClient.cpp b/Source/WebCore/page/PageConsoleClient.cpp >index d8de7e2b897..7b9704dda73 100644 >--- a/Source/WebCore/page/PageConsoleClient.cpp >+++ b/Source/WebCore/page/PageConsoleClient.cpp >@@ -197,6 +197,11 @@ void PageConsoleClient::time(JSC::ExecState*, const String& title) > InspectorInstrumentation::startConsoleTiming(m_page.mainFrame(), title); > } > >+void PageConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+{ >+ InspectorInstrumentation::logConsoleTiming(m_page.mainFrame(), title, WTFMove(arguments)); >+} >+ > void PageConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) > { > InspectorInstrumentation::stopConsoleTiming(m_page.mainFrame(), title, createScriptCallStackForConsole(exec, 1)); >diff --git a/Source/WebCore/page/PageConsoleClient.h b/Source/WebCore/page/PageConsoleClient.h >index 52c2fdc9ac8..3d0890034b3 100644 >--- a/Source/WebCore/page/PageConsoleClient.h >+++ b/Source/WebCore/page/PageConsoleClient.h >@@ -72,6 +72,7 @@ protected: > void profileEnd(JSC::ExecState*, const String& title) override; > void takeHeapSnapshot(JSC::ExecState*, const String& title) override; > void time(JSC::ExecState*, const String& title) override; >+ void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) override; > void timeEnd(JSC::ExecState*, const String& title) override; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >diff --git a/Source/WebCore/workers/WorkerConsoleClient.cpp b/Source/WebCore/workers/WorkerConsoleClient.cpp >index bab2da66329..dd643e73201 100644 >--- a/Source/WebCore/workers/WorkerConsoleClient.cpp >+++ b/Source/WebCore/workers/WorkerConsoleClient.cpp >@@ -60,6 +60,11 @@ void WorkerConsoleClient::time(JSC::ExecState*, const String& title) > InspectorInstrumentation::startConsoleTiming(m_workerGlobalScope, title); > } > >+void WorkerConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+{ >+ InspectorInstrumentation::logConsoleTiming(m_workerGlobalScope, title, WTFMove(arguments)); >+} >+ > void WorkerConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) > { > InspectorInstrumentation::stopConsoleTiming(m_workerGlobalScope, title, createScriptCallStackForConsole(exec, 1)); >diff --git a/Source/WebCore/workers/WorkerConsoleClient.h b/Source/WebCore/workers/WorkerConsoleClient.h >index ef38587471b..ec3e19c0b2c 100644 >--- a/Source/WebCore/workers/WorkerConsoleClient.h >+++ b/Source/WebCore/workers/WorkerConsoleClient.h >@@ -48,6 +48,7 @@ protected: > void profileEnd(JSC::ExecState*, const String& title) override; > void takeHeapSnapshot(JSC::ExecState*, const String& title) override; > void time(JSC::ExecState*, const String& title) override; >+ void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) override; > void timeEnd(JSC::ExecState*, const String& title) override; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >diff --git a/Source/WebCore/worklets/WorkletConsoleClient.cpp b/Source/WebCore/worklets/WorkletConsoleClient.cpp >index 5dcb68e07b2..eefbb9a113c 100644 >--- a/Source/WebCore/worklets/WorkletConsoleClient.cpp >+++ b/Source/WebCore/worklets/WorkletConsoleClient.cpp >@@ -55,6 +55,7 @@ void WorkletConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLeve > void WorkletConsoleClient::count(JSC::ExecState*, Ref<ScriptArguments>&&) { } > > void WorkletConsoleClient::time(JSC::ExecState*, const String&) { } >+void WorkletConsoleClient::timeLog(JSC::ExecState*, const String&, Ref<ScriptArguments>&&) { } > void WorkletConsoleClient::timeEnd(JSC::ExecState*, const String&) { } > > void WorkletConsoleClient::profile(JSC::ExecState*, const String&) { } >diff --git a/Source/WebCore/worklets/WorkletConsoleClient.h b/Source/WebCore/worklets/WorkletConsoleClient.h >index 7a581c804e0..38b6774dda3 100644 >--- a/Source/WebCore/worklets/WorkletConsoleClient.h >+++ b/Source/WebCore/worklets/WorkletConsoleClient.h >@@ -50,6 +50,7 @@ private: > void profileEnd(JSC::ExecState*, const String& title) final; > void takeHeapSnapshot(JSC::ExecState*, const String& title) final; > void time(JSC::ExecState*, const String& title) final; >+ void timeLog(JSC::ExecState*, const String& title, Ref<Inspector::ScriptArguments>&&) final; > void timeEnd(JSC::ExecState*, const String& title) final; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index dd4d4a9c0d1..2441ce4483c 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-24 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Web Inspector: Implement console.timeLog >+ https://bugs.webkit.org/show_bug.cgi?id=199184 >+ >+ Reviewed by Devin Rousso. >+ >+ * UserInterface/Views/ConsoleMessageView.js: >+ (WI.ConsoleMessageView.prototype._appendMessageTextAndArguments): >+ Time messages (like timeLog) do not include their messageText >+ in their parameters list. So to behave more like normal logs >+ build a parameter list that includes it at the front. >+ > 2019-06-23 Matt Baker <mattbaker@apple.com> > > Web Inspector: REGRESSION (r246684): Dark Mode: dashboard buttons should have no background >diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >index 7f6f93bc0a6..6f0a7dd3f45 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >@@ -288,6 +288,14 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > this._extraParameters = null; > break; > >+ case WI.ConsoleMessage.MessageType.Timing: { >+ let args = [this._message.messageText]; >+ if (this._extraParameters) >+ args = args.concat(this._extraParameters); >+ this._appendFormattedArguments(element, args); >+ break; >+ } >+ > case WI.ConsoleMessage.MessageType.Image: { > let img = element.appendChild(document.createElement("img")); > img.classList.add("console-image", "show-grid");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199184
:
372818
| 372843