LibWebView+WebContent: Add and set cmdline option for echo server port
This commit is contained in:
parent
ece611718d
commit
d2521c8e72
Notes:
github-actions[bot]
2024-12-06 00:09:21 +00:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/d2521c8e720 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2553 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/shannonbooth
2 changed files with 15 additions and 0 deletions
|
@ -109,6 +109,11 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
|||
if (web_content_options.collect_garbage_on_every_allocation == WebView::CollectGarbageOnEveryAllocation::Yes)
|
||||
arguments.append("--collect-garbage-on-every-allocation"sv);
|
||||
|
||||
if (auto const maybe_echo_server_port = web_content_options.echo_server_port; maybe_echo_server_port.has_value()) {
|
||||
arguments.append("--echo-server-port"sv);
|
||||
arguments.append(ByteString::number(maybe_echo_server_port.value()));
|
||||
}
|
||||
|
||||
if (auto server = mach_server_name(); server.has_value()) {
|
||||
arguments.append("--mach-server-name"sv);
|
||||
arguments.append(server.value());
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <LibRequests/RequestClient.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Internals/Internals.h>
|
||||
#include <LibWeb/Loader/ContentFilter.h>
|
||||
#include <LibWeb/Loader/GeneratedPagesLoader.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
@ -106,6 +107,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool force_cpu_painting = false;
|
||||
bool force_fontconfig = false;
|
||||
bool collect_garbage_on_every_allocation = false;
|
||||
StringView echo_server_port_string_view {};
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(command_line, "Chrome process command line", "command-line", 0, "command_line");
|
||||
|
@ -124,6 +126,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(force_cpu_painting, "Force CPU painting", "force-cpu-painting");
|
||||
args_parser.add_option(force_fontconfig, "Force using fontconfig for font loading", "force-fontconfig");
|
||||
args_parser.add_option(collect_garbage_on_every_allocation, "Collect garbage after every JS heap allocation", "collect-garbage-on-every-allocation");
|
||||
args_parser.add_option(echo_server_port_string_view, "Echo server port used in test internals", "echo-server-port", 0, "echo_server_port");
|
||||
|
||||
args_parser.parse(arguments);
|
||||
|
||||
|
@ -153,6 +156,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Web::Fetch::Fetching::g_http_cache_enabled = true;
|
||||
}
|
||||
|
||||
if (!echo_server_port_string_view.is_empty()) {
|
||||
if (auto maybe_echo_server_port = echo_server_port_string_view.to_number<u16>(); maybe_echo_server_port.has_value())
|
||||
Web::Internals::Internals::set_echo_server_port(maybe_echo_server_port.value());
|
||||
else
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
if (!mach_server_name.is_empty()) {
|
||||
[[maybe_unused]] auto server_port = Core::Platform::register_with_mach_server(mach_server_name);
|
||||
|
|
Loading…
Add table
Reference in a new issue