1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:27:43 +00:00

LibWebView: Implement a JavaScript console tab in the Inspector

This adds a JS console to the bottom section of the Inspector WebView.
Much of this code is based on the existing WebView::ConsoleClient, but
ported to fit the inspector model. That is, much of the code from that
class is now handled in the Inspector's JS.
This commit is contained in:
Timothy Flynn 2023-12-01 06:51:01 -05:00 committed by Andreas Kling
parent 9f374a5d2a
commit d8a700d9be
4 changed files with 341 additions and 3 deletions

View file

@ -26,11 +26,22 @@ public:
private:
void load_inspector();
String generate_dom_tree(JsonObject const&);
String generate_accessibility_tree(JsonObject const&);
void select_node(i32 node_id);
void request_console_messages();
void handle_console_message(i32 message_index);
void handle_console_messages(i32 start_index, ReadonlySpan<DeprecatedString> message_types, ReadonlySpan<DeprecatedString> messages);
void append_console_source(StringView);
void append_console_output(StringView);
void clear_console_output();
void begin_console_group(StringView label, bool start_expanded);
void end_console_group();
ViewImplementation& m_content_web_view;
ViewImplementation& m_inspector_web_view;
@ -38,6 +49,10 @@ private:
Optional<i32> m_pending_selection;
bool m_dom_tree_loaded { false };
i32 m_highest_notified_message_index { -1 };
i32 m_highest_received_message_index { -1 };
bool m_waiting_for_messages { false };
};
}