1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

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.
This commit is contained in:
Idan Horowitz 2021-04-20 10:50:28 +03:00 committed by Linus Groh
parent ac3e7ef791
commit a2b34b7e6b

View file

@ -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;