Title: [259695] branches/safari-610.1.9-branch/Source/WebKit
Revision
259695
Author
repst...@apple.com
Date
2020-04-07 17:43:11 -0700 (Tue, 07 Apr 2020)

Log Message

Cherry-pick r259615. rdar://problem/61360282

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.9-branch/Source/WebKit/ChangeLog (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/ChangeLog	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/ChangeLog	2020-04-08 00:43:11 UTC (rev 259695)
@@ -1,3 +1,62 @@
+2020-04-07  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r259615. rdar://problem/61360282
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-06  Kate Cheney  <katherine_che...@apple.com>
+
+            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.
+
 2020-04-04  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Add a fourth round of logging to help diagnose <webkit.org/b/209685>

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp	2020-04-08 00:43:11 UTC (rev 259695)
@@ -46,16 +46,15 @@
 
 WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy() = default;
 
-void WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult(bool isNavigatingToAppBoundDomain)
+void WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult(Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
 {
     ASSERT(RunLoop::isMain());
 
-    auto isAppBound = isNavigatingToAppBoundDomain ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No;
     if (m_policyResult && m_safeBrowsingWarning) {
         if (m_reply)
-            m_reply(WebCore::PolicyAction::Use, m_policyResult->first.get(), m_policyResult->second, WTFMove(*m_safeBrowsingWarning), isAppBound);
+            m_reply(WebCore::PolicyAction::Use, m_policyResult->first.get(), m_policyResult->second, WTFMove(*m_safeBrowsingWarning), isNavigatingToAppBoundDomain);
     } else
-        m_isNavigatingToAppBoundDomain = isAppBound;
+        m_isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain;
 }
 
 void WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults(RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning)

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h	2020-04-08 00:43:11 UTC (rev 259695)
@@ -46,7 +46,7 @@
 class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> {
 public:
 
-    using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>;
+    using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>;
     static Ref<WebFramePolicyListenerProxy> create(Reply&& reply, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
     {
         return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(reply), expectSafeBrowsingResult, expectAppBoundDomainResult));
@@ -58,7 +58,7 @@
     void ignore();
     
     void didReceiveSafeBrowsingResults(RefPtr<SafeBrowsingWarning>&&);
-    void didReceiveAppBoundDomainResult(bool);
+    void didReceiveAppBoundDomainResult(Optional<NavigatingToAppBoundDomain>);
 
 private:
     WebFramePolicyListenerProxy(Reply&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
@@ -65,7 +65,7 @@
 
     Optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult;
     Optional<RefPtr<SafeBrowsingWarning>> m_safeBrowsingWarning;
-    Optional<NavigatingToAppBoundDomain> m_isNavigatingToAppBoundDomain;
+    Optional<Optional<NavigatingToAppBoundDomain>> m_isNavigatingToAppBoundDomain;
     Reply m_reply;
 };
 

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.cpp (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.cpp	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.cpp	2020-04-08 00:43:11 UTC (rev 259695)
@@ -193,11 +193,11 @@
     m_title = title;
 }
 
-WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>&& completionHandler, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
+WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>&& completionHandler, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
 {
     if (m_activeListener)
         m_activeListener->ignore();
-    m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (PolicyAction action, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
+    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 {
         completionHandler(action, policies, processSwapRequestedByClient, WTFMove(safeBrowsingWarning), isNavigatingToAppBoundDomain);
         m_activeListener = nullptr;
     }, expectSafeBrowsingResult, expectAppBoundDomainResult);

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.h (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.h	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebFrameProxy.h	2020-04-08 00:43:11 UTC (rev 259695)
@@ -120,7 +120,7 @@
     void didSameDocumentNavigation(const URL&); // eg. anchor navigation, session state change.
     void didChangeTitle(const String&);
 
-    WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, NavigatingToAppBoundDomain)>&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
+    WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
 
 #if ENABLE(CONTENT_FILTERING)
     void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTFMove(contentFilterUnblockHandler); }

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-08 00:43:11 UTC (rev 259695)
@@ -5103,10 +5103,10 @@
     shouldExpectAppBoundDomainResult = ShouldExpectAppBoundDomainResult::Yes;
 #endif
     
-    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 {
+    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 {
 
-        if (policyAction != PolicyAction::Ignore)
-            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), isAppBoundDomain);
+        if (policyAction != PolicyAction::Ignore && isAppBoundDomain)
+            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), *isAppBoundDomain);
 
         auto completionHandler = [this, protectedThis = protectedThis.copyRef(), frame = frame.copyRef(), sender = WTFMove(sender), navigation, processSwapRequestedByClient, policies = makeRefPtr(policies)] (PolicyAction policyAction) mutable {
             if (frame->isMainFrame()) {
@@ -5290,7 +5290,7 @@
     MESSAGE_CHECK(m_process, frame);
     MESSAGE_CHECK_URL(m_process, request.url());
 
-    auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), identifier, listenerID, frameID] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
+    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 {
         // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
         RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
         ASSERT_UNUSED(safeBrowsingWarning, !safeBrowsingWarning);
@@ -5338,7 +5338,7 @@
     MESSAGE_CHECK_URL(process, response.url());
     RefPtr<API::Navigation> navigation = navigationID ? m_navigationState->navigation(navigationID) : nullptr;
     auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), webPageID, frameID, identifier, listenerID, navigation = WTFMove(navigation),
-        process = process.copyRef()] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain) mutable {
+        process = process.copyRef()] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) mutable {
         // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.
         RELEASE_ASSERT(processSwapRequestedByClient == ProcessSwapRequestedByClient::No);
         ASSERT_UNUSED(safeBrowsingWarning, !safeBrowsingWarning);

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (259694 => 259695)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-04-08 00:38:33 UTC (rev 259694)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-04-08 00:43:11 UTC (rev 259695)
@@ -457,12 +457,16 @@
     ASSERT(RunLoop::isMain());
 
     if (shouldTreatURLProtocolAsAppBound(requestURL)) {
-        listener.didReceiveAppBoundDomainResult(true);
+        listener.didReceiveAppBoundDomainResult(NavigatingToAppBoundDomain::Yes);
         return;
     }
 
     ensureAppBoundDomains([domain = WebCore::RegistrableDomain(requestURL), listener = makeRef(listener)] (auto& domains) mutable {
-        listener->didReceiveAppBoundDomainResult(domains.contains(domain));
+        if (domains.isEmpty()) {
+            listener->didReceiveAppBoundDomainResult(WTF::nullopt);
+            return;
+        }
+        listener->didReceiveAppBoundDomainResult(domains.contains(domain) ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No);
     });
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to