Bug 206248

Summary: [WebAuthn] Move the async code from WebAuthenticationPanelClient to AuthenticatorManager
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebKit Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, jiewen_tan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 181943    
Attachments:
Description Flags
Patch
none
Patch none

Description Jiewen Tan 2020-01-14 12:10:49 PST
Move the async code from WebAuthenticationPanelClient to AuthenticatorManager. The async code is supposed to protect the state of the authenticator manager from reentrance. It shouldn't sit at the API layer given the protection is needed for all different kinds of API.
Comment 1 Jiewen Tan 2020-02-07 18:00:00 PST
Created attachment 390156 [details]
Patch
Comment 2 Alex Christensen 2020-02-10 11:29:11 PST
Comment on attachment 390156 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=390156&action=review

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:281
> +    dispatchPanelClientCall([retries, completionHandler = WTFMove(completionHandler)] (const API::WebAuthenticationPanel& panel) mutable {

If m_pendingRequestData.panel.get() returns null, this CompletionHandler will not be called.  That's a problem that will cause hangs.

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:289
> +    responseVector.reserveCapacity(responses.size());

reserveInitialCapacity
Comment 3 Jiewen Tan 2020-02-10 11:38:41 PST
Comment on attachment 390156 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=390156&action=review

Thanks for reviewing my patch, Alex.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:281
>> +    dispatchPanelClientCall([retries, completionHandler = WTFMove(completionHandler)] (const API::WebAuthenticationPanel& panel) mutable {
> 
> If m_pendingRequestData.panel.get() returns null, this CompletionHandler will not be called.  That's a problem that will cause hangs.

Well, the panel should always exist once the operations starts, see: handleRequest() -> runPanel() -> startDiscovery() -> operation starts if there is available authenticators. That's a simple null check. Also, there is a timer (m_requestTimeOutTimer) for every operation, therefore there should be no hangs.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:289
>> +    responseVector.reserveCapacity(responses.size());
> 
> reserveInitialCapacity

Fixed.
Comment 4 Jiewen Tan 2020-02-10 12:01:31 PST
Created attachment 390277 [details]
Patch
Comment 5 Jiewen Tan 2020-02-10 18:38:32 PST
Comment on attachment 390277 [details]
Patch

Thanks Alex for r+ this patch. I don't think EWS failures are related. cq+ regardless.
Comment 6 WebKit Commit Bot 2020-02-10 19:34:53 PST
The commit-queue encountered the following flaky tests while processing attachment 390277 [details]:

editing/spelling/spellcheck-attribute.html bug 206178 (authors: g.czajkowski@samsung.com, mark.lam@apple.com, and rniwa@webkit.org)
The commit-queue is continuing to process your patch.
Comment 7 WebKit Commit Bot 2020-02-10 19:35:31 PST
Comment on attachment 390277 [details]
Patch

Clearing flags on attachment: 390277

Committed r256238: <https://trac.webkit.org/changeset/256238>
Comment 8 WebKit Commit Bot 2020-02-10 19:35:33 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2020-02-10 19:36:14 PST
<rdar://problem/59335837>