Bug 199755 - SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
Summary: SOAuthorizationSession::presentViewController should check WebPageProxy::isCl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-12 13:36 PDT by Jiewen Tan
Modified: 2019-07-12 17:53 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.34 KB, patch)
2019-07-12 13:40 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (1.83 KB, patch)
2019-07-12 15:54 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 2019-07-12 13:36:31 PDT
Check m_isClosed in WebPageProxy::platformWindow.
Comment 1 Jiewen Tan 2019-07-12 13:36:40 PDT
<rdar://problem/52323585>
Comment 2 Jiewen Tan 2019-07-12 13:40:14 PDT
Created attachment 374031 [details]
Patch
Comment 3 Chris Dumez 2019-07-12 14:14:21 PDT
Comment on attachment 374031 [details]
Patch

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

> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:640
> +    if (m_isClosed)

I would instead update this check in SSO code:
if (!m_page || m_viewController) {
        uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
        return;
    }

->

if (!m_page || m_page->isClosed() || m_viewController) {
        uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
        return;
    }
Comment 4 Chris Dumez 2019-07-12 14:33:04 PDT
(In reply to Chris Dumez from comment #3)
> Comment on attachment 374031 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=374031&action=review
> 
> > Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:640
> > +    if (m_isClosed)
> 
> I would instead update this check in SSO code:
> if (!m_page || m_viewController) {
>         uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain
> code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
>         return;
>     }
> 
> ->
> 
> if (!m_page || m_page->isClosed() || m_viewController) {
>         uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain
> code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
>         return;
>     }

Also, do we have API testing for SSO? If so, it'd be good to have a test that starts an SSO request then calls _close on the webView right away.
Comment 5 Jiewen Tan 2019-07-12 15:05:06 PDT
Comment on attachment 374031 [details]
Patch

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

Thanks Chris for reviewing the patch.

>>> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:640
>>> +    if (m_isClosed)
>> 
>> I would instead update this check in SSO code:
>> if (!m_page || m_viewController) {
>>         uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
>>         return;
>>     }
>> 
>> ->
>> 
>> if (!m_page || m_page->isClosed() || m_viewController) {
>>         uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
>>         return;
>>     }
> 
> Also, do we have API testing for SSO? If so, it'd be good to have a test that starts an SSO request then calls _close on the webView right away.

Sure thing. However, it still feels weird that caller of m_page->platformWindow() needs to check m_page->isClosed(). SSO tests are all API tests which should be able to reproduce what you suggest. Let me try.
Comment 6 Jiewen Tan 2019-07-12 15:54:36 PDT
Created attachment 374045 [details]
Patch
Comment 7 Chris Dumez 2019-07-12 16:03:14 PDT
Comment on attachment 374045 [details]
Patch

r=me
Comment 8 Jiewen Tan 2019-07-12 16:08:07 PDT
(In reply to Chris Dumez from comment #7)
> Comment on attachment 374045 [details]
> Patch
> 
> r=me

Thanks, Chris.
Comment 9 WebKit Commit Bot 2019-07-12 17:53:36 PDT
Comment on attachment 374045 [details]
Patch

Clearing flags on attachment: 374045

Committed r247410: <https://trac.webkit.org/changeset/247410>
Comment 10 WebKit Commit Bot 2019-07-12 17:53:37 PDT
All reviewed patches have been landed.  Closing bug.