Title: [293907] trunk/Source/WebKit
Revision
293907
Author
[email protected]
Date
2022-05-06 10:59:21 -0700 (Fri, 06 May 2022)

Log Message

[WebAuthn] Get rid of ASCAgentProxy instance after success/error/cancel
https://bugs.webkit.org/show_bug.cgi?id=240143
rdar://problem/92825715

Reviewed by Brent Fulgham.

For internal reasons, the ASCAgentProxy instance cannot be reused, so we
should clear it after a request or cancellation.

* UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (293906 => 293907)


--- trunk/Source/WebKit/ChangeLog	2022-05-06 17:56:17 UTC (rev 293906)
+++ trunk/Source/WebKit/ChangeLog	2022-05-06 17:59:21 UTC (rev 293907)
@@ -1,3 +1,16 @@
+2022-05-06  J Pascoe  <[email protected]>
+
+        [WebAuthn] Get rid of ASCAgentProxy instance after success/error/cancel
+        https://bugs.webkit.org/show_bug.cgi?id=240143
+        rdar://problem/92825715
+
+        Reviewed by Brent Fulgham.
+
+        For internal reasons, the ASCAgentProxy instance cannot be reused, so we
+        should clear it after a request or cancellation.
+
+        * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
+
 2022-05-06  Brent Fulgham  <[email protected]>
 
         Remove the viewportFitEnabled WKPreference now that it is always on 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (293906 => 293907)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-05-06 17:56:17 UTC (rev 293906)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-05-06 17:59:21 UTC (rev 293907)
@@ -447,6 +447,7 @@
                     return;
                 }
                 continueAfterRequest(credential, error, WTFMove(handler));
+                weakThis->m_proxy.clear();
             });
         }).get()];
         return;
@@ -453,8 +454,8 @@
     }
 #endif // PLATFORM(MAC) || PLATFORM(MACCATALYST)
 #if PLATFORM(IOS)
-    [m_proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([handler = WTFMove(handler)](id<ASCCredentialProtocol> credential, NSError *error) mutable {
-        callOnMainRunLoop([handler = WTFMove(handler), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
+    [m_proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler)](id<ASCCredentialProtocol> credential, NSError *error) mutable {
+        callOnMainRunLoop([weakThis, handler = WTFMove(handler), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
 #elif PLATFORM(MAC)
     RetainPtr<NSWindow> window = m_webPageProxy.platformWindow();
     [m_proxy performAuthorizationRequestsForContext:requestContext.get() withClearanceHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler), window = WTFMove(window)](NSXPCListenerEndpoint *daemonEndpoint, NSError *error) mutable {
@@ -462,15 +463,18 @@
             if (!weakThis || !daemonEndpoint) {
                 LOG_ERROR("Could not connect to authorization daemon: %@\n", error.get());
                 handler({ }, (AuthenticatorAttachment)0, ExceptionData { NotAllowedError, "Operation failed."_s });
+                if (weakThis)
+                    weakThis->m_proxy.clear();
                 return;
             }
 
             weakThis->m_presenter = adoptNS([allocASCAuthorizationRemotePresenterInstance() init]);
-            [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([handler = WTFMove(handler)](id<ASCCredentialProtocol> credentialNotRetain, NSError *errorNotRetain) mutable {
+            [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([weakThis, handler = WTFMove(handler)](id<ASCCredentialProtocol> credentialNotRetain, NSError *errorNotRetain) mutable {
                 auto credential = retainPtr(credentialNotRetain);
                 auto error = retainPtr(errorNotRetain);
 #endif
                 continueAfterRequest(credential, error, WTFMove(handler));
+                weakThis->m_proxy.clear();
 #if PLATFORM(MAC)
             }).get()];
 #endif
@@ -495,8 +499,10 @@
 
 void WebAuthenticatorCoordinatorProxy::cancel()
 {
-    if (m_proxy)
+    if (m_proxy) {
         [m_proxy cancelCurrentRequest];
+        m_proxy.clear();
+    }
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to