mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
WebContent: Store messages in WebContentConsoleClient
The `WebContentConsoleClient` now keeps a list of console messages it has received, so these are not lost if the ConsoleWidget has not been initialized yet. This change does break JS console output, but only until the next commit. :^)
This commit is contained in:
parent
c619a57cf8
commit
f6a927fa20
3 changed files with 58 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Brandon Scott <xeon.productions@gmail.com>
|
||||
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -19,7 +20,8 @@ class WebContentConsoleClient final : public JS::ConsoleClient {
|
|||
public:
|
||||
WebContentConsoleClient(JS::Console&, WeakPtr<JS::Interpreter>, ClientConnection&);
|
||||
|
||||
void handle_input(const String& js_source);
|
||||
void handle_input(String const& js_source);
|
||||
void send_messages(i32 start_index);
|
||||
|
||||
private:
|
||||
virtual JS::Value log() override;
|
||||
|
@ -38,7 +40,17 @@ private:
|
|||
JS::Handle<ConsoleGlobalObject> m_console_global_object;
|
||||
|
||||
void clear_output();
|
||||
void print_html(const String& line);
|
||||
void print_html(String const& line);
|
||||
|
||||
struct ConsoleOutput {
|
||||
enum class Type {
|
||||
HTML,
|
||||
Clear
|
||||
};
|
||||
Type type;
|
||||
String html;
|
||||
};
|
||||
Vector<ConsoleOutput> m_message_log;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue