WebKit Bugzilla
Attachment 372986 Details for
Bug 199252
: Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199252-20190626182048.patch (text/plain), 61.55 KB, created by
Devin Rousso
on 2019-06-26 18:20:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-06-26 18:20:49 PDT
Size:
61.55 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index bfab347678fa6c4bdc04fc4cc43e5a97ba77cbca..a224981aac9f19e75af1df9e8043afe6dcc619cf 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,53 @@ >+2019-06-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString >+ https://bugs.webkit.org/show_bug.cgi?id=199252 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Parse the arguments passed to `console.count` and `console.countReset` before sending it to >+ the `ConsoleClient` so that an error can be thrown if the first argument doesn't `toString` >+ nicely (e.g. without throwing an error). >+ >+ Generate call stacks for `console.countReset` to match other `console` methods. Also do this >+ for `console.time`, `console.timeLog`, and `console.TimeEnd`. Limit the call stack to only >+ have the top frame, so no unnecessary/extra data is sent to the frontend (right now, only >+ the call location is displayed). >+ >+ Rename `title` to `label` for `console.time`, `console.timeLog`, and `console.TimeEnd` to >+ better match the spec. >+ >+ * runtime/ConsoleClient.h: >+ * runtime/ConsoleObject.cpp: >+ (JSC::valueOrDefaultLabelString): >+ (JSC::consoleProtoFuncCount): >+ (JSC::consoleProtoFuncCountReset): >+ (JSC::consoleProtoFuncTime): >+ (JSC::consoleProtoFuncTimeLog): >+ (JSC::consoleProtoFuncTimeEnd): >+ >+ * inspector/JSGlobalObjectConsoleClient.h: >+ * inspector/JSGlobalObjectConsoleClient.cpp: >+ (Inspector::JSGlobalObjectConsoleClient::count): >+ (Inspector::JSGlobalObjectConsoleClient::countReset): >+ (Inspector::JSGlobalObjectConsoleClient::time): >+ (Inspector::JSGlobalObjectConsoleClient::timeLog): >+ (Inspector::JSGlobalObjectConsoleClient::timeEnd): >+ >+ * inspector/agents/InspectorConsoleAgent.h: >+ * inspector/agents/InspectorConsoleAgent.cpp: >+ (Inspector::InspectorConsoleAgent::startTiming): >+ (Inspector::InspectorConsoleAgent::logTiming): >+ (Inspector::InspectorConsoleAgent::stopTiming): >+ (Inspector::InspectorConsoleAgent::count): >+ (Inspector::InspectorConsoleAgent::countReset): >+ (Inspector::InspectorConsoleAgent::getCounterLabel): Deleted. >+ >+ * inspector/ConsoleMessage.h: >+ * inspector/ConsoleMessage.cpp: >+ (Inspector::ConsoleMessage::ConsoleMessage): >+ Allow `ConsoleMessage`s to be created with both `ScriptArguments` and a `ScriptCallStack`. >+ > 2019-06-26 Keith Miller <keith_miller@apple.com> > > speciesConstruct needs to throw if the result is a DataView >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0a643fea6ca3fefeecaeb81e613f43be9b63d89c..ddfcf044f5625bcd13259b62a570c331e67c5f72 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,62 @@ >+2019-06-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString >+ https://bugs.webkit.org/show_bug.cgi?id=199252 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Parse the arguments passed to `console.count` and `console.countReset` before sending it to >+ the `ConsoleClient` so that an error can be thrown if the first argument doesn't `toString` >+ nicely (e.g. without throwing an error). >+ >+ Generate call stacks for `console.countReset` to match other `console` methods. Also do this >+ for `console.time`, `console.timeLog`, and `console.TimeEnd`. Limit the call stack to only >+ have the top frame, so no unnecessary/extra data is sent to the frontend (right now, only >+ the call location is displayed). >+ >+ Rename `title` to `label` for `console.time`, `console.timeLog`, and `console.TimeEnd` to >+ better match the spec. >+ >+ Updated existing LayoutTests: >+ - inspector/console/console-count.html >+ - inspector/console/console-api.html >+ >+ Also covered by existing WPT tests. >+ >+ * inspector/InspectorInstrumentation.h: >+ (WebCore::InspectorInstrumentation::consoleCount): >+ (WebCore::InspectorInstrumentation::consoleCountReset): >+ (WebCore::InspectorInstrumentation::startConsoleTiming): >+ (WebCore::InspectorInstrumentation::logConsoleTiming): >+ (WebCore::InspectorInstrumentation::stopConsoleTiming): >+ * inspector/InspectorInstrumentation.cpp: >+ (WebCore::InspectorInstrumentation::consoleCountImpl): >+ (WebCore::InspectorInstrumentation::consoleCountResetImpl): >+ (WebCore::InspectorInstrumentation::startConsoleTimingImpl): >+ (WebCore::InspectorInstrumentation::logConsoleTimingImpl): >+ (WebCore::InspectorInstrumentation::stopConsoleTimingImpl): >+ >+ * page/PageConsoleClient.h: >+ * page/PageConsoleClient.cpp: >+ (WebCore::PageConsoleClient::count): >+ (WebCore::PageConsoleClient::countReset): >+ (WebCore::PageConsoleClient::time): >+ (WebCore::PageConsoleClient::timeLog): >+ (WebCore::PageConsoleClient::timeEnd): >+ >+ * workers/WorkerConsoleClient.h: >+ * workers/WorkerConsoleClient.cpp: >+ (WebCore::WorkerConsoleClient::count): >+ (WebCore::WorkerConsoleClient::countReset): >+ (WebCore::WorkerConsoleClient::time): >+ (WebCore::WorkerConsoleClient::timeLog): >+ (WebCore::WorkerConsoleClient::timeEnd): >+ >+ * worklets/WorkletConsoleClient.h: >+ * worklets/WorkletConsoleClient.cpp: >+ (WebCore::WorkletConsoleClient::count): >+ (WebCore::WorkletConsoleClient::countReset): >+ > 2019-06-26 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Implement console.countReset >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index cf061be3b17f987f3be7df606f9644b715f5e6e4..5718c39c10f68d7309ed216fd2e5a59f674d804b 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString >+ https://bugs.webkit.org/show_bug.cgi?id=199252 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add entries for `console.countReset` and `console.timeLog`. >+ >+ Rename `title` to `label` for `console.time`, `console.timeLog`, and `console.TimeEnd` to >+ better match the spec. >+ >+ * UserInterface/Models/NativeFunctionParameters.js: >+ > 2019-06-26 Devin Rousso <drousso@apple.com> > > Web Inspector: REGRESSION: Elements: the forced pseudo-class indicator isn't visible when hovering >diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp >index f501e10176ed00f1334aab19dfd898e1ddc34078..c4b2615bc6316f230d914d80dd8d7b4f651c0674 100644 >--- a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp >+++ b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp >@@ -82,6 +82,24 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe > } > } > >+ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, Ref<ScriptArguments>&& arguments, Ref<ScriptCallStack>&& callStack, unsigned long requestIdentifier) >+ : m_source(source) >+ , m_type(type) >+ , m_level(level) >+ , m_message(message) >+ , m_arguments(WTFMove(arguments)) >+ , m_callStack(WTFMove(callStack)) >+ , m_url() >+ , m_requestId(IdentifiersFactory::requestId(requestIdentifier)) >+{ >+ const ScriptCallFrame* frame = m_callStack ? m_callStack->firstNonNativeCallFrame() : nullptr; >+ if (frame) { >+ m_url = frame->sourceURL(); >+ m_line = frame->lineNumber(); >+ m_column = frame->columnNumber(); >+ } >+} >+ > ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, Ref<ScriptArguments>&& arguments, JSC::ExecState* state, unsigned long requestIdentifier) > : m_source(source) > , m_type(type) >diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.h b/Source/JavaScriptCore/inspector/ConsoleMessage.h >index 0a92f5b49fdce8f0c1125db6df2c8afd8c54ff80..7b9d0bcf7b9e7846974da6f421262e3fd17c05c0 100644 >--- a/Source/JavaScriptCore/inspector/ConsoleMessage.h >+++ b/Source/JavaScriptCore/inspector/ConsoleMessage.h >@@ -55,6 +55,7 @@ public: > ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned long requestIdentifier = 0); > ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, const String& url, unsigned line, unsigned column, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0); > ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, Ref<ScriptCallStack>&&, unsigned long requestIdentifier = 0); >+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, Ref<ScriptArguments>&&, Ref<ScriptCallStack>&&, unsigned long requestIdentifier = 0); > ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, Ref<ScriptArguments>&&, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0); > ConsoleMessage(MessageSource, MessageType, MessageLevel, Vector<JSONLogValue>&&, JSC::ExecState*, unsigned long requestIdentifier = 0); > ~ConsoleMessage(); >diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >index 3795f5b17ede2632f83bded442581afe479feb9f..82be3bbb44cb6c5776b8ecf7fa0c940d5d5a5825 100644 >--- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp >@@ -70,14 +70,14 @@ void JSGlobalObjectConsoleClient::messageWithTypeAndLevel(MessageType type, Mess > m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, type, level, message, WTFMove(arguments), exec)); > } > >-void JSGlobalObjectConsoleClient::count(ExecState* exec, Ref<ScriptArguments>&& arguments) >+void JSGlobalObjectConsoleClient::count(ExecState* exec, const String& label) > { >- m_consoleAgent->count(exec, WTFMove(arguments)); >+ m_consoleAgent->count(exec, label); > } > >-void JSGlobalObjectConsoleClient::countReset(ExecState* exec, Ref<ScriptArguments>&& arguments) >+void JSGlobalObjectConsoleClient::countReset(ExecState* exec, const String& label) > { >- m_consoleAgent->countReset(exec, WTFMove(arguments)); >+ m_consoleAgent->countReset(exec, label); > } > > void JSGlobalObjectConsoleClient::profile(JSC::ExecState*, const String& title) >@@ -153,19 +153,19 @@ void JSGlobalObjectConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String > m_consoleAgent->takeHeapSnapshot(title); > } > >-void JSGlobalObjectConsoleClient::time(ExecState*, const String& title) >+void JSGlobalObjectConsoleClient::time(ExecState* exec, const String& label) > { >- m_consoleAgent->startTiming(title); >+ m_consoleAgent->startTiming(exec, label); > } > >-void JSGlobalObjectConsoleClient::timeLog(ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+void JSGlobalObjectConsoleClient::timeLog(ExecState* exec, const String& label, Ref<ScriptArguments>&& arguments) > { >- m_consoleAgent->logTiming(title, WTFMove(arguments)); >+ m_consoleAgent->logTiming(exec, label, WTFMove(arguments)); > } > >-void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& title) >+void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& label) > { >- m_consoleAgent->stopTiming(title, createScriptCallStackForConsole(exec, 1)); >+ m_consoleAgent->stopTiming(exec, label); > } > > void JSGlobalObjectConsoleClient::timeStamp(ExecState*, Ref<ScriptArguments>&&) >diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >index b75c66d20fddc0f3dfbe23c7f1c9c2c5093be0f5..fa007b5e97af6835a23443e29ddfccc32cb35a5b 100644 >--- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h >@@ -49,14 +49,14 @@ public: > > protected: > void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, Ref<ScriptArguments>&&) override; >- void count(JSC::ExecState*, Ref<ScriptArguments>&&) override; >- void countReset(JSC::ExecState*, Ref<ScriptArguments>&&) override; >+ void count(JSC::ExecState*, const String& label) override; >+ void countReset(JSC::ExecState*, const String& label) override; > void profile(JSC::ExecState*, const String& title) override; > 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 time(JSC::ExecState*, const String& label) override; >+ void timeLog(JSC::ExecState*, const String& label, Ref<ScriptArguments>&& arguments) override; >+ void timeEnd(JSC::ExecState*, const String& label) override; > void timeStamp(JSC::ExecState*, Ref<ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<ScriptArguments>&&) override; > void recordEnd(JSC::ExecState*, Ref<ScriptArguments>&&) override; >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >index 72fe7b46d16e518ae751b161f11ae4b4f2fa709d..7edbc80660f36d6a81aa91fb8fa3fdddedae6f26 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp >@@ -126,67 +126,71 @@ void InspectorConsoleAgent::addMessageToConsole(std::unique_ptr<ConsoleMessage> > addConsoleMessage(WTFMove(message)); > } > >-void InspectorConsoleAgent::startTiming(const String& title) >+void InspectorConsoleAgent::startTiming(JSC::ExecState* exec, const String& label) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) > return; > >- ASSERT(!title.isNull()); >- if (title.isNull()) >+ ASSERT(!label.isNull()); >+ if (label.isNull()) > return; > >- auto result = m_times.add(title, MonotonicTime::now()); >+ auto result = m_times.add(label, MonotonicTime::now()); > > if (!result.isNewEntry) { > // FIXME: Send an enum to the frontend for localization? >- String warning = makeString("Timer \"", title, "\" already exists"); >- addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning)); >+ String warning = makeString("Timer \"", label, "\" already exists"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning, createScriptCallStackForConsole(exec, 1))); > } > } > >-void InspectorConsoleAgent::logTiming(const String& title, Ref<ScriptArguments>&& arguments) >+void InspectorConsoleAgent::logTiming(JSC::ExecState* exec, const String& label, Ref<ScriptArguments>&& arguments) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) > return; > >- ASSERT(!title.isNull()); >- if (title.isNull()) >+ ASSERT(!label.isNull()); >+ if (label.isNull()) > return; > >- auto it = m_times.find(title); >+ auto callStack = createScriptCallStackForConsole(exec, 1); >+ >+ auto it = m_times.find(label); > 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)); >+ String warning = makeString("Timer \"", label, "\" does not exist"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning, WTFMove(callStack))); > 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))); >+ String message = makeString(label, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(arguments), WTFMove(callStack))); > } > >-void InspectorConsoleAgent::stopTiming(const String& title, Ref<ScriptCallStack>&& callStack) >+void InspectorConsoleAgent::stopTiming(JSC::ExecState* exec, const String& label) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) > return; > >- ASSERT(!title.isNull()); >- if (title.isNull()) >+ ASSERT(!label.isNull()); >+ if (label.isNull()) > return; > >- auto it = m_times.find(title); >+ auto callStack = createScriptCallStackForConsole(exec, 1); >+ >+ auto it = m_times.find(label); > 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)); >+ String warning = makeString("Timer \"", label, "\" does not exist"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Warning, warning, WTFMove(callStack))); > return; > } > > MonotonicTime startTime = it->value; > Seconds elapsed = MonotonicTime::now() - startTime; >- String message = makeString(title, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); >+ String message = makeString(label, ": ", FormattedNumber::fixedWidth(elapsed.milliseconds(), 3), "ms"); > addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, WTFMove(callStack))); > > m_times.remove(it); >@@ -208,53 +212,31 @@ void InspectorConsoleAgent::takeHeapSnapshot(const String& title) > m_frontendDispatcher->heapSnapshot(timestamp, snapshotData, title.isEmpty() ? nullptr : &title); > } > >-void InspectorConsoleAgent::getCounterLabel(Ref<ScriptArguments>&& arguments, String& title, String& identifier) >-{ >- if (!arguments->argumentCount()) { >- // '@' prefix for engine generated labels. >- title = "Global"_s; >- identifier = makeString('@', title); >- } else { >- // '#' prefix for user labels. >- arguments->getFirstArgumentAsString(title); >- identifier = makeString('#', title); >- } >-} >- >-void InspectorConsoleAgent::count(JSC::ExecState* state, Ref<ScriptArguments>&& arguments) >+void InspectorConsoleAgent::count(JSC::ExecState* exec, const String& label) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) > return; > >- String title; >- String identifier; >- getCounterLabel(WTFMove(arguments), title, identifier); >- >- auto result = m_counts.add(identifier, 1); >+ auto result = m_counts.add(label, 1); > if (!result.isNewEntry) > result.iterator->value += 1; > > // FIXME: Web Inspector should have a better UI for counters, but for now we just log an updated counter value. > >- String message = makeString(title, ": ", result.iterator->value); >- Ref<ScriptCallStack> callStack = createScriptCallStackForConsole(state); >- addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Debug, message, WTFMove(callStack))); >+ String message = makeString(label, ": ", result.iterator->value); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Debug, message, createScriptCallStackForConsole(exec, 1))); > } > >-void InspectorConsoleAgent::countReset(JSC::ExecState*, Ref<ScriptArguments>&& arguments) >+void InspectorConsoleAgent::countReset(JSC::ExecState* exec, const String& label) > { > if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) > return; > >- String title; >- String identifier; >- getCounterLabel(WTFMove(arguments), title, identifier); >- >- auto it = m_counts.find(identifier); >+ auto it = m_counts.find(label); > if (it == m_counts.end()) { > // FIXME: Send an enum to the frontend for localization? >- String warning = makeString("Counter \"", title, "\" does not exist"); >- addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Warning, warning)); >+ String warning = makeString("Counter \"", label, "\" does not exist"); >+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Warning, warning, createScriptCallStackForConsole(exec, 1))); > return; > } > >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >index d9f623573a1fbb16133a77da93a480c66d737bb1..55387c497eae9b17b925ca713f6ece83d4a84b7f 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h >@@ -70,18 +70,17 @@ 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 startTiming(JSC::ExecState*, const String& label); >+ void logTiming(JSC::ExecState*, const String& label, Ref<ScriptArguments>&&); >+ void stopTiming(JSC::ExecState*, const String& label); > void takeHeapSnapshot(const String& title); >- void count(JSC::ExecState*, Ref<ScriptArguments>&&); >- void countReset(JSC::ExecState*, Ref<ScriptArguments>&&); >+ void count(JSC::ExecState*, const String& label); >+ void countReset(JSC::ExecState*, const String& label); > > void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>&) override; > void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) override; > > protected: >- void getCounterLabel(Ref<ScriptArguments>&&, String& title, String& identifier); > void addConsoleMessage(std::unique_ptr<ConsoleMessage>); > > InjectedScriptManager& m_injectedScriptManager; >diff --git a/Source/JavaScriptCore/runtime/ConsoleClient.h b/Source/JavaScriptCore/runtime/ConsoleClient.h >index 457080b81d383039a33c59bca0e23bcd59a97e03..198eff3a36f20c17715735821462f1380e755115 100644 >--- a/Source/JavaScriptCore/runtime/ConsoleClient.h >+++ b/Source/JavaScriptCore/runtime/ConsoleClient.h >@@ -55,14 +55,14 @@ public: > void groupEnd(ExecState*, Ref<Inspector::ScriptArguments>&&); > > virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; >- virtual void count(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; >- virtual void countReset(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; >+ virtual void count(ExecState*, const String& label) = 0; >+ virtual void countReset(ExecState*, const String& label) = 0; > virtual void profile(ExecState*, const String& title) = 0; > 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 time(ExecState*, const String& label) = 0; >+ virtual void timeLog(ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&) = 0; >+ virtual void timeEnd(ExecState*, const String& label) = 0; > virtual void timeStamp(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; > virtual void record(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; > virtual void recordEnd(ExecState*, Ref<Inspector::ScriptArguments>&&) = 0; >diff --git a/Source/JavaScriptCore/runtime/ConsoleObject.cpp b/Source/JavaScriptCore/runtime/ConsoleObject.cpp >index 8c81a97025efef9a813f25944c59bc2a85a289b6..7f4cf7e463fec9b3d556176cc353cb8ab020d8b6 100644 >--- a/Source/JavaScriptCore/runtime/ConsoleObject.cpp >+++ b/Source/JavaScriptCore/runtime/ConsoleObject.cpp >@@ -34,6 +34,18 @@ > > namespace JSC { > >+static String valueOrDefaultLabelString(ExecState* exec) >+{ >+ if (exec->argumentCount() < 1) >+ return "default"_s; >+ >+ auto value = exec->argument(0); >+ if (value.isUndefined()) >+ return "default"_s; >+ >+ return value.toWTFString(exec); >+} >+ > STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ConsoleObject); > > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState*); >@@ -219,21 +231,29 @@ static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState* exec) > > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState* exec) > { >- ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); >+ auto scope = DECLARE_THROW_SCOPE(exec->vm()); >+ auto* client = exec->lexicalGlobalObject()->consoleClient(); > if (!client) > return JSValue::encode(jsUndefined()); > >- client->count(exec, Inspector::createScriptArguments(exec, 0)); >+ auto label = valueOrDefaultLabelString(exec); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); >+ >+ client->count(exec, label); > return JSValue::encode(jsUndefined()); > } > > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCountReset(ExecState* exec) > { >- ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); >+ auto scope = DECLARE_THROW_SCOPE(exec->vm()); >+ auto* client = exec->lexicalGlobalObject()->consoleClient(); > if (!client) > return JSValue::encode(jsUndefined()); > >- client->countReset(exec, Inspector::createScriptArguments(exec, 0)); >+ auto label = valueOrDefaultLabelString(exec); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); >+ >+ client->countReset(exec, label); > return JSValue::encode(jsUndefined()); > } > >@@ -300,70 +320,45 @@ static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState* > return JSValue::encode(jsUndefined()); > } > >-static String valueOrDefaultLabelString(ExecState* exec, JSValue value) >-{ >- if (value.isUndefined()) >- return "default"_s; >- return value.toWTFString(exec); >-} >- > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec) > { >- VM& vm = exec->vm(); >- auto scope = DECLARE_THROW_SCOPE(vm); >- ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); >+ auto scope = DECLARE_THROW_SCOPE(exec->vm()); >+ auto* 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()); >- } >+ auto label = valueOrDefaultLabelString(exec); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); > >- client->time(exec, title); >+ client->time(exec, label); > 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(); >+ auto scope = DECLARE_THROW_SCOPE(exec->vm()); >+ auto* 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()); >- } >+ auto label = valueOrDefaultLabelString(exec); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); > >- client->timeLog(exec, title, Inspector::createScriptArguments(exec, 1)); >+ client->timeLog(exec, label, Inspector::createScriptArguments(exec, 1)); > return JSValue::encode(jsUndefined()); > } > > static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec) > { >- VM& vm = exec->vm(); >- auto scope = DECLARE_THROW_SCOPE(vm); >- ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient(); >+ auto scope = DECLARE_THROW_SCOPE(exec->vm()); >+ auto* 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()); >- } >+ auto label = valueOrDefaultLabelString(exec); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); > >- client->timeEnd(exec, title); >+ client->timeEnd(exec, label); > return JSValue::encode(jsUndefined()); > } > >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp >index 8cfe8a75a36a0ff02d2251c8b6bead3d36c1b7ea..fbb8af4a82ea0fdf792e4a1fd310f79c9d60450d 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp >+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp >@@ -851,16 +851,16 @@ void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents& inst > } > } > >-void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* state, Ref<ScriptArguments>&& arguments) >+void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* state, const String& label) > { >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->count(state, WTFMove(arguments)); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->count(state, label); > } > >-void InspectorInstrumentation::consoleCountResetImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* state, Ref<ScriptArguments>&& arguments) >+void InspectorInstrumentation::consoleCountResetImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* state, const String& label) > { >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->countReset(state, WTFMove(arguments)); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->countReset(state, label); > } > > void InspectorInstrumentation::takeHeapSnapshotImpl(InstrumentingAgents& instrumentingAgents, const String& title) >@@ -869,53 +869,53 @@ void InspectorInstrumentation::takeHeapSnapshotImpl(InstrumentingAgents& instrum > consoleAgent->takeHeapSnapshot(title); > } > >-void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title) >+void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, JSC::ExecState* exec, const String& label) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) > return; > >- if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) >- timelineAgent->time(frame, title); >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->startTiming(title); >+ if (auto* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) >+ timelineAgent->time(frame, label); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->startTiming(exec, label); > } > >-void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, const String& title) >+void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& label) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) > return; > >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->startTiming(title); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->startTiming(exec, label); > } > >-void InspectorInstrumentation::logConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+void InspectorInstrumentation::logConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& label, Ref<Inspector::ScriptArguments>&& arguments) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) > return; > >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->logTiming(title, WTFMove(arguments)); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->logTiming(exec, label, WTFMove(arguments)); > } > >-void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title, Ref<ScriptCallStack>&& stack) >+void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, JSC::ExecState* exec, const String& label) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) > return; > >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->stopTiming(title, WTFMove(stack)); >- if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) >- timelineAgent->timeEnd(frame, title); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->stopTiming(exec, label); >+ if (auto* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) >+ timelineAgent->timeEnd(frame, label); > } > >-void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, const String& title, Ref<ScriptCallStack>&& stack) >+void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& label) > { > if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled()) > return; > >- if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent()) >- consoleAgent->stopTiming(title, WTFMove(stack)); >+ if (auto* consoleAgent = instrumentingAgents.webConsoleAgent()) >+ consoleAgent->stopTiming(exec, label); > } > > void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, Ref<ScriptArguments>&& arguments) >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h >index d5368c12e13da11918438869046fc0c5bd5f8d96..b2d15ce86ddad6dcbbceeb442a5c926c64cc3fc6 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.h >+++ b/Source/WebCore/inspector/InspectorInstrumentation.h >@@ -221,18 +221,18 @@ public: > static void addMessageToConsole(Page&, std::unique_ptr<Inspector::ConsoleMessage>); > static void addMessageToConsole(WorkerGlobalScope&, std::unique_ptr<Inspector::ConsoleMessage>); > >- static void consoleCount(Page&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >- static void consoleCount(WorkerGlobalScope&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >- static void consoleCountReset(Page&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >- static void consoleCountReset(WorkerGlobalScope&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >+ static void consoleCount(Page&, JSC::ExecState*, const String& label); >+ static void consoleCount(WorkerGlobalScope&, JSC::ExecState*, const String& label); >+ static void consoleCountReset(Page&, JSC::ExecState*, const String& label); >+ static void consoleCountReset(WorkerGlobalScope&, JSC::ExecState*, const String& label); > > 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 startConsoleTiming(Frame&, JSC::ExecState*, const String& label); >+ static void startConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label); >+ static void logConsoleTiming(Frame&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&); >+ static void logConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&); >+ static void stopConsoleTiming(Frame&, JSC::ExecState*, const String& label); >+ static void stopConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label); > static void consoleTimeStamp(Frame&, Ref<Inspector::ScriptArguments>&&); > static void startProfiling(Page&, JSC::ExecState*, const String& title); > static void stopProfiling(Page&, JSC::ExecState*, const String& title); >@@ -405,14 +405,14 @@ private: > > static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr<Inspector::ConsoleMessage>); > >- static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >- static void consoleCountResetImpl(InstrumentingAgents&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); >+ static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, const String& label); >+ static void consoleCountResetImpl(InstrumentingAgents&, JSC::ExecState*, const String& label); > 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 startConsoleTimingImpl(InstrumentingAgents&, Frame&, JSC::ExecState*, const String& label); >+ static void startConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label); >+ static void logConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&); >+ static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, JSC::ExecState*, const String& label); >+ static void stopConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label); > static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, Ref<Inspector::ScriptArguments>&&); > static void startProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); > static void stopProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); >@@ -1387,24 +1387,24 @@ inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope& wor > addMessageToConsoleImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), WTFMove(message)); > } > >-inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, const String& label) > { >- consoleCountImpl(instrumentingAgentsForPage(page), state, WTFMove(arguments)); >+ consoleCountImpl(instrumentingAgentsForPage(page), state, label); > } > >-inline void InspectorInstrumentation::consoleCount(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::consoleCount(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, const String& label) > { >- consoleCountImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, WTFMove(arguments)); >+ consoleCountImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, label); > } > >-inline void InspectorInstrumentation::consoleCountReset(Page& page, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::consoleCountReset(Page& page, JSC::ExecState* state, const String& label) > { >- consoleCountResetImpl(instrumentingAgentsForPage(page), state, WTFMove(arguments)); >+ consoleCountResetImpl(instrumentingAgentsForPage(page), state, label); > } > >-inline void InspectorInstrumentation::consoleCountReset(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::consoleCountReset(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, const String& label) > { >- consoleCountResetImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, WTFMove(arguments)); >+ consoleCountResetImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, label); > } > > inline void InspectorInstrumentation::takeHeapSnapshot(Frame& frame, const String& title) >@@ -1414,37 +1414,37 @@ inline void InspectorInstrumentation::takeHeapSnapshot(Frame& frame, const Strin > takeHeapSnapshotImpl(*instrumentingAgents, title); > } > >-inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, const String& title) >+inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label) > { >- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) >- startConsoleTimingImpl(*instrumentingAgents, frame, title); >+ if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame)) >+ startConsoleTimingImpl(*instrumentingAgents, frame, exec, label); > } > >-inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title) >+inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label) > { >- startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title); >+ startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label); > } > >-inline void InspectorInstrumentation::logConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::logConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label, Ref<Inspector::ScriptArguments>&& arguments) > { >- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) >- logConsoleTimingImpl(*instrumentingAgents, title, WTFMove(arguments)); >+ if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame)) >+ logConsoleTimingImpl(*instrumentingAgents, exec, label, WTFMove(arguments)); > } > >-inline void InspectorInstrumentation::logConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptArguments>&& arguments) >+inline void InspectorInstrumentation::logConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label, Ref<Inspector::ScriptArguments>&& arguments) > { >- logConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(arguments)); >+ logConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label, WTFMove(arguments)); > } > >-inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptCallStack>&& stack) >+inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label) > { >- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) >- stopConsoleTimingImpl(*instrumentingAgents, frame, title, WTFMove(stack)); >+ if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame)) >+ stopConsoleTimingImpl(*instrumentingAgents, frame, exec, label); > } > >-inline void InspectorInstrumentation::stopConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptCallStack>&& stack) >+inline void InspectorInstrumentation::stopConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label) > { >- stopConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(stack)); >+ stopConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label); > } > > inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, Ref<Inspector::ScriptArguments>&& arguments) >diff --git a/Source/WebCore/page/PageConsoleClient.cpp b/Source/WebCore/page/PageConsoleClient.cpp >index af2267cb1d1360b6f3322cd1c0320f008f3db2c7..c3b1d3692086770fb1780c490e47748ebd91257a 100644 >--- a/Source/WebCore/page/PageConsoleClient.cpp >+++ b/Source/WebCore/page/PageConsoleClient.cpp >@@ -170,14 +170,14 @@ void PageConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel l > ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, WTFMove(arguments)); > } > >-void PageConsoleClient::count(JSC::ExecState* exec, Ref<ScriptArguments>&& arguments) >+void PageConsoleClient::count(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::consoleCount(m_page, exec, WTFMove(arguments)); >+ InspectorInstrumentation::consoleCount(m_page, exec, label); > } > >-void PageConsoleClient::countReset(JSC::ExecState* exec, Ref<ScriptArguments>&& arguments) >+void PageConsoleClient::countReset(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::consoleCountReset(m_page, exec, WTFMove(arguments)); >+ InspectorInstrumentation::consoleCountReset(m_page, exec, label); > } > > void PageConsoleClient::profile(JSC::ExecState* exec, const String& title) >@@ -197,19 +197,19 @@ void PageConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String& title) > InspectorInstrumentation::takeHeapSnapshot(m_page.mainFrame(), title); > } > >-void PageConsoleClient::time(JSC::ExecState*, const String& title) >+void PageConsoleClient::time(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::startConsoleTiming(m_page.mainFrame(), title); >+ InspectorInstrumentation::startConsoleTiming(m_page.mainFrame(), exec, label); > } > >-void PageConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+void PageConsoleClient::timeLog(JSC::ExecState* exec, const String& label, Ref<ScriptArguments>&& arguments) > { >- InspectorInstrumentation::logConsoleTiming(m_page.mainFrame(), title, WTFMove(arguments)); >+ InspectorInstrumentation::logConsoleTiming(m_page.mainFrame(), exec, label, WTFMove(arguments)); > } > >-void PageConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) >+void PageConsoleClient::timeEnd(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::stopConsoleTiming(m_page.mainFrame(), title, createScriptCallStackForConsole(exec, 1)); >+ InspectorInstrumentation::stopConsoleTiming(m_page.mainFrame(), exec, label); > } > > void PageConsoleClient::timeStamp(JSC::ExecState*, Ref<ScriptArguments>&& arguments) >diff --git a/Source/WebCore/page/PageConsoleClient.h b/Source/WebCore/page/PageConsoleClient.h >index 8a39da0d7da33238243abda1b274b0ae05acb2e6..ffbf62b201fe31285382178c349d0ab2b74e5570 100644 >--- a/Source/WebCore/page/PageConsoleClient.h >+++ b/Source/WebCore/page/PageConsoleClient.h >@@ -67,14 +67,14 @@ public: > > protected: > void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >- void count(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >- void countReset(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >+ void count(JSC::ExecState*, const String& label) override; >+ void countReset(JSC::ExecState*, const String& label) override; > void profile(JSC::ExecState*, const String& title) override; > 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 time(JSC::ExecState*, const String& label) override; >+ void timeLog(JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&) override; >+ void timeEnd(JSC::ExecState*, const String& label) override; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void recordEnd(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >diff --git a/Source/WebCore/workers/WorkerConsoleClient.cpp b/Source/WebCore/workers/WorkerConsoleClient.cpp >index c7b6b40f20954f2cf3db91360fe7c38b278c1862..dbe9073d6adebfc50159cc2edbb2283ccd17ba85 100644 >--- a/Source/WebCore/workers/WorkerConsoleClient.cpp >+++ b/Source/WebCore/workers/WorkerConsoleClient.cpp >@@ -50,29 +50,29 @@ void WorkerConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel > m_workerGlobalScope.addConsoleMessage(WTFMove(message)); > } > >-void WorkerConsoleClient::count(JSC::ExecState* exec, Ref<ScriptArguments>&& arguments) >+void WorkerConsoleClient::count(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::consoleCount(m_workerGlobalScope, exec, WTFMove(arguments)); >+ InspectorInstrumentation::consoleCount(m_workerGlobalScope, exec, label); > } > >-void WorkerConsoleClient::countReset(JSC::ExecState* exec, Ref<ScriptArguments>&& arguments) >+void WorkerConsoleClient::countReset(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::consoleCountReset(m_workerGlobalScope, exec, WTFMove(arguments)); >+ InspectorInstrumentation::consoleCountReset(m_workerGlobalScope, exec, label); > } > >-void WorkerConsoleClient::time(JSC::ExecState*, const String& title) >+void WorkerConsoleClient::time(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::startConsoleTiming(m_workerGlobalScope, title); >+ InspectorInstrumentation::startConsoleTiming(m_workerGlobalScope, exec, label); > } > >-void WorkerConsoleClient::timeLog(JSC::ExecState*, const String& title, Ref<ScriptArguments>&& arguments) >+void WorkerConsoleClient::timeLog(JSC::ExecState* exec, const String& label, Ref<ScriptArguments>&& arguments) > { >- InspectorInstrumentation::logConsoleTiming(m_workerGlobalScope, title, WTFMove(arguments)); >+ InspectorInstrumentation::logConsoleTiming(m_workerGlobalScope, exec, label, WTFMove(arguments)); > } > >-void WorkerConsoleClient::timeEnd(JSC::ExecState* exec, const String& title) >+void WorkerConsoleClient::timeEnd(JSC::ExecState* exec, const String& label) > { >- InspectorInstrumentation::stopConsoleTiming(m_workerGlobalScope, title, createScriptCallStackForConsole(exec, 1)); >+ InspectorInstrumentation::stopConsoleTiming(m_workerGlobalScope, exec, label); > } > > // FIXME: <https://webkit.org/b/153499> Web Inspector: console.profile should use the new Sampling Profiler >diff --git a/Source/WebCore/workers/WorkerConsoleClient.h b/Source/WebCore/workers/WorkerConsoleClient.h >index 6177db18fcfec9f035ba118d490998a61ccd7167..3846d271b68bd6982000b52b9abab97676761469 100644 >--- a/Source/WebCore/workers/WorkerConsoleClient.h >+++ b/Source/WebCore/workers/WorkerConsoleClient.h >@@ -43,14 +43,14 @@ public: > > protected: > void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >- void count(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >- void countReset(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >+ void count(JSC::ExecState*, const String& label) override; >+ void countReset(JSC::ExecState*, const String& label) override; > void profile(JSC::ExecState*, const String& title) override; > 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 time(JSC::ExecState*, const String& label) override; >+ void timeLog(JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&) override; >+ void timeEnd(JSC::ExecState*, const String& label) override; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; > void recordEnd(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) override; >diff --git a/Source/WebCore/worklets/WorkletConsoleClient.cpp b/Source/WebCore/worklets/WorkletConsoleClient.cpp >index 9f1d37dceabbe63fa6ac56ea69a7a379d9e02278..8e8a2a4ca23e2b93da134afb52d0e9576c402159 100644 >--- a/Source/WebCore/worklets/WorkletConsoleClient.cpp >+++ b/Source/WebCore/worklets/WorkletConsoleClient.cpp >@@ -52,8 +52,8 @@ void WorkletConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLeve > m_workletGlobalScope.addConsoleMessage(WTFMove(message)); > } > >-void WorkletConsoleClient::count(JSC::ExecState*, Ref<ScriptArguments>&&) { } >-void WorkletConsoleClient::countReset(JSC::ExecState*, Ref<ScriptArguments>&&) { } >+void WorkletConsoleClient::count(JSC::ExecState*, const String&) { } >+void WorkletConsoleClient::countReset(JSC::ExecState*, const String&) { } > > void WorkletConsoleClient::time(JSC::ExecState*, const String&) { } > void WorkletConsoleClient::timeLog(JSC::ExecState*, const String&, Ref<ScriptArguments>&&) { } >diff --git a/Source/WebCore/worklets/WorkletConsoleClient.h b/Source/WebCore/worklets/WorkletConsoleClient.h >index d8446403b3159ed34d2d538145f41e0311653ac5..631dae9901ac9a43d20869ea5d81fc33458c8e90 100644 >--- a/Source/WebCore/worklets/WorkletConsoleClient.h >+++ b/Source/WebCore/worklets/WorkletConsoleClient.h >@@ -45,14 +45,14 @@ public: > > private: > void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; >- void count(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; >- void countReset(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; >+ void count(JSC::ExecState*, const String& label) final; >+ void countReset(JSC::ExecState*, const String& label) final; > void profile(JSC::ExecState*, const String& title) final; > 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 time(JSC::ExecState*, const String& label) final; >+ void timeLog(JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&) final; >+ void timeEnd(JSC::ExecState*, const String& label) final; > void timeStamp(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; > void record(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; > void recordEnd(JSC::ExecState*, Ref<Inspector::ScriptArguments>&&) final; >diff --git a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js >index ccbb66baab2121998a86edaf397fa2b291aa2db7..4b4bba281efddabe4dabcbec42ef407819130a00 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js >+++ b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js >@@ -161,7 +161,8 @@ WI.NativeConstructorFunctionParameters = { > > Console: { > assert: "condition, [message], [...values]", >- count: "[label]", >+ count: "label = \"default\"", >+ countReset: "label = \"default\"", > debug: "message, [...values]", > dir: "object", > dirxml: "object", >@@ -178,8 +179,9 @@ WI.NativeConstructorFunctionParameters = { > screenshot: "[node]", > table: "data, [columns]", > takeHeapSnapshot: "[label]", >- time: "name = \"default\"", >- timeEnd: "name = \"default\"", >+ time: "label = \"default\"", >+ timeLog: "label = \"default\"", >+ timeEnd: "label = \"default\"", > timeStamp: "[label]", > trace: "message, [...values]", > warn: "message, [...values]", >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 33165c5566af2d81e9a2a543ae2f25b840ca6838..a7e35eb5fc2d5e3ee5a4bac439eb46b70a9ceffd 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2019-06-26 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString >+ https://bugs.webkit.org/show_bug.cgi?id=199252 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/console/console-count.html: >+ * inspector/console/console-count-expected.txt: >+ * inspector/console/console-api.html: >+ * inspector/console/console-api-expected.txt: >+ > 2019-06-26 Russell Epstein <russell_e@apple.com> > > Layout Test http/tests/performance/performance-resource-timing-resourcetimingbufferfull-shrinking-buffer-crash.html is failing. >diff --git a/LayoutTests/inspector/console/console-api-expected.txt b/LayoutTests/inspector/console/console-api-expected.txt >index 836e8142463549abf0e8dc10ef593703016d6b00..2dcd9e69c524c827524cf3fd430c9ce518e35d16 100644 >--- a/LayoutTests/inspector/console/console-api-expected.txt >+++ b/LayoutTests/inspector/console/console-api-expected.txt >@@ -585,7 +585,7 @@ STEP: console.count() > { > "_source": "console-api", > "_level": "debug", >- "_messageText": "Global: 1", >+ "_messageText": "default: 1", > "_type": "log", > "_url": null, > "_line": 3, >@@ -599,7 +599,21 @@ STEP: console.count() > { > "_source": "console-api", > "_level": "debug", >- "_messageText": "Global: 2", >+ "_messageText": "default: 2", >+ "_type": "log", >+ "_url": null, >+ "_line": 3, >+ "_column": 14, >+ "_repeatCount": 1, >+ "_stackTrace": "<filtered>", >+ "_request": null >+} >+ >+STEP: console.count("default") >+{ >+ "_source": "console-api", >+ "_level": "debug", >+ "_messageText": "default: 3", > "_type": "log", > "_url": null, > "_line": 3, >diff --git a/LayoutTests/inspector/console/console-api.html b/LayoutTests/inspector/console/console-api.html >index d5f1df829c883eb1e49d909e38c18f1e6b05c2bd..25a72a4f2b81701554f847c6ecf467b164fe92d2 100644 >--- a/LayoutTests/inspector/console/console-api.html >+++ b/LayoutTests/inspector/console/console-api.html >@@ -34,6 +34,7 @@ function test() > "console.groupEnd('collapsedGroupName')", > "console.count()", > "console.count()", >+ "console.count(\"default\")", > "console.count('')", > "console.count(' ')", > "console.count('')", >diff --git a/LayoutTests/inspector/console/console-count-expected.txt b/LayoutTests/inspector/console/console-count-expected.txt >index 9e9a8e252a64236d621030d1fa56f32c85bb3dd6..ad84d58763d82dd9c5851e78ee4ddd870001db1f 100644 >--- a/LayoutTests/inspector/console/console-count-expected.txt >+++ b/LayoutTests/inspector/console/console-count-expected.txt >@@ -3,22 +3,22 @@ Tests for the console.count and console.countReset APIs. > > == Running test suite: console.count > -- Running test case: console.count.NoArguments >-Global: 1 >-Global: 2 >-Global: 3 >-Global: 4 >-Global: 5 >-Global: 6 >-Global: 7 >-Global: 8 >-Global: 9 >-Global: 10 >-Global: 11 >-Global: 12 >-Global: 13 >-Global: 14 >-Global: 15 >-Global: 16 >+default: 1 >+default: 2 >+default: 3 >+default: 4 >+default: 5 >+default: 6 >+default: 7 >+default: 8 >+default: 9 >+default: 10 >+default: 11 >+default: 12 >+default: 13 >+default: 14 >+default: 15 >+default: 16 > > -- Running test case: console.count.WithLabel > alpha: 1 >diff --git a/LayoutTests/inspector/console/console-count.html b/LayoutTests/inspector/console/console-count.html >index 6999465bbdcd67d46a32814ffd7d0a64806e792a..4f057a8ca39544d021ccf19bf721cd005c47c4de 100644 >--- a/LayoutTests/inspector/console/console-count.html >+++ b/LayoutTests/inspector/console/console-count.html >@@ -40,7 +40,7 @@ function test() > > suite.addTestCase({ > name: "console.count.NoArguments", >- description: "No arguments increments a shared global counter.", >+ description: "No arguments uses the default label.", > test(resolve, reject) { > let seen = 0; > const expected = 16; >@@ -55,7 +55,7 @@ function test() > } > > InspectorTest.evaluateInPage(`triggerCountNoArguments()`); // 15 >- InspectorTest.evaluateInPage(`console.count()`); // 1 >+ InspectorTest.evaluateInPage(`console.count("default")`); // 16 > } > }); >
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 199252
:
372986
|
372987
|
373007