Bug 189642 - [WebAuthN] Move time out control from WebProcess to UIProcess
Summary: [WebAuthN] Move time out control from WebProcess to UIProcess
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore 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: 2018-09-14 18:33 PDT by Jiewen Tan
Modified: 2018-10-04 12:32 PDT (History)
7 users (show)

See Also:


Attachments
Patch (47.71 KB, patch)
2018-10-01 13:51 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (48.59 KB, patch)
2018-10-03 18:28 PDT, 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 2018-09-14 18:33:43 PDT
Move time out control from WebProcess to UIProcess. Otherwise, we will have a duplicate time out controller in AuthenticatorManager.
Comment 1 Radar WebKit Bug Importer 2018-09-14 18:35:33 PDT
<rdar://problem/44476765>
Comment 2 Jiewen Tan 2018-09-21 21:58:59 PDT
When we finished this task, we could add tests that:
1) In makeCredential, we could have a test that have exclude credentials that have the same credential id as existing one but not transport.
2) No authenticators can be discovered.
Comment 3 Jiewen Tan 2018-09-22 22:36:33 PDT
3) Also, we could then add a test configuration to the discovery process to hide local authenticators.
Comment 4 Jiewen Tan 2018-09-27 15:35:04 PDT
4) Re-enable time out tests in:
public-key-credential-create-failure.https.html,
public-key-credential-get-failure.https.html.
Comment 5 Jiewen Tan 2018-10-01 13:51:55 PDT
Created attachment 351295 [details]
Patch
Comment 6 Chris Dumez 2018-10-03 09:08:14 PDT
Comment on attachment 351295 [details]
Patch

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

> Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h:38
> +    std::optional<uint64_t> timeout;

Web IDL is using "unsigned long" so the correct C++ type is "unsigned".

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:193
> +    uint64_t timeOutInMsValue = 0;

unsigned timeOutInMsValue = std::min(maxTimeOutValue, timeOutInMs.value_or(maxTimeOutValue));

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:199
> +    m_requestTimeOutTimer = std::make_unique<Timer>([context = this]() mutable {

What guarantees there is always one timer needed at a time in the UIProcess? What prevents the AuthenticaticatorManager to process several requests in parallel?
Comment 7 Jiewen Tan 2018-10-03 18:20:33 PDT
Comment on attachment 351295 [details]
Patch

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

Thanks for reviewing the patch, Chris.

>> Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h:38
>> +    std::optional<uint64_t> timeout;
> 
> Web IDL is using "unsigned long" so the correct C++ type is "unsigned".

Fixed.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:193
>> +    uint64_t timeOutInMsValue = 0;
> 
> unsigned timeOutInMsValue = std::min(maxTimeOutValue, timeOutInMs.value_or(maxTimeOutValue));

Sure.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:199
>> +    m_requestTimeOutTimer = std::make_unique<Timer>([context = this]() mutable {
> 
> What guarantees there is always one timer needed at a time in the UIProcess? What prevents the AuthenticaticatorManager to process several requests in parallel?

In both AuthenticatorManager::makeCredential and AuthenticatorManager::getAssertion which are the only entrances that take requests will immediately invoke the request callback if there is an existing one as we enforce one request at a time.
Comment 8 Jiewen Tan 2018-10-03 18:28:44 PDT
Created attachment 351572 [details]
Patch
Comment 9 Chris Dumez 2018-10-04 09:03:40 PDT
Comment on attachment 351572 [details]
Patch

r=me
Comment 10 Jiewen Tan 2018-10-04 12:05:38 PDT
(In reply to Chris Dumez from comment #9)
> Comment on attachment 351572 [details]
> Patch
> 
> r=me

Thanks, Chris.
Comment 11 WebKit Commit Bot 2018-10-04 12:32:22 PDT
Comment on attachment 351572 [details]
Patch

Clearing flags on attachment: 351572

Committed r236842: <https://trac.webkit.org/changeset/236842>
Comment 12 WebKit Commit Bot 2018-10-04 12:32:24 PDT
All reviewed patches have been landed.  Closing bug.