Modified: trunk/Source/WebKit/ChangeLog (285618 => 285619)
--- trunk/Source/WebKit/ChangeLog 2021-11-11 04:31:07 UTC (rev 285618)
+++ trunk/Source/WebKit/ChangeLog 2021-11-11 05:03:15 UTC (rev 285619)
@@ -1,3 +1,28 @@
+2021-11-10 Chris Dumez <[email protected]>
+
+ We should not kill all WebContent processes whenever the WebAuthn process crashes
+ https://bugs.webkit.org/show_bug.cgi?id=232970
+ <rdar://83941760>
+
+ Reviewed by Geoff Garen.
+
+ We should not kill all WebContent processes whenever the WebAuthn process crashes. This is overly aggressive. We should
+ instead do like for the network process and have the WebProcess re-initiate the connection to the WebAuthn process when
+ it's gone.
+
+ No new tests, updated existing API test.
+
+ * UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
+ (WebKit::WebAuthnProcessProxy::webAuthnProcessCrashed):
+ Do not terminate all WebProcesses when the WebAuthn process crashes.
+
+ * WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp:
+ (WebKit::WebAuthnProcessConnection::didClose):
+ Make sure we call WebProcess::webAuthnProcessConnectionClosed() when the WebProcess
+ loses its connection to the WebAuthn process. This makes sure we clear m_webAuthnProcessConnection
+ and properly re-initiate a new WebAuthn process connection the next time WebProcess::ensureWebAuthnProcessConnection()
+ is called.
+
2021-11-10 J Pascoe <[email protected]>
[WebAuthn] Unify _WKWebAuthenticationPanel SPI and AuthenticatorCoordinator's ClientDataJson generation
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp (285618 => 285619)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp 2021-11-11 04:31:07 UTC (rev 285618)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp 2021-11-11 05:03:15 UTC (rev 285619)
@@ -127,8 +127,6 @@
void WebAuthnProcessProxy::webAuthnProcessCrashed()
{
- for (auto& processPool : WebProcessPool::allProcessPools())
- processPool->terminateAllWebContentProcesses();
sharedProcess() = nullptr;
}
Modified: trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp (285618 => 285619)
--- trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp 2021-11-11 04:31:07 UTC (rev 285618)
+++ trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp 2021-11-11 05:03:15 UTC (rev 285619)
@@ -48,6 +48,7 @@
void WebAuthnProcessConnection::didClose(IPC::Connection&)
{
+ WebProcess::singleton().webAuthnProcessConnectionClosed(this);
}
void WebAuthnProcessConnection::didReceiveInvalidMessage(IPC::Connection&, IPC::MessageName)
Modified: trunk/Tools/ChangeLog (285618 => 285619)
--- trunk/Tools/ChangeLog 2021-11-11 04:31:07 UTC (rev 285618)
+++ trunk/Tools/ChangeLog 2021-11-11 05:03:15 UTC (rev 285619)
@@ -1,3 +1,16 @@
+2021-11-10 Chris Dumez <[email protected]>
+
+ We should not kill all WebContent processes whenever the WebAuthn process crashes
+ https://bugs.webkit.org/show_bug.cgi?id=232970
+ <rdar://83941760>
+
+ Reviewed by Geoff Garen.
+
+ Update API test coverage to reflect behavior change.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (TestWebKitAPI::TEST):
+
2021-11-10 J Pascoe <[email protected]>
[WebAuthn] Unify _WKWebAuthenticationPanel SPI and AuthenticatorCoordinator's ClientDataJson generation
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (285618 => 285619)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm 2021-11-11 04:31:07 UTC (rev 285618)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm 2021-11-11 05:03:15 UTC (rev 285619)
@@ -2147,6 +2147,10 @@
TEST(WebAuthenticationPanel, RecoverAfterAuthNProcessCrash)
{
+ TestWebKitAPI::HTTPServer server({
+ { "/", { "FOO"_str } }
+ });
+
auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
[[configuration preferences] _setEnabled:YES forExperimentalFeature:webAuthenticationExperimentalFeature()];
[[configuration preferences] _setEnabled:YES forExperimentalFeature:webAuthenticationModernExperimentalFeature()];
@@ -2153,6 +2157,10 @@
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect configuration:configuration]);
EXPECT_EQ([WKProcessPool _webAuthnProcessIdentifier], 0);
+
+ [webView synchronouslyLoadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:%d/", server.port()]]]];
+ [webView focus];
+
[webView objectByEvaluatingJavaScript:@"internals.setMockWebAuthenticationConfiguration({ })"];
auto firstWebPID = [webView _webProcessIdentifier];
auto firstWebAuthnPID = [WKProcessPool _webAuthnProcessIdentifier];
@@ -2160,15 +2168,32 @@
EXPECT_NE(firstWebAuthnPID, 0);
kill(firstWebAuthnPID, SIGKILL);
- while ([WKProcessPool _webAuthnProcessIdentifier] || [webView _webProcessIdentifier])
+ while ([WKProcessPool _webAuthnProcessIdentifier])
Util::spinRunLoop();
- [webView objectByEvaluatingJavaScript:@"internals.setMockWebAuthenticationConfiguration({ })"];
- auto secondWebPID = [webView _webProcessIdentifier];
+
+ [webView objectByEvaluatingJavaScript:@"internals.setMockWebAuthenticationConfiguration({ hid: { stage: 'request', subStage: 'msg', error: 'success', isU2f: true, payloadBase64: ['AQAAADswRAIge94KUqwfTIsn4AOjcM1mpMcRjdItVEeDX0W5nGhCP/cCIDxRe0eHf4V4LeEAhqeD0effTjY553H19q+jWq1Tc4WOkAA='] } });"];
+
+ while (![WKProcessPool _webAuthnProcessIdentifier])
+ Util::spinRunLoop();
+
auto secondWebAuthnPID = [WKProcessPool _webAuthnProcessIdentifier];
- EXPECT_NE(secondWebAuthnPID, 0);
EXPECT_NE(secondWebAuthnPID, firstWebAuthnPID);
- EXPECT_NE(secondWebPID, 0);
- EXPECT_NE(secondWebPID, firstWebPID);
+ EXPECT_EQ([webView _webProcessIdentifier], firstWebPID);
+
+ __block bool gotMessage = false;
+ [webView performAfterReceivingAnyMessage:^(NSString *message) {
+ EXPECT_WK_STREQ(@"public-key", message);
+ gotMessage = true;
+ }];
+
+ __block bool executedScript = false;
+ [webView evaluateJavaScript:@"navigator.credentials.get({ publicKey: { challenge: new Uint8Array([49, 50, 51, 52, 53, 54]), allowCredentials: [{ type: 'public-key', id: new Uint8Array(Array.prototype.map.call(atob('Pr2Jv3fsUJdV7pwmNe+qrHsrnFzvFzbDcX2khTTIxrZU1/+UX1C1zE54BVvdOWtk942ixfliAMzUFc0I/kIAOA'), function (c) { return c.charCodeAt(0) })) }], timeout: 100 } }).then(credential => { webkit.messageHandlers.testHandler.postMessage(credential.type); }, e => { webkit.messageHandlers.testHandler.postMessage('' + e); }) && true" completionHandler:^(id result, NSError *error) {
+ ASSERT_FALSE(error);
+ executedScript = true;
+ }];
+ Util::run(&executedScript);
+
+ Util::run(&gotMessage);
}
} // namespace TestWebKitAPI