Modified: branches/safari-7613.3.1.1-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (294054 => 294055)
--- branches/safari-7613.3.1.1-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-05-11 15:54:36 UTC (rev 294054)
+++ branches/safari-7613.3.1.1-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-05-11 17:09:55 UTC (rev 294055)
@@ -372,8 +372,8 @@
{
m_proxy = adoptNS([allocASCAgentProxyInstance() init]);
#if PLATFORM(IOS)
- [m_proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([handler = WTFMove(handler)](id<ASCCredentialProtocol> credential, NSError *error) mutable {
- callOnMainRunLoop([handler = WTFMove(handler), proxy = WTFMove(proxy), 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), proxy = WTFMove(proxy), 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 {
@@ -381,15 +381,18 @@
if (!weakThis || !daemonEndpoint) {
LOG_ERROR("Could not connect to authorization daemon: %@\n", error.get());
handler({ }, (AuthenticatorAttachment)0, ExceptionData { NotAllowedError, "Operation failed." });
+ 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
@@ -409,8 +412,10 @@
void WebAuthenticatorCoordinatorProxy::cancel()
{
- if (m_proxy)
+ if (m_proxy) {
[m_proxy cancelCurrentRequest];
+ m_proxy.clear();
+ }
}
} // namespace WebKit