Files
ladybird/Libraries/LibWebView/Options.h
Aliaksandr Kalenik c6d740ea41 Everywhere: Remove dynamic Mach bootstrap registration on macOS
Registering multiple Mach port names with the bootstrap server at
runtime is not how macOS expects it to be used — the bootstrap server
is meant for static services, and the only reason we used it originally
was so child processes could reach back to the UI process.

Remove bootstrap_transport_over_socket(), which had both sides register
dynamic names with the bootstrap server and exchange them over a socket.
Instead, WebDriver and BrowserProcess connections now go through
MachPortServer instances directly. When a non-child process contacts a
MachPortServer, the server creates a port pair on demand (detected via
sysctl ppid check) and returns the local half immediately. This keeps
bootstrap server usage limited to the one original case: child processes
looking up their parent's MachPortServer.

WebDriver Session now runs its own MachPortServer per session.
--webdriver-content-path becomes --webdriver-mach-server-name on macOS.
Spare WebContent launches are skipped when a WebDriver session is active
to avoid bootstrap races.
2026-03-23 18:50:48 +01:00

186 lines
3.9 KiB
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteString.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibURL/URL.h>
#include <LibWebView/ProcessType.h>
namespace WebView {
enum class HeadlessMode {
Screenshot,
LayoutTree,
Text,
Manual,
Test,
};
enum class NewWindow {
No,
Yes,
};
enum class ForceNewProcess {
No,
Yes,
};
enum class AllowPopups {
No,
Yes,
};
enum class DisableScripting {
No,
Yes,
};
enum class DisableSQLDatabase {
No,
Yes,
};
enum class EnableAutoplay {
No,
Yes,
};
struct SystemDNS { };
struct DNSOverTLS {
ByteString server_address;
u16 port;
bool validate_dnssec_locally;
};
struct DNSOverUDP {
ByteString server_address;
u16 port;
bool validate_dnssec_locally;
};
using DNSSettings = Variant<SystemDNS, DNSOverTLS, DNSOverUDP>;
constexpr inline u16 default_devtools_port = 6000;
enum class EnableContentFilter {
No,
Yes,
};
struct BrowserOptions {
Vector<URL::URL> urls;
Vector<ByteString> raw_urls;
Optional<HeadlessMode> headless_mode;
int window_width { 800 };
int window_height { 600 };
NewWindow new_window { NewWindow::No };
ForceNewProcess force_new_process { ForceNewProcess::No };
AllowPopups allow_popups { AllowPopups::No };
DisableScripting disable_scripting { DisableScripting::No };
DisableSQLDatabase disable_sql_database { DisableSQLDatabase::No };
Optional<ProcessType> debug_helper_process {};
Optional<ProcessType> profile_helper_process {};
Optional<ByteString> webdriver_endpoint {};
Optional<DNSSettings> dns_settings {};
Optional<u16> devtools_port;
EnableContentFilter enable_content_filter { EnableContentFilter::Yes };
};
enum class HTTPDiskCacheMode {
Disabled,
Enabled,
Partitioned,
Testing,
};
struct RequestServerOptions {
Vector<ByteString> certificates;
HTTPDiskCacheMode http_disk_cache_mode { HTTPDiskCacheMode::Disabled };
Optional<ByteString> resource_substitution_map_path;
};
enum class IsTestMode {
No,
Yes,
};
enum class LogAllJSExceptions {
No,
Yes,
};
enum class EnableIDLTracing {
No,
Yes,
};
enum class EnableMemoryHTTPCache {
No,
Yes,
};
enum class DisableSiteIsolation {
No,
Yes,
};
enum class ExposeExperimentalInterfaces {
No,
Yes,
};
enum class ExposeInternalsObject {
No,
Yes,
};
enum class ForceCPUPainting {
No,
Yes,
};
enum class ForceFontconfig {
No,
Yes,
};
enum class CollectGarbageOnEveryAllocation {
No,
Yes,
};
enum class PaintViewportScrollbars {
Yes,
No,
};
struct WebContentOptions {
String command_line;
String executable_path;
Optional<ByteString> config_path {};
Optional<StringView> user_agent_preset {};
IsTestMode is_test_mode { IsTestMode::No };
LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No };
DisableSiteIsolation disable_site_isolation { DisableSiteIsolation::No };
EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No };
EnableMemoryHTTPCache enable_http_memory_cache { EnableMemoryHTTPCache::No };
ExposeExperimentalInterfaces expose_experimental_interfaces { ExposeExperimentalInterfaces::No };
ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No };
ForceCPUPainting force_cpu_painting { ForceCPUPainting::No };
ForceFontconfig force_fontconfig { ForceFontconfig::No };
EnableAutoplay enable_autoplay { EnableAutoplay::No };
CollectGarbageOnEveryAllocation collect_garbage_on_every_allocation { CollectGarbageOnEveryAllocation::No };
Optional<u16> echo_server_port {};
PaintViewportScrollbars paint_viewport_scrollbars { PaintViewportScrollbars::Yes };
Optional<StringView> default_time_zone {};
};
}