Diff
Modified: trunk/LayoutTests/ChangeLog (246875 => 246876)
--- trunk/LayoutTests/ChangeLog 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/LayoutTests/ChangeLog 2019-06-27 08:25:04 UTC (rev 246876)
@@ -1,3 +1,14 @@
+2019-06-27 Devin Rousso <[email protected]>
+
+ 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 Joseph Pecoraro.
+
+ * inspector/console/console-count.html:
+ * inspector/console/console-count-expected.txt:
+ * inspector/console/console-api-expected.txt:
+
2019-06-27 Saam Barati <[email protected]>
[WHLSL] Implement arrays and MakeArrayReference
Modified: trunk/LayoutTests/inspector/console/console-api-expected.txt (246875 => 246876)
--- trunk/LayoutTests/inspector/console/console-api-expected.txt 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/LayoutTests/inspector/console/console-api-expected.txt 2019-06-27 08:25:04 UTC (rev 246876)
@@ -585,7 +585,7 @@
{
"_source": "console-api",
"_level": "debug",
- "_messageText": "Global: 1",
+ "_messageText": "default: 1",
"_type": "log",
"_url": null,
"_line": 3,
@@ -599,7 +599,7 @@
{
"_source": "console-api",
"_level": "debug",
- "_messageText": "Global: 2",
+ "_messageText": "default: 2",
"_type": "log",
"_url": null,
"_line": 3,
@@ -609,6 +609,20 @@
"_request": null
}
+STEP: console.count("default")
+{
+ "_source": "console-api",
+ "_level": "debug",
+ "_messageText": "default: 3",
+ "_type": "log",
+ "_url": null,
+ "_line": 3,
+ "_column": 14,
+ "_repeatCount": 1,
+ "_stackTrace": "<filtered>",
+ "_request": null
+}
+
STEP: console.count('')
{
"_source": "console-api",
Modified: trunk/LayoutTests/inspector/console/console-api.html (246875 => 246876)
--- trunk/LayoutTests/inspector/console/console-api.html 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/LayoutTests/inspector/console/console-api.html 2019-06-27 08:25:04 UTC (rev 246876)
@@ -34,6 +34,7 @@
"console.groupEnd('collapsedGroupName')",
"console.count()",
"console.count()",
+ "console.count(\"default\")",
"console.count('')",
"console.count(' ')",
"console.count('')",
Modified: trunk/LayoutTests/inspector/console/console-count-expected.txt (246875 => 246876)
--- trunk/LayoutTests/inspector/console/console-count-expected.txt 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/LayoutTests/inspector/console/console-count-expected.txt 2019-06-27 08:25:04 UTC (rev 246876)
@@ -3,22 +3,22 @@
== 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
Modified: trunk/LayoutTests/inspector/console/console-count.html (246875 => 246876)
--- trunk/LayoutTests/inspector/console/console-count.html 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/LayoutTests/inspector/console/console-count.html 2019-06-27 08:25:04 UTC (rev 246876)
@@ -40,7 +40,7 @@
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 @@
}
InspectorTest.evaluateInPage(`triggerCountNoArguments()`); // 15
- InspectorTest.evaluateInPage(`console.count()`); // 1
+ InspectorTest.evaluateInPage(`console.count("default")`); // 16
}
});
Modified: trunk/Source/_javascript_Core/ChangeLog (246875 => 246876)
--- trunk/Source/_javascript_Core/ChangeLog 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-06-27 08:25:04 UTC (rev 246876)
@@ -1,3 +1,53 @@
+2019-06-27 Devin Rousso <[email protected]>
+
+ 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 Joseph Pecoraro.
+
+ 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-27 Fujii Hironori <[email protected]>
[CMake] Bump cmake_minimum_required version to 3.10
Modified: trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -82,6 +82,24 @@
}
}
+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)
Modified: trunk/Source/_javascript_Core/inspector/ConsoleMessage.h (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/ConsoleMessage.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/ConsoleMessage.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -55,6 +55,7 @@
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();
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -70,14 +70,14 @@
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 @@
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>&&)
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -49,14 +49,14 @@
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>&&) 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;
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -126,67 +126,71 @@
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 @@
m_frontendDispatcher->heapSnapshot(timestamp, snapshotData, title.isEmpty() ? nullptr : &title);
}
-void InspectorConsoleAgent::getCounterLabel(Ref<ScriptArguments>&& arguments, String& title, String& identifier)
+void InspectorConsoleAgent::count(JSC::ExecState* exec, const String& label)
{
- 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)
-{
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;
}
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h (246875 => 246876)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -70,18 +70,17 @@
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;
Modified: trunk/Source/_javascript_Core/runtime/ConsoleClient.h (246875 => 246876)
--- trunk/Source/_javascript_Core/runtime/ConsoleClient.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/runtime/ConsoleClient.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -55,14 +55,14 @@
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;
Modified: trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp (246875 => 246876)
--- trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -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 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 @@
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());
}
Modified: trunk/Source/WebCore/ChangeLog (246875 => 246876)
--- trunk/Source/WebCore/ChangeLog 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/ChangeLog 2019-06-27 08:25:04 UTC (rev 246876)
@@ -1,3 +1,62 @@
+2019-06-27 Devin Rousso <[email protected]>
+
+ 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 Joseph Pecoraro.
+
+ 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-27 Saam Barati <[email protected]>
[WHLSL] Implement arrays and MakeArrayReference
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (246875 => 246876)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -851,16 +851,16 @@
}
}
-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 @@
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)
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (246875 => 246876)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -221,18 +221,18 @@
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 @@
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 @@
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 @@
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)
Modified: trunk/Source/WebCore/page/PageConsoleClient.cpp (246875 => 246876)
--- trunk/Source/WebCore/page/PageConsoleClient.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/page/PageConsoleClient.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -170,14 +170,14 @@
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 @@
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)
Modified: trunk/Source/WebCore/page/PageConsoleClient.h (246875 => 246876)
--- trunk/Source/WebCore/page/PageConsoleClient.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/page/PageConsoleClient.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -67,14 +67,14 @@
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;
Modified: trunk/Source/WebCore/workers/WorkerConsoleClient.cpp (246875 => 246876)
--- trunk/Source/WebCore/workers/WorkerConsoleClient.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/workers/WorkerConsoleClient.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -50,29 +50,29 @@
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
Modified: trunk/Source/WebCore/workers/WorkerConsoleClient.h (246875 => 246876)
--- trunk/Source/WebCore/workers/WorkerConsoleClient.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/workers/WorkerConsoleClient.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -43,14 +43,14 @@
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;
Modified: trunk/Source/WebCore/worklets/WorkletConsoleClient.cpp (246875 => 246876)
--- trunk/Source/WebCore/worklets/WorkletConsoleClient.cpp 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/worklets/WorkletConsoleClient.cpp 2019-06-27 08:25:04 UTC (rev 246876)
@@ -52,8 +52,8 @@
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>&&) { }
Modified: trunk/Source/WebCore/worklets/WorkletConsoleClient.h (246875 => 246876)
--- trunk/Source/WebCore/worklets/WorkletConsoleClient.h 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebCore/worklets/WorkletConsoleClient.h 2019-06-27 08:25:04 UTC (rev 246876)
@@ -45,14 +45,14 @@
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;
Modified: trunk/Source/WebInspectorUI/ChangeLog (246875 => 246876)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-06-27 08:25:04 UTC (rev 246876)
@@ -1,3 +1,17 @@
+2019-06-27 Devin Rousso <[email protected]>
+
+ 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 Joseph Pecoraro.
+
+ 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 Joseph Pecoraro <[email protected]>
Web Inspector: Update legacy backend commands after enum name change
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (246875 => 246876)
--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-06-27 08:19:54 UTC (rev 246875)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-06-27 08:25:04 UTC (rev 246876)
@@ -161,7 +161,8 @@
Console: {
assert: "condition, [message], [...values]",
- count: "[label]",
+ count: "label = \"default\"",
+ countReset: "label = \"default\"",
debug: "message, [...values]",
dir: "object",
dirxml: "object",
@@ -178,8 +179,9 @@
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]",