Bug 206248 - [WebAuthn] Move the async code from WebAuthenticationPanelClient to AuthenticatorManager
Summary: [WebAuthn] Move the async code from WebAuthenticationPanelClient to Authentic...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks: 181943
  Show dependency treegraph
 
Reported: 2020-01-14 12:10 PST by Jiewen Tan
Modified: 2020-02-10 19:36 PST (History)
4 users (show)

See Also:


Attachments
Patch (19.53 KB, patch)
2020-02-07 18:00 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (19.53 KB, patch)
2020-02-10 12:01 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>