diff --git a/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm b/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm index f8e365c80e6aa..8b046dd42bde8 100644 --- a/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm +++ b/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm @@ -176,7 +176,17 @@ static void launchWithExtensionKit(ProcessLauncher& processLauncher, ProcessLaun [process invalidate]; return; } - launcher->m_xpcConnection = [process makeLibXPCConnectionError:nil]; + + NSError *error = nil; + OSObjectPtr xpcConnection = [process makeLibXPCConnectionError:&error]; + if (!xpcConnection) { + RELEASE_LOG_ERROR(Process, "Failed to make libxpc connection for process %{public}@ with error: %{public}@", process.get(), error); + [process invalidate]; + launcher->didFinishLaunchingProcess(0, { }); + return; + } + + launcher->m_xpcConnection = WTFMove(xpcConnection); launcher->m_process = WTFMove(process); launcher->finishLaunchingProcess(name.characters()); });