Title: [286396] branches/safari-612-branch
Revision
286396
Author
[email protected]
Date
2021-12-01 16:18:04 -0800 (Wed, 01 Dec 2021)

Log Message

Cherry-pick r285619. rdar://problem/83941760

    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.

    Source/WebKit:

    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.

    Tools:

    Update API test coverage to reflect behavior change.

    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
    (TestWebKitAPI::TEST):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285619 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (286395 => 286396)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-12-02 00:18:00 UTC (rev 286395)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-12-02 00:18:04 UTC (rev 286396)
@@ -1,5 +1,69 @@
 2021-12-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r285619. rdar://problem/83941760
+
+    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.
+    
+    Source/WebKit:
+    
+    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.
+    
+    Tools:
+    
+    Update API test coverage to reflect behavior change.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-12-01  Alan Coon  <[email protected]>
+
         Cherry-pick r285138. rdar://problem/75139294
 
     Avoid heap-allocating ImportanceAssertion

Modified: branches/safari-612-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp (286395 => 286396)


--- branches/safari-612-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp	2021-12-02 00:18:00 UTC (rev 286395)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp	2021-12-02 00:18:04 UTC (rev 286396)
@@ -122,8 +122,6 @@
 
 void WebAuthnProcessProxy::webAuthnProcessCrashed()
 {
-    for (auto& processPool : WebProcessPool::allProcessPools())
-        processPool->terminateAllWebContentProcesses();
     sharedProcess() = nullptr;
 }
 

Modified: branches/safari-612-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp (286395 => 286396)


--- branches/safari-612-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp	2021-12-02 00:18:00 UTC (rev 286395)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp	2021-12-02 00:18:04 UTC (rev 286396)
@@ -48,6 +48,7 @@
 
 void WebAuthnProcessConnection::didClose(IPC::Connection&)
 {
+    WebProcess::singleton().webAuthnProcessConnectionClosed(this);
 }
 
 void WebAuthnProcessConnection::didReceiveInvalidMessage(IPC::Connection&, IPC::MessageName)

Modified: branches/safari-612-branch/Tools/ChangeLog (286395 => 286396)


--- branches/safari-612-branch/Tools/ChangeLog	2021-12-02 00:18:00 UTC (rev 286395)
+++ branches/safari-612-branch/Tools/ChangeLog	2021-12-02 00:18:04 UTC (rev 286396)
@@ -1,3 +1,55 @@
+2021-12-01  Alan Coon  <[email protected]>
+
+        Cherry-pick r285619. rdar://problem/83941760
+
+    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.
+    
+    Source/WebKit:
+    
+    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.
+    
+    Tools:
+    
+    Update API test coverage to reflect behavior change.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-08  Kocsen Chung  <[email protected]>
 
         Cherry-pick r285208. rdar://problem/84824703

Modified: branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (286395 => 286396)


--- branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-12-02 00:18:00 UTC (rev 286395)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-12-02 00:18:04 UTC (rev 286396)
@@ -2119,6 +2119,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()];
@@ -2125,6 +2129,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];
@@ -2132,15 +2140,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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to