/* * Copyright (c) 2022, Brandon Scott * Copyright (c) 2020, Hunter Salyer * Copyright (c) 2021, Sam Atkins * Copyright (c) 2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #define AK_DONT_REPLACE_STD #include "ConsoleGlobalObject.h" #include #include #include #include class SimpleWebView; namespace Ladybird { class ConsoleClient final : public JS::ConsoleClient { public: ConsoleClient(JS::Console&, JS::Realm&, SimpleWebView&); void handle_input(String const& js_source); void send_messages(i32 start_index); private: virtual void clear() override; virtual JS::ThrowCompletionOr printer(JS::Console::LogLevel log_level, PrinterArguments) override; SimpleWebView& m_view; WeakPtr m_interpreter; JS::Handle m_console_global_object; void clear_output(); void print_html(String const& line); void begin_group(String const& label, bool start_expanded); virtual void end_group() override; struct ConsoleOutput { enum class Type { HTML, Clear, BeginGroup, BeginGroupCollapsed, EndGroup, }; Type type; String data; }; Vector m_message_log; WeakPtr m_realm; }; }