Skip to content

Commit

Permalink
[iOS] Gracefully handle errors from -[_SEExtensionProcess makeLibXPCC…
Browse files Browse the repository at this point in the history
…onnectionError:]

https://bugs.webkit.org/show_bug.cgi?id=267463
rdar://120915929

Reviewed by Per Arne Vollan.

When -makeLibXPCConnectionError: returns nil, log an error and invalidate the extension process
rather than crashing some time later due to a nil m_xpcConnection.

* Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
(WebKit::ProcessLauncher::launchProcess):

Canonical link: https://commits.webkit.org/272996@main
  • Loading branch information
aestes committed Jan 12, 2024
1 parent 66b2061 commit de6b463
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
Expand Down

0 comments on commit de6b463

Please sign in to comment.