mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Ladybird: Register RequestServer with the chrome's mach server on macOS
This ensures we register RequestServer with the appropriate mach server name.
This commit is contained in:
parent
b83babdf8b
commit
d2bd692bbe
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/d2bd692bbe Pull-request: https://github.com/SerenityOS/serenity/pull/24074 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 17 additions and 0 deletions
|
@ -176,12 +176,18 @@ ErrorOr<NonnullRefPtr<Protocol::RequestClient>> launch_request_server_process(Re
|
|||
arguments.append("--serenity-resource-root"sv);
|
||||
arguments.append(serenity_resource_root);
|
||||
}
|
||||
|
||||
Vector<ByteString> certificate_args;
|
||||
for (auto const& certificate : certificates) {
|
||||
certificate_args.append(ByteString::formatted("--certificate={}", certificate));
|
||||
arguments.append(certificate_args.last().view());
|
||||
}
|
||||
|
||||
if (auto server = mach_server_name(); server.has_value()) {
|
||||
arguments.append("--mach-server-name"sv);
|
||||
arguments.append(server.value());
|
||||
}
|
||||
|
||||
return launch_generic_server_process<Protocol::RequestClient>(candidate_request_server_paths, "RequestServer"sv, move(arguments));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include <RequestServer/HttpProtocol.h>
|
||||
#include <RequestServer/HttpsProtocol.h>
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
# include <LibCore/Platform/ProcessStatisticsMach.h>
|
||||
#endif
|
||||
|
||||
ErrorOr<ByteString> find_certificates(StringView serenity_resource_root)
|
||||
{
|
||||
auto cert_path = ByteString::formatted("{}/ladybird/cacert.pem", serenity_resource_root);
|
||||
|
@ -34,10 +38,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
StringView serenity_resource_root;
|
||||
Vector<ByteString> certificates;
|
||||
StringView mach_server_name;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate");
|
||||
args_parser.add_option(serenity_resource_root, "Absolute path to directory for serenity resources", "serenity-resource-root", 'r', "serenity-resource-root");
|
||||
args_parser.add_option(mach_server_name, "Mach server name", "mach-server-name", 0, "mach_server_name");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
// Ensure the certificates are read out here.
|
||||
|
@ -48,6 +54,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
if (!mach_server_name.is_empty())
|
||||
Core::Platform::register_with_mach_server(mach_server_name);
|
||||
#endif
|
||||
|
||||
RequestServer::GeminiProtocol::install();
|
||||
RequestServer::HttpProtocol::install();
|
||||
RequestServer::HttpsProtocol::install();
|
||||
|
|
Loading…
Reference in a new issue