summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDesktop
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-03 16:51:42 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-03 21:14:40 +0200
commit8a6db55e79ee484bc071fcb52ca30da069231f77 (patch)
treeed8826549c5247ad4c103f93079168ada7403a9d /Userland/Libraries/LibDesktop
parent34cf5cf07f9dd8ef60d28f1a5410a689fff2ef9c (diff)
downloadserenity-8a6db55e79ee484bc071fcb52ca30da069231f77.zip
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.
Diffstat (limited to 'Userland/Libraries/LibDesktop')
-rw-r--r--Userland/Libraries/LibDesktop/Launcher.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp
index 99e8b90215..d7dcf5743d 100644
--- a/Userland/Libraries/LibDesktop/Launcher.cpp
+++ b/Userland/Libraries/LibDesktop/Launcher.cpp
@@ -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;
}