WebKit internal crash bug occurs when on Intel Mac, Xcode 14 beta 5, iOS16 running WKWebView.evaluateJavaScript

Sample project to show this error

WebKit internal crash/bug occurs when on (Intel Mac/Xcode14 beta5/Simulator/iOS16) and running WKWebView.evaluateJavaScript(..) {} . The closure passed does not get called and a WebKit crash is logged in console.

This happens only when all the cases are met:

  • Developer on Intel Mac
  • Xcode 14 beta5
  • Simulator on iOS 16

There is no issue when tested on a lower verison from the above cases, i.e. tested on iOS 15.5.

The eror logs that show a WebKit crash:

[ProcessSuspension] endowmentsForHandle: Process with PID 62886 is not running
2022-08-24 07:24:08.094225+1000 xctest[62886:2912224] [Process] 0x114064100 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch)
2022-08-24 07:24:08.094369+1000 xctest[62886:2912224] [Process] 0x114064100 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
2022-08-24 07:24:08.094656+1000 xctest[62886:2912224] [Process] 0x7fcb96020c20 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason=Crash
2022-08-24 07:24:08.095603+1000 xctest[62886:2912224] [Loading] 0x7fcb96020c20 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
2022-08-24 07:24:08.095762+1000 xctest[62886:2912224] [Loading] 0x7fcb96020c20 - [pageProxyID=6, webPageID=7, PID=0]

Sometimes this is accompanied by a crash related to PosterBoard.app similar to what is mentioned in the forum here

After double checking I can see this issue is also on M1

Still an issue on XCode 14 Release candidate. Our tests are currently blocked due to this issue.

Also found a other apple forum reports similar to our issue: https://developer.apple.com/forums/thread/712349 https://developer.apple.com/forums/thread/713581

Noticed that you're running into this while running tests. gvarandas-shop and I found that this only occurs in test suites with targets that don't have a test host. Moving our test from a test target that had no test host to one that did resulted in the test passing.

I can't explain why that is, but that's what we ended up going with.

Anyone found any solution for this?

@caiopia @gvarandas-shop, I tried adding host app to the tests in the sample project but the issue is still present in ios16 only but not ios15

Actually now im able to get it working by adding the line import WebKit to any compilation file in the host app. Thanks for the help! The solution is in the sample project

I found that with Xcode 14.0.1 if you set the target device to some simulator with iOS <= 15.x, each test will be passed.

WebKit internal crash bug occurs when on Intel Mac, Xcode 14 beta 5, iOS16 running WKWebView.evaluateJavaScript
 
 
Q