Bug 209755 - Known app-bound domain protocols should not check the app-bound domain list
Summary: Known app-bound domain protocols should not check the app-bound domain list
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: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-30 11:04 PDT by Kate Cheney
Modified: 2020-03-30 16:06 PDT (History)
2 users (show)

See Also:


Attachments
Patch (5.13 KB, patch)
2020-03-30 11:08 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (5.25 KB, patch)
2020-03-30 11:13 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (5.24 KB, patch)
2020-03-30 13:24 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (6.87 KB, patch)
2020-03-30 14:30 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kate Cheney 2020-03-30 11:04:58 PDT
It is wasteful to check the app-bound domain list and wait for a response when some protocols are automatically considered app-bound.
Comment 1 Kate Cheney 2020-03-30 11:05:32 PDT
<rdar://problem/60875376>
Comment 2 Kate Cheney 2020-03-30 11:08:44 PDT
Created attachment 394936 [details]
Patch
Comment 3 Kate Cheney 2020-03-30 11:13:17 PDT
Created attachment 394937 [details]
Patch
Comment 4 Chris Dumez 2020-03-30 13:08:37 PDT
Comment on attachment 394937 [details]
Patch

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

> Source/WebKit/UIProcess/WebPageProxy.cpp:5115
> +#if PLATFORM(COCOA) && PLATFORM(IOS_FAMILY)

PLATFORM(COCOA) && seems redundant

> Source/WebKit/UIProcess/WebPageProxy.cpp:5116
> +    if (!shouldBeTreatedAsAppBound(request.url()))

Not sure I understand why the ! here.
Comment 5 Kate Cheney 2020-03-30 13:19:45 PDT
Comment on attachment 394937 [details]
Patch

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

>> Source/WebKit/UIProcess/WebPageProxy.cpp:5115
>> +#if PLATFORM(COCOA) && PLATFORM(IOS_FAMILY)
> 
> PLATFORM(COCOA) && seems redundant

Removing.

>> Source/WebKit/UIProcess/WebPageProxy.cpp:5116
>> +    if (!shouldBeTreatedAsAppBound(request.url()))
> 
> Not sure I understand why the ! here.

If shouldExpectAppBoundDomainResult is Yes, we make the call to check the app-bound domain list (see below). We only want to check the app-bound domain list if the request url is not one of these special, automatic app-bound domain protocols.

Keeping it as ShouldExpectAppBoundDomainResult::No for the app-bound domain protocols makes sure we don't dispatch and wait for the list to be checked. ShouldExpectAppBoundDomainResult::No now automatically returns NavigatingToAppBoundDomain::Yes in the WebFramePolicyListener constructor.
Comment 6 Kate Cheney 2020-03-30 13:20:32 PDT
(In reply to katherine_cheney from comment #5)
> Comment on attachment 394937 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=394937&action=review
> 
> >> Source/WebKit/UIProcess/WebPageProxy.cpp:5115
> >> +#if PLATFORM(COCOA) && PLATFORM(IOS_FAMILY)
> > 
> > PLATFORM(COCOA) && seems redundant
> 
> Removing.
> 
> >> Source/WebKit/UIProcess/WebPageProxy.cpp:5116
> >> +    if (!shouldBeTreatedAsAppBound(request.url()))
> > 
> > Not sure I understand why the ! here.
> 
> If shouldExpectAppBoundDomainResult is Yes, we make the call to check the
> app-bound domain list (see below). We only want to check the app-bound
> domain list if the request url is not one of these special, automatic
> app-bound domain protocols.
> 

By "see below," I meant this line in the patch:

+    if (shouldExpectAppBoundDomainResult == ShouldExpectAppBoundDomainResult::Yes)
+        m_websiteDataStore->beginAppBoundDomainCheck(RegistrableDomain { request.url() }, listener);

> Keeping it as ShouldExpectAppBoundDomainResult::No for the app-bound domain
> protocols makes sure we don't dispatch and wait for the list to be checked.
> ShouldExpectAppBoundDomainResult::No now automatically returns
> NavigatingToAppBoundDomain::Yes in the WebFramePolicyListener constructor.
Comment 7 Kate Cheney 2020-03-30 13:24:01 PDT
Created attachment 394952 [details]
Patch
Comment 8 Chris Dumez 2020-03-30 13:25:11 PDT
While I believe you that the patch does the right thing, it seems to do the right thing in a confusing way and it would be nice to refactor the code so that it is clearer. Right now, at best it would need a comment. But if code requires a comment, then it likely means the code is not clear enough to be self documenting.
Comment 9 Chris Dumez 2020-03-30 13:27:19 PDT
Comment on attachment 394952 [details]
Patch

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

> Source/WebKit/UIProcess/WebPageProxy.cpp:-5177
> -    m_websiteDataStore->beginAppBoundDomainCheck(RegistrableDomain { request.url() }, listener);

Can beginAppBoundDomainCheck() take a URL and do an early return if the protocol is definitely app bound? Seems like it might be clearer than all this special casing at the call site. We'd always do an app bound check but the check would be super cheap in some cases.
Comment 10 Chris Dumez 2020-03-30 13:31:40 PDT
Comment on attachment 394952 [details]
Patch

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

>> Source/WebKit/UIProcess/WebPageProxy.cpp:-5177
>> -    m_websiteDataStore->beginAppBoundDomainCheck(RegistrableDomain { request.url() }, listener);
> 
> Can beginAppBoundDomainCheck() take a URL and do an early return if the protocol is definitely app bound? Seems like it might be clearer than all this special casing at the call site. We'd always do an app bound check but the check would be super cheap in some cases.

Also, please rename shouldBeTreatedAsAppBound() to something like shouldTreatURLProtocolAsAppBound()
Comment 11 Kate Cheney 2020-03-30 14:30:58 PDT
Created attachment 394961 [details]
Patch
Comment 12 Chris Dumez 2020-03-30 15:56:06 PDT
Comment on attachment 394961 [details]
Patch

me likee
Comment 13 Kate Cheney 2020-03-30 16:02:37 PDT
(In reply to Chris Dumez from comment #12)
> Comment on attachment 394961 [details]
> Patch
> 
> me likee

:) thanks!
Comment 14 EWS 2020-03-30 16:06:07 PDT
Committed r259240: <https://trac.webkit.org/changeset/259240>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394961 [details].