From 834ced82d41e8fba84eeb85374ddfb393de8b721 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 8 Dec 2021 19:12:06 +0000 Subject: 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 --- .../Services/WebContent/WebContentConsoleClient.cpp | 20 +------------------- .../Services/WebContent/WebContentConsoleClient.h | 2 -- 2 files changed, 1 insertion(+), 21 deletions(-) (limited to 'Userland/Services') 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 WebContentConsoleClient::printer(JS::Console::L html.append(" "); break; case JS::Console::LogLevel::Warn: + case JS::Console::LogLevel::CountReset: html.append("(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 printer(JS::Console::LogLevel log_level, Vector&) override; -- cgit v1.2.3