summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-12-08 19:12:06 +0000
committerAndreas Kling <kling@serenityos.org>2021-12-27 21:44:07 +0100
commit834ced82d41e8fba84eeb85374ddfb393de8b721 (patch)
treecb8c6b54ac5655be65ee8c36e9d17aabdde6f08b /Userland/Services
parent260836135a17596e5b481edcf81a79824b44ca51 (diff)
downloadserenity-834ced82d41e8fba84eeb85374ddfb393de8b721.zip
LibJS+WebContent+js: Bring console.count[Reset]() to spec
The `CountReset` log level is displayed as a warning, since the message is always to warn that the counter doesn't exist. This is also in line with the table at https://console.spec.whatwg.org/#loglevel-severity
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WebContent/WebContentConsoleClient.cpp20
-rw-r--r--Userland/Services/WebContent/WebContentConsoleClient.h2
2 files changed, 1 insertions, 21 deletions
diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp
index 4966248508..179eebee55 100644
--- a/Userland/Services/WebContent/WebContentConsoleClient.cpp
+++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp
@@ -135,25 +135,6 @@ JS::Value WebContentConsoleClient::trace()
return JS::js_undefined();
}
-JS::Value WebContentConsoleClient::count()
-{
- auto label = vm().argument_count() ? vm().argument(0).to_string_without_side_effects() : "default";
- auto counter_value = m_console.counter_increment(label);
- print_html(String::formatted("{}: {}", label, counter_value));
- return JS::js_undefined();
-}
-
-JS::Value WebContentConsoleClient::count_reset()
-{
- auto label = vm().argument_count() ? vm().argument(0).to_string_without_side_effects() : "default";
- if (m_console.counter_reset(label)) {
- print_html(String::formatted("{}: 0", label));
- } else {
- print_html(String::formatted("\"{}\" doesn't have a count", label));
- }
- return JS::js_undefined();
-}
-
JS::Value WebContentConsoleClient::assert_()
{
auto& vm = this->vm();
@@ -196,6 +177,7 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
html.append("<span class=\"log\"> ");
break;
case JS::Console::LogLevel::Warn:
+ case JS::Console::LogLevel::CountReset:
html.append("<span class=\"warn\">(w) ");
break;
default:
diff --git a/Userland/Services/WebContent/WebContentConsoleClient.h b/Userland/Services/WebContent/WebContentConsoleClient.h
index 0373344a64..18f4275e72 100644
--- a/Userland/Services/WebContent/WebContentConsoleClient.h
+++ b/Userland/Services/WebContent/WebContentConsoleClient.h
@@ -26,8 +26,6 @@ public:
private:
virtual JS::Value clear() override;
virtual JS::Value trace() override;
- virtual JS::Value count() override;
- virtual JS::Value count_reset() override;
virtual JS::Value assert_() override;
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, Vector<JS::Value>&) override;