LibWebView+WebContent: Inform WebContent process if browser is headless

This commit is contained in:
Tim Ledbetter 2024-12-09 21:51:19 +00:00 committed by Tim Flynn
parent 520bf6c9be
commit e764df15eb
Notes: github-actions[bot] 2024-12-10 18:32:56 +00:00
9 changed files with 31 additions and 0 deletions

View file

@ -107,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;
bool is_headless = false;
StringView echo_server_port_string_view {};
Core::ArgsParser args_parser;
@ -127,6 +128,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
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.add_option(is_headless, "Report that the browser is running in headless mode", "headless");
args_parser.parse(arguments);
@ -152,6 +154,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Always use the CPU backend for layout tests, as the GPU backend is not deterministic
WebContent::PageClient::set_use_skia_painter(force_cpu_painting ? WebContent::PageClient::UseSkiaPainter::CPUBackend : WebContent::PageClient::UseSkiaPainter::GPUBackendIfAvailable);
WebContent::PageClient::set_is_headless(is_headless);
if (enable_http_cache) {
Web::Fetch::Fetching::g_http_cache_enabled = true;
}