Browse Source

LibDesktop: Fail gracefully on allowlist failures instead of asserting

IPC::Connection::send_sync asserts that a response was received, so the
current gracefull fail check was useless, as LibIPC would always assert
before reaching it.
Idan Horowitz 4 years ago
parent
commit
a2b34b7e6b
1 changed files with 4 additions and 4 deletions
  1. 4 4
      Userland/Libraries/LibDesktop/Launcher.cpp

+ 4 - 4
Userland/Libraries/LibDesktop/Launcher.cpp

@@ -79,7 +79,7 @@ static LaunchServerConnection& connection()
 
 bool Launcher::add_allowed_url(const URL& url)
 {
-    auto response = connection().send_sync<Messages::LaunchServer::AddAllowedURL>(url);
+    auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedURL>(url);
     if (!response) {
         dbgln("Launcher::add_allowed_url: Failed");
         return false;
@@ -89,7 +89,7 @@ bool Launcher::add_allowed_url(const URL& url)
 
 bool Launcher::add_allowed_handler_with_any_url(const String& handler)
 {
-    auto response = connection().send_sync<Messages::LaunchServer::AddAllowedHandlerWithAnyURL>(handler);
+    auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedHandlerWithAnyURL>(handler);
     if (!response) {
         dbgln("Launcher::add_allowed_handler_with_any_url: Failed");
         return false;
@@ -99,7 +99,7 @@ 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<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs>(handler, urls);
+    auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs>(handler, urls);
     if (!response) {
         dbgln("Launcher::add_allowed_handler_with_only_specific_urls: Failed");
         return false;
@@ -109,7 +109,7 @@ bool Launcher::add_allowed_handler_with_only_specific_urls(const String& handler
 
 bool Launcher::seal_allowlist()
 {
-    auto response = connection().send_sync<Messages::LaunchServer::SealAllowlist>();
+    auto response = connection().send_sync_but_allow_failure<Messages::LaunchServer::SealAllowlist>();
     if (!response) {
         dbgln("Launcher::seal_allowlist: Failed");
         return false;