⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259615 in webkit


Ignore:
Timestamp:
Apr 6, 2020, 5:11:43 PM (6 years ago)
Author:
Kate Cheney
Message:

Create a way to signal if the WKAppBoundDomains list is empty
https://bugs.webkit.org/show_bug.cgi?id=210074
<rdar://problem/61359228>

Reviewed by Brent Fulgham.

Updates the WebFramePolicyListener to return an Optional<NavigatingToAppBoundDomain>
to signal if the WKAppBoundDomains list is empty. If so, we don't want to update
any app-bound domain parameters in WebPageProxy.

  • UIProcess/WebFramePolicyListenerProxy.cpp:

(WebKit::WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult):

  • UIProcess/WebFramePolicyListenerProxy.h:
  • UIProcess/WebFrameProxy.cpp:

(WebKit::WebFrameProxy::setUpPolicyListenerProxy):

  • UIProcess/WebFrameProxy.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponseShared):

  • UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:

(WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
Changed the WebFramePolicyListener to take a NavigatingToAppBoundDomain
type as opposed to a boolean to allow it to handle the empty value.

Location:
trunk/Source/WebKit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r259610 r259615  
     12020-04-06  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Create a way to signal if the WKAppBoundDomains list is empty
     4        https://bugs.webkit.org/show_bug.cgi?id=210074
     5        <rdar://problem/61359228>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Updates the WebFramePolicyListener to return an Optional<NavigatingToAppBoundDomain>
     10        to signal if the WKAppBoundDomains list is empty. If so, we don't want to update
     11        any app-bound domain parameters in WebPageProxy.
     12
     13        * UIProcess/WebFramePolicyListenerProxy.cpp:
     14        (WebKit::WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult):
     15        * UIProcess/WebFramePolicyListenerProxy.h:
     16        * UIProcess/WebFrameProxy.cpp:
     17        (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
     18        * UIProcess/WebFrameProxy.h:
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
     21        (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
     22        (WebKit::WebPageProxy::decidePolicyForResponseShared):
     23        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
     24        (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
     25        Changed the WebFramePolicyListener to take a NavigatingToAppBoundDomain
     26        type as opposed to a boolean to allow it to handle the empty value.
     27
    1282020-04-06  Chris Dumez  <cdumez@apple.com>
    229
  • trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp

    r258054 r259615  
    4747WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy() = default;
    4848
    49 void WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult(bool isNavigatingToAppBoundDomain)
     49void WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult(Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
    5050{
    5151    ASSERT(RunLoop::isMain());
    5252
    53     auto isAppBound = isNavigatingToAppBoundDomain ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No;
    5453    if (m_policyResult && m_safeBrowsingWarning) {
    5554        if (m_reply)
    56             m_reply(WebCore::PolicyAction::Use, m_policyResult->first.get(), m_policyResult->second, WTFMove(*m_safeBrowsingWarning), isAppBound);
     55            m_reply(WebCore::PolicyAction::Use, m_policyResult->first.get(), m_policyResult->second, WTFMove(*m_safeBrowsingWarning), isNavigatingToAppBoundDomain);
    5756    } else
    58         m_isNavigatingToAppBoundDomain = isAppBound;
     57        m_isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain;
    5958}
    6059
  • trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h

    r258054 r259615  
    4747public:
    4848
    49     using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>;
     49    using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>;
    5050    static Ref<WebFramePolicyListenerProxy> create(Reply&& reply, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
    5151    {
     
    5959   
    6060    void didReceiveSafeBrowsingResults(RefPtr<SafeBrowsingWarning>&&);
    61     void didReceiveAppBoundDomainResult(bool);
     61    void didReceiveAppBoundDomainResult(Optional<NavigatingToAppBoundDomain>);
    6262
    6363private:
     
    6666    Optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult;
    6767    Optional<RefPtr<SafeBrowsingWarning>> m_safeBrowsingWarning;
    68     Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain;
     68    Optional<Optional<NavigatingToAppBoundDomain>> m_isNavigatingToAppBoundDomain;
    6969    Reply m_reply;
    7070};
  • trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp

    r258054 r259615  
    194194}
    195195
    196 WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>&& completionHandler, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
     196WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>&& completionHandler, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
    197197{
    198198    if (m_activeListener)
    199199        m_activeListener->ignore();
    200     m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
     200    m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) mutable {
    201201        completionHandler(action, policies, processSwapRequestedByClient, WTFMove(safeBrowsingWarning), isNavigatingToAppBoundDomain);
    202202        m_activeListener = nullptr;
  • trunk/Source/WebKit/UIProcess/WebFrameProxy.h

    r258054 r259615  
    121121    void didChangeTitle(const String&);
    122122
    123     WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
     123    WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
    124124
    125125#if ENABLE(CONTENT_FILTERING)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r259523 r259615  
    51045104#endif
    51055105   
    5106     auto listener = makeRef(frame.setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(frame), sender = WTFMove(sender), navigation] (PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isAppBoundDomain) mutable {
    5107 
    5108         if (policyAction != PolicyAction::Ignore)
    5109             setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), isAppBoundDomain);
     5106    auto listener = makeRef(frame.setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(frame), sender = WTFMove(sender), navigation] (PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isAppBoundDomain) mutable {
     5107
     5108        if (policyAction != PolicyAction::Ignore && isAppBoundDomain)
     5109            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), *isAppBoundDomain);
    51105110
    51115111        auto completionHandler = [this, protectedThis = protectedThis.copyRef(), frame = frame.copyRef(), sender = WTFMove(sender), navigation, processSwapRequestedByClient, policies = makeRefPtr(policies)] (PolicyAction policyAction) mutable {
     
    52915291    MESSAGE_CHECK_URL(m_process, request.url());
    52925292
    5293     auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), identifier, listenerID, frameID] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
     5293    auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), identifier, listenerID, frameID] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) mutable {
    52945294        // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
    52955295        RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
     
    53395339    RefPtr<API::Navigation> navigation = navigationID ? m_navigationState->navigation(navigationID) : nullptr;
    53405340    auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), webPageID, frameID, identifier, listenerID, navigation = WTFMove(navigation),
    5341         process = process.copyRef()] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
     5341        process = process.copyRef()] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) mutable {
    53425342        // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
    53435343        RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
  • trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm

    r259520 r259615  
    458458
    459459    if (shouldTreatURLProtocolAsAppBound(requestURL)) {
    460         listener.didReceiveAppBoundDomainResult(true);
     460        listener.didReceiveAppBoundDomainResult(NavigatingToAppBoundDomain::Yes);
    461461        return;
    462462    }
    463463
    464464    ensureAppBoundDomains([domain = WebCore::RegistrableDomain(requestURL), listener = makeRef(listener)] (auto& domains) mutable {
    465         listener->didReceiveAppBoundDomainResult(domains.contains(domain));
     465        if (domains.isEmpty()) {
     466            listener->didReceiveAppBoundDomainResult(WTF::nullopt);
     467            return;
     468        }
     469        listener->didReceiveAppBoundDomainResult(domains.contains(domain) ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No);
    466470    });
    467471}
Note: See TracChangeset for help on using the changeset viewer.