Title: [292710] trunk/Source/WebKit
- Revision
- 292710
- Author
- [email protected]
- Date
- 2022-04-11 09:18:54 -0700 (Mon, 11 Apr 2022)
Log Message
[WebAuthn] Ensure requestPin callback on main thread
https://bugs.webkit.org/show_bug.cgi?id=238962
rdar://problem/91446051
Reviewed by Brent Fulgham.
This callback gets called by a non-main thread when making calls via
ASA. This patch uses ensureOnMainThread to ensure the completion handler
is called on the main thread. It also upgrades the callback asserts to
RELEASE_ASSERTs to avoid this issue in the future.
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::getAssertion):
* UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
(WebKit::WebAuthenticationPanelClient::requestPin const):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (292709 => 292710)
--- trunk/Source/WebKit/ChangeLog 2022-04-11 16:13:37 UTC (rev 292709)
+++ trunk/Source/WebKit/ChangeLog 2022-04-11 16:18:54 UTC (rev 292710)
@@ -1,3 +1,24 @@
+2022-04-11 J Pascoe <[email protected]>
+
+ [WebAuthn] Ensure requestPin callback on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=238962
+ rdar://problem/91446051
+
+ Reviewed by Brent Fulgham.
+
+ This callback gets called by a non-main thread when making calls via
+ ASA. This patch uses ensureOnMainThread to ensure the completion handler
+ is called on the main thread. It also upgrades the callback asserts to
+ RELEASE_ASSERTs to avoid this issue in the future.
+
+ * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
+ (WebKit::LocalAuthenticator::getAssertion):
+ * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
+ (WebKit::WebAuthenticationPanelClient::requestPin const):
+ * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
+ (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
+ (WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement):
+
2022-04-10 Chris Dumez <[email protected]>
Unreviewed Windows build fix after r292696.
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm (292709 => 292710)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm 2022-04-11 16:13:37 UTC (rev 292709)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm 2022-04-11 16:18:54 UTC (rev 292710)
@@ -544,7 +544,7 @@
if (auto* observer = this->observer()) {
auto callback = [this, weakThis = WeakPtr { *this }] (AuthenticatorAssertionResponse* response) {
- ASSERT(RunLoop::isMain());
+ RELEASE_ASSERT(RunLoop::isMain());
if (!weakThis)
return;
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm (292709 => 292710)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm 2022-04-11 16:13:37 UTC (rev 292709)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm 2022-04-11 16:18:54 UTC (rev 292710)
@@ -131,10 +131,12 @@
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(panel:requestPINWithRemainingRetries:completionHandler:));
[delegate panel:m_panel requestPINWithRemainingRetries:retries completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](NSString *pin) mutable {
- if (checker->completionHandlerHasBeenCalled())
- return;
- checker->didCallCompletionHandler();
- completionHandler(pin);
+ ensureOnMainThread([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), pin = retainPtr(pin)] () mutable {
+ if (checker->completionHandlerHasBeenCalled())
+ return;
+ checker->didCallCompletionHandler();
+ completionHandler(pin.get());
+ });
}).get()];
}
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp (292709 => 292710)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp 2022-04-11 16:13:37 UTC (rev 292709)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp 2022-04-11 16:18:54 UTC (rev 292710)
@@ -210,7 +210,7 @@
if (!m_remainingAssertionResponses) {
if (auto* observer = this->observer()) {
observer->selectAssertionResponse(Vector { m_assertionResponses }, WebAuthenticationSource::External, [this, weakThis = WeakPtr { *this }] (AuthenticatorAssertionResponse* response) {
- ASSERT(RunLoop::isMain());
+ RELEASE_ASSERT(RunLoop::isMain());
if (!weakThis)
return;
auto result = m_assertionResponses.findIf([expectedResponse = response] (auto& response) {
@@ -272,7 +272,7 @@
if (auto* observer = this->observer()) {
observer->requestPin(retries, [weakThis = WeakPtr { *this }, keyAgreement = WTFMove(*keyAgreement)] (const String& pin) {
- ASSERT(RunLoop::isMain());
+ RELEASE_ASSERT(RunLoop::isMain());
if (!weakThis)
return;
weakThis->continueGetPinTokenAfterRequestPin(pin, keyAgreement.peerKey);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes