<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[259655] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/259655">259655</a></dd>
<dt>Author</dt> <dd>katherine_cheney@apple.com</dd>
<dt>Date</dt> <dd>2020-04-07 11:43:45 -0700 (Tue, 07 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:

Cleaned up tests to turn the flag on at the start of each In-App
Browser Privacy test.

* TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
(cleanUpInAppBrowserPrivacyTestSettings):
(initializeInAppBrowserPrivacyTestSettings):
(TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm">trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIAPIHTTPCookieStorecpp">trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm">trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaInAppBrowserPrivacymm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/ChangeLog       2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2020-04-07  Kate Cheney  <katherine_cheney@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.
+
</ins><span class="cx"> 2020-04-07  Per Arne Vollan  <pvollan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS] Add message to message filter in the WebContent sandbox
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm  2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm     2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -63,7 +63,6 @@
</span><span class="cx"> #include <WebKitAdditions/NetworkSessionCocoaAdditions.h>
</span><span class="cx"> #else
</span><span class="cx"> #define NETWORK_SESSION_COCOA_ADDITIONS_1
</span><del>-#define NETWORK_SESSION_COCOA_ADDITIONS_2 false
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #import "DeviceManagementSoftLink.h"
</span><span class="lines">@@ -1211,10 +1210,8 @@
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes) {
-        if (m_isInAppBrowserPrivacyEnabled || NETWORK_SESSION_COCOA_ADDITIONS_2)
-            return appBoundSession(storedCredentialsPolicy);
-    }
</del><ins>+    if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes)
+        return appBoundSession(storedCredentialsPolicy);
</ins><span class="cx"> 
</span><span class="cx">     switch (storedCredentialsPolicy) {
</span><span class="cx">     case WebCore::StoredCredentialsPolicy::Use:
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIAPIHTTPCookieStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp 2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp    2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> #include <WebKitAdditions/HTTPCookieStoreAdditions.h>
</span><span class="cx"> #else
</span><del>-#define IN_APP_BROWSER_PRIVACY_ENABLED false
</del><span class="cx"> #define IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -66,8 +65,8 @@
</span><span class="cx"> {
</span><span class="cx">     Vector<WebCore::Cookie> appBoundCookies;
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-    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) {
</del><ins>+    m_owningDataStore->getAppBoundDomains([cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable {
+        if (!domains.isEmpty()) {
</ins><span class="cx">             IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED
</span><span class="cx">             for (auto& cookie : cookies) {
</span><span class="cx">                 if (domains.contains(WebCore::RegistrableDomain::uncheckedCreateFromHost(cookie.domain)))
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -282,7 +282,6 @@
</span><span class="cx"> #include <WebKitAdditions/WebPageProxyAdditions.h>
</span><span class="cx"> #else
</span><span class="cx"> #define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN
</span><del>-#define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2 false
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // This controls what strategy we use for mouse wheel coalescing.
</span><span class="lines">@@ -3119,14 +3118,18 @@
</span><span class="cx">     PolicyCheckIdentifier m_identifier;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain)
</del><ins>+void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><del>-    if (isMainFrame && (m_preferences->isInAppBrowserPrivacyEnabled() || WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2)) {
</del><ins>+    if (isMainFrame) {
+        WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN
+        if (!isNavigatingToAppBoundDomain) {
+            m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::Yes;
+            return;
+        }
</ins><span class="cx">         if (m_ignoresAppBoundDomains)
</span><span class="cx">             return;
</span><del>-        WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN
-        if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) {
</del><ins>+        if (*isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) {
</ins><span class="cx">             m_configuration->setWebViewCategory(WebViewCategory::InAppBrowser);
</span><span class="cx">             m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::No;
</span><span class="cx">             m_hasNavigatedAwayFromAppBoundDomain = NavigatedAwayFromAppBoundDomain::Yes;
</span><span class="lines">@@ -5105,8 +5108,8 @@
</span><span class="cx">     
</span><span class="cx">     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 {
</span><span class="cx"> 
</span><del>-        if (policyAction != PolicyAction::Ignore && isAppBoundDomain)
-            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), *isAppBoundDomain);
</del><ins>+        if (policyAction != PolicyAction::Ignore)
+            setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), isAppBoundDomain);
</ins><span class="cx"> 
</span><span class="cx">         auto completionHandler = [this, protectedThis = protectedThis.copyRef(), frame = frame.copyRef(), sender = WTFMove(sender), navigation, processSwapRequestedByClient, policies = makeRefPtr(policies)] (PolicyAction policyAction) mutable {
</span><span class="cx">             if (frame->isMainFrame()) {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -2282,7 +2282,7 @@
</span><span class="cx">     void tryCloseTimedOut();
</span><span class="cx">     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)>&&);
</span><span class="cx">         
</span><del>-    void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, NavigatingToAppBoundDomain);
</del><ins>+    void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, Optional<NavigatingToAppBoundDomain>);
</ins><span class="cx">     NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; }
</span><span class="cx">         
</span><span class="cx">     const Identifier m_identifier;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm    2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -403,13 +403,13 @@
</span><span class="cx">     
</span><span class="cx">     static const auto maxAppBoundDomainCount = 10;
</span><span class="cx">     
</span><del>-    appBoundDomainQueue().dispatch([forceReinitialization] () mutable {
</del><ins>+    appBoundDomainQueue().dispatch([isInAppBrowserPrivacyEnabled = parameters().networkSessionParameters.isInAppBrowserPrivacyEnabled, forceReinitialization] () mutable {
</ins><span class="cx">         if (hasInitializedAppBoundDomains && forceReinitialization != ForceReinitialization::Yes)
</span><span class="cx">             return;
</span><span class="cx">         
</span><span class="cx">         NSArray<NSString *> *domains = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WKAppBoundDomains"];
</span><span class="cx">         
</span><del>-        RunLoop::main().dispatch([forceReinitialization , domains = retainPtr(domains)] {
</del><ins>+        RunLoop::main().dispatch([isInAppBrowserPrivacyEnabled, forceReinitialization, domains = retainPtr(domains)] {
</ins><span class="cx">             if (forceReinitialization == ForceReinitialization::Yes)
</span><span class="cx">                 appBoundDomains().clear();
</span><span class="cx"> 
</span><span class="lines">@@ -426,7 +426,8 @@
</span><span class="cx">                 if (appBoundDomains().size() >= maxAppBoundDomainCount)
</span><span class="cx">                     break;
</span><span class="cx">             }
</span><del>-            WEBSITE_DATA_STORE_ADDITIONS
</del><ins>+            if (isInAppBrowserPrivacyEnabled)
+                WEBSITE_DATA_STORE_ADDITIONS
</ins><span class="cx">             hasInitializedAppBoundDomains = true;
</span><span class="cx">         });
</span><span class="cx">     });
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Tools/ChangeLog       2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2020-04-07  Kate Cheney  <katherine_cheney@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.
+
+        Cleaned up tests to turn the flag on at the start of each In-App
+        Browser Privacy test.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+        (cleanUpInAppBrowserPrivacyTestSettings):
+        (initializeInAppBrowserPrivacyTestSettings):
+        (TEST):
+
</ins><span class="cx"> 2020-04-07  Timothy Hatcher  <timothy@apple.com>
</span><span class="cx"> 
</span><span class="cx">         WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaInAppBrowserPrivacymm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (259654 => 259655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm       2020-04-07 18:43:30 UTC (rev 259654)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm  2020-04-07 18:43:45 UTC (rev 259655)
</span><span class="lines">@@ -81,11 +81,13 @@
</span><span class="cx"> 
</span><span class="cx"> static void cleanUpInAppBrowserPrivacyTestSettings()
</span><span class="cx"> {
</span><ins>+    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</ins><span class="cx">     IN_APP_BROWSER_PRIVACY_ADDITIONS_2
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void initializeInAppBrowserPrivacyTestSettings()
</span><span class="cx"> {
</span><ins>+    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</ins><span class="cx">     RunLoop::initializeMainRunLoop();
</span><span class="cx">     WebCore::clearApplicationBundleIdentifierTestingOverride();
</span><span class="cx">     IN_APP_BROWSER_PRIVACY_ADDITIONS
</span><span class="lines">@@ -536,7 +538,6 @@
</span><span class="cx"> TEST(InAppBrowserPrivacy, SetCookieForNonAppBoundDomainFails)
</span><span class="cx"> {
</span><span class="cx">     initializeInAppBrowserPrivacyTestSettings();
</span><del>-    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx"> 
</span><span class="cx">     auto dataStore = [WKWebsiteDataStore defaultDataStore];
</span><span class="cx">     auto webView = adoptNS([TestWKWebView new]);
</span><span class="lines">@@ -581,7 +582,6 @@
</span><span class="cx">     TestWebKitAPI::Util::run(&gotFlag);
</span><span class="cx"> 
</span><span class="cx">     cleanUpInAppBrowserPrivacyTestSettings();
</span><del>-    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx">     gotFlag = false;
</span><span class="cx"> 
</span><span class="cx">     // Check the cookie store to make sure only one cookie was set.
</span><span class="lines">@@ -607,7 +607,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Since we can't set non-app-bound cookies with In-App Browser privacy protections on,
</span><span class="cx">     // we can turn the protections off to set a cookie we will then try to get with protections enabled.
</span><del>-    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><ins>+    cleanUpInAppBrowserPrivacyTestSettings();
</ins><span class="cx"> 
</span><span class="cx">     setUpCookieTest();
</span><span class="cx">     globalCookieStore = [[WKWebsiteDataStore defaultDataStore] httpCookieStore];
</span><span class="lines">@@ -658,7 +658,6 @@
</span><span class="cx">     ASSERT_EQ(cookies.count, 2u);
</span><span class="cx"> 
</span><span class="cx">     // Now enable protections and ensure we can only retrieve the app-bound cookies.
</span><del>-    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx">     initializeInAppBrowserPrivacyTestSettings();
</span><span class="cx"> 
</span><span class="cx">     gotFlag = false;
</span><span class="lines">@@ -683,7 +682,6 @@
</span><span class="cx">     gotFlag = false;
</span><span class="cx">     [globalCookieStore deleteCookie:appBoundCookie.get() completionHandler:[]() {
</span><span class="cx">         // Reset flag.
</span><del>-        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx">         cleanUpInAppBrowserPrivacyTestSettings();
</span><span class="cx">         gotFlag = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -695,7 +693,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Since we can't set non-app-bound cookies with In-App Browser privacy protections on,
</span><span class="cx">     // we can turn the protections off to set a cookie we will then try to get with protections enabled.
</span><del>-    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><ins>+    cleanUpInAppBrowserPrivacyTestSettings();
</ins><span class="cx">     setUpCookieTest();
</span><span class="cx"> 
</span><span class="cx">     globalCookieStore = [[WKWebsiteDataStore defaultDataStore] httpCookieStore];
</span><span class="lines">@@ -720,7 +718,6 @@
</span><span class="cx">         [globalCookieStore setCookie:appBoundCookie completionHandler:^{
</span><span class="cx"> 
</span><span class="cx">             // Now enable protections and ensure we can only retrieve the app-bound cookies.
</span><del>-            [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx">             initializeInAppBrowserPrivacyTestSettings();
</span><span class="cx"> 
</span><span class="cx">             [globalCookieStore _getCookiesForURL:[NSURL URLWithString:@"https://webkit.org/"] completionHandler:^(NSArray<NSHTTPCookie *> *cookies) {
</span><span class="lines">@@ -730,7 +727,6 @@
</span><span class="cx">                     EXPECT_EQ(cookies.count, 0u);
</span><span class="cx">                     [globalCookieStore deleteCookie:nonAppBoundCookie completionHandler:^{
</span><span class="cx">                         [globalCookieStore deleteCookie:appBoundCookie completionHandler:^{
</span><del>-                            [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];
</del><span class="cx">                             cleanUpInAppBrowserPrivacyTestSettings();
</span><span class="cx">                             done = true;
</span><span class="cx">                         }];
</span></span></pre>
</div>
</div>

</body>
</html>