Ladybird: Move arguments parsing before FontPluginQt init

In a future commit will pass arguments parsed to the FontPluginQt
constructor.
This commit is contained in:
martinfalisse 2023-05-05 19:48:48 +02:00 committed by Andreas Kling
parent 65c7145e69
commit 00e446facd
Notes: sideshowbarker 2024-07-16 21:51:02 +09:00

View file

@ -62,6 +62,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::FrameLoader::set_default_favicon_path(DeprecatedString::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root));
int webcontent_fd_passing_socket { -1 };
Core::ArgsParser args_parser;
args_parser.add_option(webcontent_fd_passing_socket, "File descriptor of the passing socket for the WebContent connection", "webcontent-fd-passing-socket", 'c', "webcontent_fd_passing_socket");
args_parser.parse(arguments);
VERIFY(webcontent_fd_passing_socket >= 0);
Web::Platform::FontPlugin::install(*new Ladybird::FontPluginQt);
Web::FrameLoader::set_error_page_url(DeprecatedString::formatted("file://{}/res/html/error.html", s_serenity_resource_root));
@ -76,14 +84,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (maybe_autoplay_allowlist_error.is_error())
dbgln("Failed to load autoplay allowlist: {}", maybe_autoplay_allowlist_error.error());
int webcontent_fd_passing_socket { -1 };
Core::ArgsParser args_parser;
args_parser.add_option(webcontent_fd_passing_socket, "File descriptor of the passing socket for the WebContent connection", "webcontent-fd-passing-socket", 'c', "webcontent_fd_passing_socket");
args_parser.parse(arguments);
VERIFY(webcontent_fd_passing_socket >= 0);
auto webcontent_socket = TRY(Core::take_over_socket_from_system_server("WebContent"sv));
auto webcontent_client = TRY(WebContent::ConnectionFromClient::try_create(move(webcontent_socket)));
webcontent_client->set_fd_passing_socket(TRY(Core::LocalSocket::adopt_fd(webcontent_fd_passing_socket)));