Bug 203937

Summary: [WebAuthn] Return NotAllowedError immediately for UI cancellations
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebKit Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: alex.gaynor, bfulgham, jiewen_tan, kieun.shin, 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 bfulgham: review+, bfulgham: commit-queue-

Description Jiewen Tan 2019-11-06 18:40:53 PST
return NotAllowedError immediately for UI cancellations.
Comment 1 Jiewen Tan 2019-11-06 18:41:17 PST
<rdar://problem/56962420>
Comment 2 Jiewen Tan 2019-11-06 18:47:59 PST
Created attachment 383003 [details]
Patch
Comment 3 Brent Fulgham 2019-11-07 17:09:05 PST
Comment on attachment 383003 [details]
Patch

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

r=me, but I would make the patch as small as possible to make it easier to integrate quickly.

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
> +    clearState();

To keep the patch small, I would just keep using resetState here.

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:-217
> -    resetState();

Then you don't need this change.

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:-357
> -void AuthenticatorManager::resetState()

... or this change.

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h:-95
> -    void resetState();

Or this change.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:562
> +    EXPECT_TRUE(webAuthenticationPanelFailed);

Nice!
Comment 4 Jiewen Tan 2019-11-07 17:29:36 PST
Comment on attachment 383003 [details]
Patch

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

Thanks Brent for r+ this change.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
>> +    clearState();
> 
> To keep the patch small, I would just keep using resetState here.

I think this patch is already small enough for quick integration. Splitting this change into two doesn't seem necessary.
Comment 5 Brent Fulgham 2019-11-08 08:38:08 PST
Comment on attachment 383003 [details]
Patch

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

>>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
>>> +    clearState();
>> 
>> To keep the patch small, I would just keep using resetState here.
> 
> I think this patch is already small enough for quick integration. Splitting this change into two doesn't seem necessary.

I'm not suggesting you split the change; I just think it's unnecessary to remove the 'resetState' method. Just keep it as-is.
Comment 6 Jiewen Tan 2019-11-08 11:24:24 PST
Comment on attachment 383003 [details]
Patch

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

>>>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
>>>> +    clearState();
>>> 
>>> To keep the patch small, I would just keep using resetState here.
>> 
>> I think this patch is already small enough for quick integration. Splitting this change into two doesn't seem necessary.
> 
> I'm not suggesting you split the change; I just think it's unnecessary to remove the 'resetState' method. Just keep it as-is.

The reason to have the 'resetState' method is to avoid the m_pendingCompletionHandler check in 'clearState', and is specifically crafted for this method. Now this method will invoke m_pendingCompletionHandler as well, and therefore there is no need to have the 'resetState' method anymore. That's why I remove it.
Comment 7 Brent Fulgham 2019-11-08 11:26:24 PST
(In reply to Jiewen Tan from comment #6)
> Comment on attachment 383003 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=383003&action=review
> 
> >>>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
> >>>> +    clearState();
> >>> 
> >>> To keep the patch small, I would just keep using resetState here.
> >> 
> >> I think this patch is already small enough for quick integration. Splitting this change into two doesn't seem necessary.
> > 
> > I'm not suggesting you split the change; I just think it's unnecessary to remove the 'resetState' method. Just keep it as-is.
> 
> The reason to have the 'resetState' method is to avoid the
> m_pendingCompletionHandler check in 'clearState', and is specifically
> crafted for this method. Now this method will invoke
> m_pendingCompletionHandler as well, and therefore there is no need to have
> the 'resetState' method anymore. That's why I remove it.

Fine. Let's just get it landed so I can try to get it in.
Comment 8 Jiewen Tan 2019-11-08 11:37:00 PST
(In reply to Brent Fulgham from comment #7)
> (In reply to Jiewen Tan from comment #6)
> > Comment on attachment 383003 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=383003&action=review
> > 
> > >>>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:202
> > >>>> +    clearState();
> > >>> 
> > >>> To keep the patch small, I would just keep using resetState here.
> > >> 
> > >> I think this patch is already small enough for quick integration. Splitting this change into two doesn't seem necessary.
> > > 
> > > I'm not suggesting you split the change; I just think it's unnecessary to remove the 'resetState' method. Just keep it as-is.
> > 
> > The reason to have the 'resetState' method is to avoid the
> > m_pendingCompletionHandler check in 'clearState', and is specifically
> > crafted for this method. Now this method will invoke
> > m_pendingCompletionHandler as well, and therefore there is no need to have
> > the 'resetState' method anymore. That's why I remove it.
> 
> Fine. Let's just get it landed so I can try to get it in.

Thanks, Brent.
Comment 9 Jiewen Tan 2019-11-08 11:44:41 PST
Committed r252248: <https://trac.webkit.org/changeset/252248>
Comment 10 Jiewen Tan 2019-11-18 11:09:12 PST
*** Bug 204186 has been marked as a duplicate of this bug. ***