Title: [259757] branches/safari-610.1.9-branch
Revision
259757
Author
repst...@apple.com
Date
2020-04-08 14:41:32 -0700 (Wed, 08 Apr 2020)

Log Message

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

    Return app-bound sessions for instances where WKAppBoundDomains is
    empty
    https://bugs.webkit.org/show_bug.cgi?id=210124
    <rdar://problem/61276630>

    Reviewed by Brent Fulgham.

    Source/WebKit:

    No new tests. Behavior confirmed by existing In-App Browser Privacy
    tests.

    * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
    (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
    Remove the flag checking if In-App Browser Privacy is enabled. We
    should return an app-bound session if WKAppBoundDomains is empty so
    we no longer need to check the flag here.

    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
    (WebKit::WebPageProxy::decidePolicyForNavigationAction):
    * UIProcess/WebPageProxy.h:
    As described above, we no longer need to check the flag in this
    instance as we are determining behavior based on the WKAppBoundDomains
    list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain,
    so it should take an Optional (WTF::nullopt indicates an empty list).

    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
    (WebKit::WebsiteDataStore::initializeAppBoundDomains):
    Use the flag to enable internal debugging for testing purposes.

    * UIProcess/API/APIHTTPCookieStore.cpp:
    (API::HTTPCookieStore::filterAppBoundCookies):
    Flag no longer needed. This should be gated by whether the domains
    list is empty or not.

    Tools:

    Clean up test settings between tests.

    * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
    (cleanUpInAppBrowserPrivacyTestSettings):

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

Modified Paths

Diff

Modified: branches/safari-610.1.9-branch/Source/WebKit/ChangeLog (259756 => 259757)


--- branches/safari-610.1.9-branch/Source/WebKit/ChangeLog	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/ChangeLog	2020-04-08 21:41:32 UTC (rev 259757)
@@ -1,5 +1,91 @@
 2020-04-08  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r259731. rdar://problem/61360282
+
+    Return app-bound sessions for instances where WKAppBoundDomains is
+    empty
+    https://bugs.webkit.org/show_bug.cgi?id=210124
+    <rdar://problem/61276630>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebKit:
+    
+    No new tests. Behavior confirmed by existing In-App Browser Privacy
+    tests.
+    
+    * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+    (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
+    Remove the flag checking if In-App Browser Privacy is enabled. We
+    should return an app-bound session if WKAppBoundDomains is empty so
+    we no longer need to check the flag here.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
+    (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+    * UIProcess/WebPageProxy.h:
+    As described above, we no longer need to check the flag in this
+    instance as we are determining behavior based on the WKAppBoundDomains
+    list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain,
+    so it should take an Optional (WTF::nullopt indicates an empty list).
+    
+    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+    (WebKit::WebsiteDataStore::initializeAppBoundDomains):
+    Use the flag to enable internal debugging for testing purposes.
+    
+    * UIProcess/API/APIHTTPCookieStore.cpp:
+    (API::HTTPCookieStore::filterAppBoundCookies):
+    Flag no longer needed. This should be gated by whether the domains
+    list is empty or not.
+    
+    Tools:
+    
+    Clean up test settings between tests.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+    (cleanUpInAppBrowserPrivacyTestSettings):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-08  Kate Cheney  <katherine_che...@apple.com>
+
+            Return app-bound sessions for instances where WKAppBoundDomains is
+            empty
+            https://bugs.webkit.org/show_bug.cgi?id=210124
+            <rdar://problem/61276630>
+
+            Reviewed by Brent Fulgham.
+
+            No new tests. Behavior confirmed by existing In-App Browser Privacy
+            tests.
+
+            * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+            (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
+            Remove the flag checking if In-App Browser Privacy is enabled. We
+            should return an app-bound session if WKAppBoundDomains is empty so
+            we no longer need to check the flag here.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
+            (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+            * UIProcess/WebPageProxy.h:
+            As described above, we no longer need to check the flag in this
+            instance as we are determining behavior based on the WKAppBoundDomains
+            list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain,
+            so it should take an Optional (WTF::nullopt indicates an empty list).
+
+            * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+            (WebKit::WebsiteDataStore::initializeAppBoundDomains):
+            Use the flag to enable internal debugging for testing purposes.
+
+            * UIProcess/API/APIHTTPCookieStore.cpp:
+            (API::HTTPCookieStore::filterAppBoundCookies):
+            Flag no longer needed. This should be gated by whether the domains
+            list is empty or not.
+
+2020-04-08  Alan Coon  <alanc...@apple.com>
+
         Revert r259655. rdar://problem/61360282
 
 2020-04-07  Alan Coon  <alanc...@apple.com>

Modified: branches/safari-610.1.9-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (259756 => 259757)


--- branches/safari-610.1.9-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-04-08 21:41:32 UTC (rev 259757)
@@ -63,7 +63,6 @@
 #include <WebKitAdditions/NetworkSessionCocoaAdditions.h>
 #else
 #define NETWORK_SESSION_COCOA_ADDITIONS_1
-#define NETWORK_SESSION_COCOA_ADDITIONS_2 false
 #endif
 
 #import "DeviceManagementSoftLink.h"
@@ -1211,10 +1210,8 @@
         ASSERT_NOT_REACHED();
 #endif
 
-    if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes) {
-        if (m_isInAppBrowserPrivacyEnabled || NETWORK_SESSION_COCOA_ADDITIONS_2)
-            return appBoundSession(storedCredentialsPolicy);
-    }
+    if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes)
+        return appBoundSession(storedCredentialsPolicy);
 
     switch (storedCredentialsPolicy) {
     case WebCore::StoredCredentialsPolicy::Use:

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (259756 => 259757)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp	2020-04-08 21:41:32 UTC (rev 259757)
@@ -38,8 +38,7 @@
 #if USE(APPLE_INTERNAL_SDK)
 #include <WebKitAdditions/HTTPCookieStoreAdditions.h>
 #else
-#define IN_APP_BROWSER_PRIVACY_ENABLED false
-#define IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED
+#define IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED false
 #endif
 
 using namespace WebKit;
@@ -66,9 +65,8 @@
 {
     Vector<WebCore::Cookie> appBoundCookies;
 #if PLATFORM(IOS_FAMILY)
-    m_owningDataStore->getAppBoundDomains([this, protectedThis = makeRef(*this), cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable {
-        if (m_owningDataStore->parameters().networkSessionParameters.isInAppBrowserPrivacyEnabled || IN_APP_BROWSER_PRIVACY_ENABLED) {
-            IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED
+    m_owningDataStore->getAppBoundDomains([cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable {
+        if (!domains.isEmpty() && IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED) {
             for (auto& cookie : cookies) {
                 if (domains.contains(WebCore::RegistrableDomain::uncheckedCreateFromHost(cookie.domain)))
                     appBoundCookies.append(cookie);

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


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-04-08 21:41:32 UTC (rev 259757)
@@ -281,8 +281,7 @@
 #if USE(APPLE_INTERNAL_SDK)
 #include <WebKitAdditions/WebPageProxyAdditions.h>
 #else
-#define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN
-#define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2 false
+#define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN true
 #endif
 
 // This controls what strategy we use for mouse wheel coalescing.
@@ -3119,14 +3118,19 @@
     PolicyCheckIdentifier m_identifier;
 };
 
-void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain)
+void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
 {
 #if PLATFORM(IOS_FAMILY)
-    if (isMainFrame && (m_preferences->isInAppBrowserPrivacyEnabled() || WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2)) {
+    if (isMainFrame) {
+        if (WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN)
+            return;
+        if (!isNavigatingToAppBoundDomain) {
+            m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::Yes;
+            return;
+        }
         if (m_ignoresAppBoundDomains)
             return;
-        WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN
-        if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) {
+        if (*isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) {
             m_configuration->setWebViewCategory(WebViewCategory::InAppBrowser);
             m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::No;
             m_hasNavigatedAwayFromAppBoundDomain = NavigatedAwayFromAppBoundDomain::Yes;
@@ -5105,8 +5109,8 @@
     
     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 && isAppBoundDomain)
-            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), *isAppBoundDomain);
+        if (policyAction != PolicyAction::Ignore)
+            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()) {

Modified: branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.h (259756 => 259757)


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.h	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.h	2020-04-08 21:41:32 UTC (rev 259757)
@@ -2282,7 +2282,7 @@
     void tryCloseTimedOut();
     void makeStorageSpaceRequest(WebCore::FrameIdentifier, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, CompletionHandler<void(uint64_t)>&&);
         
-    void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, NavigatingToAppBoundDomain);
+    void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, Optional<NavigatingToAppBoundDomain>);
     NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; }
         
     const Identifier m_identifier;

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


--- branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2020-04-08 21:41:32 UTC (rev 259757)
@@ -403,13 +403,13 @@
     
     static const auto maxAppBoundDomainCount = 10;
     
-    appBoundDomainQueue().dispatch([forceReinitialization] () mutable {
+    appBoundDomainQueue().dispatch([isInAppBrowserPrivacyEnabled = parameters().networkSessionParameters.isInAppBrowserPrivacyEnabled, forceReinitialization] () mutable {
         if (hasInitializedAppBoundDomains && forceReinitialization != ForceReinitialization::Yes)
             return;
         
         NSArray<NSString *> *domains = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WKAppBoundDomains"];
         
-        RunLoop::main().dispatch([forceReinitialization , domains = retainPtr(domains)] {
+        RunLoop::main().dispatch([isInAppBrowserPrivacyEnabled, forceReinitialization, domains = retainPtr(domains)] {
             if (forceReinitialization == ForceReinitialization::Yes)
                 appBoundDomains().clear();
 
@@ -426,7 +426,8 @@
                 if (appBoundDomains().size() >= maxAppBoundDomainCount)
                     break;
             }
-            WEBSITE_DATA_STORE_ADDITIONS
+            if (isInAppBrowserPrivacyEnabled)
+                WEBSITE_DATA_STORE_ADDITIONS
             hasInitializedAppBoundDomains = true;
         });
     });

Modified: branches/safari-610.1.9-branch/Tools/ChangeLog (259756 => 259757)


--- branches/safari-610.1.9-branch/Tools/ChangeLog	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Tools/ChangeLog	2020-04-08 21:41:32 UTC (rev 259757)
@@ -1,5 +1,69 @@
 2020-04-08  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r259731. rdar://problem/61360282
+
+    Return app-bound sessions for instances where WKAppBoundDomains is
+    empty
+    https://bugs.webkit.org/show_bug.cgi?id=210124
+    <rdar://problem/61276630>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebKit:
+    
+    No new tests. Behavior confirmed by existing In-App Browser Privacy
+    tests.
+    
+    * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+    (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
+    Remove the flag checking if In-App Browser Privacy is enabled. We
+    should return an app-bound session if WKAppBoundDomains is empty so
+    we no longer need to check the flag here.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
+    (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+    * UIProcess/WebPageProxy.h:
+    As described above, we no longer need to check the flag in this
+    instance as we are determining behavior based on the WKAppBoundDomains
+    list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain,
+    so it should take an Optional (WTF::nullopt indicates an empty list).
+    
+    * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+    (WebKit::WebsiteDataStore::initializeAppBoundDomains):
+    Use the flag to enable internal debugging for testing purposes.
+    
+    * UIProcess/API/APIHTTPCookieStore.cpp:
+    (API::HTTPCookieStore::filterAppBoundCookies):
+    Flag no longer needed. This should be gated by whether the domains
+    list is empty or not.
+    
+    Tools:
+    
+    Clean up test settings between tests.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+    (cleanUpInAppBrowserPrivacyTestSettings):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-08  Kate Cheney  <katherine_che...@apple.com>
+
+            Return app-bound sessions for instances where WKAppBoundDomains is
+            empty
+            https://bugs.webkit.org/show_bug.cgi?id=210124
+            <rdar://problem/61276630>
+
+            Reviewed by Brent Fulgham.
+
+            Clean up test settings between tests.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+            (cleanUpInAppBrowserPrivacyTestSettings):
+
+2020-04-08  Alan Coon  <alanc...@apple.com>
+
         Revert r259655. rdar://problem/61360282
 
 2020-04-07  Alan Coon  <alanc...@apple.com>

Modified: branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (259756 => 259757)


--- branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm	2020-04-08 21:41:27 UTC (rev 259756)
+++ branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm	2020-04-08 21:41:32 UTC (rev 259757)
@@ -81,6 +81,7 @@
 
 static void cleanUpInAppBrowserPrivacyTestSettings()
 {
+    WebCore::clearApplicationBundleIdentifierTestingOverride();
     IN_APP_BROWSER_PRIVACY_ADDITIONS_2
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to