summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent/WebContentConsoleClient.cpp
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/WebContent/WebContentConsoleClient.cpp
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/WebContent/WebContentConsoleClient.cpp')
-rw-r--r--Userland/Services/WebContent/WebContentConsoleClient.cpp20
1 files changed, 1 insertions, 19 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: