Skip to content

Commit 3f542b8

Browse files
committed
Address Safer CPP failures in WebAuthenticationPanelClient.h
https://bugs.webkit.org/show_bug.cgi?id=290271 Reviewed by Geoffrey Garen. * Source/WebKit/SaferCPPExpectations/NoUnretainedMemberCheckerExpectations: * Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: * Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::updatePanel const): (WebKit::WebAuthenticationPanelClient::dismissPanel const): (WebKit::WebAuthenticationPanelClient::requestPin const): (WebKit::WebAuthenticationPanelClient::requestNewPin const): (WebKit::WebAuthenticationPanelClient::selectAssertionResponse const): (WebKit::WebAuthenticationPanelClient::decidePolicyForLocalAuthenticator const): (WebKit::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Canonical link: https://commits.webkit.org/292561@main
1 parent dbbcfa7 commit 3f542b8

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

Source/WebKit/SaferCPPExpectations/NoUnretainedMemberCheckerExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
22
UIProcess/DisplayLink.h
3-
UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h
43
UIProcess/mac/PageClientImplMac.h
54
UIProcess/mac/WebPopupMenuProxyMac.h
65
UIProcess/mac/WebViewImpl.h

Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class WebAuthenticationPanelClient final : public API::WebAuthenticationPanelCli
5757
void decidePolicyForLocalAuthenticator(CompletionHandler<void(LocalAuthenticatorPolicy)>&&) const final;
5858
void requestLAContextForUserVerification(CompletionHandler<void(LAContext *)>&&) const final;
5959

60-
_WKWebAuthenticationPanel *m_panel;
60+
WeakObjCPtr<_WKWebAuthenticationPanel> m_panel;
6161
WeakObjCPtr<id<_WKWebAuthenticationPanelDelegate>> m_delegate;
6262

6363
struct {

Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static _WKWebAuthenticationPanelUpdate wkWebAuthenticationPanelUpdate(WebAuthent
101101
if (!delegate)
102102
return;
103103

104-
[delegate panel:m_panel updateWebAuthenticationPanel:wkWebAuthenticationPanelUpdate(status)];
104+
[delegate panel:m_panel.get().get() updateWebAuthenticationPanel:wkWebAuthenticationPanelUpdate(status)];
105105
}
106106

107107
static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationResult result)
@@ -125,7 +125,7 @@ static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationRes
125125
if (!delegate)
126126
return;
127127

128-
[delegate panel:m_panel dismissWebAuthenticationPanelWithResult:wkWebAuthenticationResult(result)];
128+
[delegate panel:m_panel.get().get() dismissWebAuthenticationPanelWithResult:wkWebAuthenticationResult(result)];
129129
}
130130

131131
void WebAuthenticationPanelClient::requestPin(uint64_t retries, CompletionHandler<void(const WTF::String&)>&& completionHandler) const
@@ -142,7 +142,7 @@ static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationRes
142142
}
143143

144144
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:requestPINWithRemainingRetries:completionHandler:));
145-
[delegate panel:m_panel requestPINWithRemainingRetries:retries completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](NSString *pin) mutable {
145+
[delegate panel:m_panel.get().get() requestPINWithRemainingRetries:retries completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](NSString *pin) mutable {
146146
ensureOnMainThread([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), pin = retainPtr(pin)] () mutable {
147147
if (checker->completionHandlerHasBeenCalled())
148148
return;
@@ -166,7 +166,7 @@ static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationRes
166166
}
167167

168168
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:requestNewPINWithMinLength:completionHandler:));
169-
[delegate panel:m_panel requestNewPINWithMinLength:minLength completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](NSString *pin) mutable {
169+
[delegate panel:m_panel.get().get() requestNewPINWithMinLength:minLength completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](NSString *pin) mutable {
170170
ensureOnMainThread([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), pin = retainPtr(pin)] () mutable {
171171
if (checker->completionHandlerHasBeenCalled())
172172
return;
@@ -207,7 +207,7 @@ static _WKWebAuthenticationSource wkWebAuthenticationSource(WebAuthenticationSou
207207
return API::WebAuthenticationAssertionResponse::create(response.copyRef());
208208
});
209209
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:selectAssertionResponse:source:completionHandler:));
210-
[delegate panel:m_panel selectAssertionResponse:wrapper(API::Array::create(WTFMove(apiResponses))).get() source:wkWebAuthenticationSource(source) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebAuthenticationAssertionResponse *response) mutable {
210+
[delegate panel:m_panel.get().get() selectAssertionResponse:wrapper(API::Array::create(WTFMove(apiResponses))).get() source:wkWebAuthenticationSource(source) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebAuthenticationAssertionResponse *response) mutable {
211211
if (checker->completionHandlerHasBeenCalled())
212212
return;
213213
checker->didCallCompletionHandler();
@@ -246,7 +246,7 @@ static LocalAuthenticatorPolicy localAuthenticatorPolicy(_WKLocalAuthenticatorPo
246246
}
247247

248248
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:decidePolicyForLocalAuthenticatorWithCompletionHandler:));
249-
[delegate panel:m_panel decidePolicyForLocalAuthenticatorWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKLocalAuthenticatorPolicy policy) mutable {
249+
[delegate panel:m_panel.get().get() decidePolicyForLocalAuthenticatorWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKLocalAuthenticatorPolicy policy) mutable {
250250
if (checker->completionHandlerHasBeenCalled())
251251
return;
252252
checker->didCallCompletionHandler();
@@ -268,7 +268,7 @@ static LocalAuthenticatorPolicy localAuthenticatorPolicy(_WKLocalAuthenticatorPo
268268
}
269269

270270
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:requestLAContextForUserVerificationWithCompletionHandler:));
271-
[delegate panel:m_panel requestLAContextForUserVerificationWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](LAContext *context) mutable {
271+
[delegate panel:m_panel.get().get() requestLAContextForUserVerificationWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](LAContext *context) mutable {
272272
if (checker->completionHandlerHasBeenCalled())
273273
return;
274274
checker->didCallCompletionHandler();

0 commit comments

Comments
 (0)