Bug 200150 - NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting
Summary: NavigationSOAuthorizationSession should check the active URL of the respondin...
Status: NEW
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:
 
Reported: 2019-07-25 19:47 PDT by Jiewen Tan
Modified: 2019-07-26 17:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.68 KB, patch)
2019-07-25 19:51 PDT, Jiewen Tan
bfulgham: review+
Details | Formatted Diff | Diff
Patch for landing (7.92 KB, patch)
2019-07-26 15:26 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-25 19:47:11 PDT
NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting.
Comment 1 Jiewen Tan 2019-07-25 19:48:01 PDT
<rdar://problem/53280170>
Comment 2 Jiewen Tan 2019-07-25 19:51:17 PDT
Created attachment 374933 [details]
Patch
Comment 3 Brent Fulgham 2019-07-26 14:59:20 PDT
Comment on attachment 374933 [details]
Patch

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

> Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:70
> +    // When the current main frame URL is different from the before one,

I think it might be simpler to say:

"// When the current main frame URL has changed from the start of authentication, the SOAuthorization is no longer valid."

Even better would be to make a method:

bool NavigationSOAuthorizationSession::mainFrameURLDidChangeDuringAuthentication()
{
    auto* page = this->page();
    return !page || page->pageLoadState().activeURL() != m_waitingPageActiveURL;
}

> Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:72
> +    if (page->pageLoadState().activeURL() != m_waitingPageActiveURL) {

Then this just becomes:

if (mainFrameURLDidChangeDuringAuthentication()) {
    abort();
...

And you don't need a comment. :-)

> Source/WebKit/UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:-79
> -    ASSERT_NOT_REACHED();

Why is it okay to remove this assertion? Is it because we now expect to abort if the URL changed during authentication?
Comment 4 Jiewen Tan 2019-07-26 15:22:20 PDT
Comment on attachment 374933 [details]
Patch

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

Thanks Brent for r+ this patch.

>> Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:70
>> +    // When the current main frame URL is different from the before one,
> 
> I think it might be simpler to say:
> 
> "// When the current main frame URL has changed from the start of authentication, the SOAuthorization is no longer valid."
> 
> Even better would be to make a method:
> 
> bool NavigationSOAuthorizationSession::mainFrameURLDidChangeDuringAuthentication()
> {
>     auto* page = this->page();
>     return !page || page->pageLoadState().activeURL() != m_waitingPageActiveURL;
> }

Fixed.

>> Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:72
>> +    if (page->pageLoadState().activeURL() != m_waitingPageActiveURL) {
> 
> Then this just becomes:
> 
> if (mainFrameURLDidChangeDuringAuthentication()) {
>     abort();
> ...
> 
> And you don't need a comment. :-)

Named it pageActiveURLDidChangeDuringWaiting.

>> Source/WebKit/UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:-79
>> -    ASSERT_NOT_REACHED();
> 
> Why is it okay to remove this assertion? Is it because we now expect to abort if the URL changed during authentication?

Yes.
Comment 5 Jiewen Tan 2019-07-26 15:26:00 PDT
Created attachment 374991 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2019-07-26 17:03:51 PDT
Comment on attachment 374991 [details]
Patch for landing

Clearing flags on attachment: 374991

Committed r247885: <https://trac.webkit.org/changeset/247885>