mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:17:34 +00:00
Userland: Add try_* IPC handlers
This enables calling auto-generated IPC methods in a way that doesn't crash the client if the peer disconnects.
This commit is contained in:
parent
34cf5cf07f
commit
8a6db55e79
4 changed files with 62 additions and 27 deletions
|
@ -59,8 +59,8 @@ static LaunchServerConnection& connection()
|
|||
|
||||
bool Launcher::add_allowed_url(const URL& url)
|
||||
{
|
||||
auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedUrl>(url);
|
||||
if (!response) {
|
||||
auto response_or_error = connection().try_add_allowed_url(url);
|
||||
if (response_or_error.is_error()) {
|
||||
dbgln("Launcher::add_allowed_url: Failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ bool Launcher::add_allowed_url(const URL& url)
|
|||
|
||||
bool Launcher::add_allowed_handler_with_any_url(const String& handler)
|
||||
{
|
||||
auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedHandlerWithAnyUrl>(handler);
|
||||
if (!response) {
|
||||
auto response_or_error = connection().try_add_allowed_handler_with_any_url(handler);
|
||||
if (response_or_error.is_error()) {
|
||||
dbgln("Launcher::add_allowed_handler_with_any_url: Failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ bool Launcher::add_allowed_handler_with_any_url(const String& handler)
|
|||
|
||||
bool Launcher::add_allowed_handler_with_only_specific_urls(const String& handler, const Vector<URL>& urls)
|
||||
{
|
||||
auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificUrls>(handler, urls);
|
||||
if (!response) {
|
||||
auto response_or_error = connection().try_add_allowed_handler_with_only_specific_urls(handler, urls);
|
||||
if (response_or_error.is_error()) {
|
||||
dbgln("Launcher::add_allowed_handler_with_only_specific_urls: Failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ bool Launcher::add_allowed_handler_with_only_specific_urls(const String& handler
|
|||
|
||||
bool Launcher::seal_allowlist()
|
||||
{
|
||||
auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::SealAllowlist>();
|
||||
if (!response) {
|
||||
auto response_or_error = connection().try_seal_allowlist();
|
||||
if (response_or_error.is_error()) {
|
||||
dbgln("Launcher::seal_allowlist: Failed");
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue