LibWebView+WebContent: Create a different console client for DevTools

Our existing WebContentConsoleClient is very specific to our home-grown
Inspector. It renders console output to an HTML string. For DevTools, we
will not want this behavior; we will want to send representations of raw
JS values.

This patch makes WebContentConsoleClient a base class to handle console
input from the user, either from the Inspector or from DevTools. It then
moves the HTML rendering needed for the Inspector to a new class,
InspectorConsoleClient. And we add a DevToolsConsoleClient (currently
just stubbed) to handle needs specific to DevTools.

We choose at runtime which console client to install, based on the
--devtools command line flag.
This commit is contained in:
Timothy Flynn 2025-02-24 09:48:13 -05:00 committed by Andreas Kling
parent a8d3252f93
commit 37f07c176a
Notes: github-actions[bot] 2025-02-28 12:09:47 +00:00
12 changed files with 419 additions and 229 deletions

View file

@ -84,6 +84,7 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
IPC::File image_decoder_socket,
Optional<IPC::File> request_server_socket)
{
auto const& chrome_options = WebView::Application::chrome_options();
auto const& web_content_options = WebView::Application::web_content_options();
Vector<ByteString> arguments {
@ -93,6 +94,8 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
web_content_options.executable_path.to_byte_string(),
};
if (chrome_options.devtools_port.has_value())
arguments.append("--devtools"sv);
if (web_content_options.config_path.has_value()) {
arguments.append("--config-path"sv);
arguments.append(web_content_options.config_path.value());