Diff
Modified: trunk/LayoutTests/ChangeLog (265017 => 265018)
--- trunk/LayoutTests/ChangeLog 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/LayoutTests/ChangeLog 2020-07-28 23:14:10 UTC (rev 265018)
@@ -1,3 +1,14 @@
+2020-07-28 Kate Cheney <katherine_che...@apple.com>
+
+ Migrate App-Bound Domains code from WebKit Additions
+ https://bugs.webkit.org/show_bug.cgi?id=214889
+ <rdar://problem/66075857>
+
+ Reviewed by Brent Fulgham.
+
+ * platform/ios-wk2/TestExpectations:
+ These tests are now expected to pass.
+
2020-07-28 Karl Rackler <rack...@apple.com>
REGRESSION (r264522): [ macOS wk1 ] imported/w3c/web-platform-tests/css/cssom/stylesheet-same-origin.sub.html is a flaky failure
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (265017 => 265018)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-07-28 23:14:10 UTC (rev 265018)
@@ -1797,3 +1797,5 @@
webkit.org/b/214512 imported/w3c/web-platform-tests/css/geometry/DOMMatrix2DInit-validate-fixup.html [ Pass Failure ]
webkit.org/b/214598 fast/scrolling/ios/autoscroll-input-when-very-zoomed.html [ Pass Failure ]
+
+http/tests/in-app-browser-privacy/ [ Pass ]
Modified: trunk/Source/WebKit/ChangeLog (265017 => 265018)
--- trunk/Source/WebKit/ChangeLog 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/ChangeLog 2020-07-28 23:14:10 UTC (rev 265018)
@@ -1,3 +1,53 @@
+2020-07-28 Kate Cheney <katherine_che...@apple.com>
+
+ Migrate App-Bound Domains code from WebKit Additions
+ https://bugs.webkit.org/show_bug.cgi?id=214889
+ <rdar://problem/66075857>
+
+ Reviewed by Brent Fulgham.
+
+ No new tests, this is just code migration and will be tested
+ by existing App-Bound Domains tests.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::activateSessionCleanup):
+ (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
+ * Shared/Cocoa/DefaultWebBrowserChecks.h: Added.
+ * Shared/Cocoa/DefaultWebBrowserChecks.mm: Added.
+ Holds all functions related to full browser checks and
+ App-Bound Domains.
+
+ (WebKit::shouldBeTreatedAsFullBrowser):
+ (WebKit::getAppBoundDomainsTesting):
+ These functions allow us to treat our test runners as full browsers
+ while triggering non-browser mode for testing other App-Bound Domains
+ functionality.
+
+ (WebKit::isInWebKitChildProcess):
+ (WebKit::hasRequestedCrossWebsiteTrackingPermission):
+ (WebKit::determineITPStateInternal):
+ (WebKit::determineITPState):
+ (WebKit::doesAppHaveITPEnabled):
+ (WebKit::doesParentProcessHaveITPEnabled):
+ (WebKit::hasProhibitedUsageStrings):
+ (WebKit::isParentProcessAFullWebBrowser):
+ (WebKit::isFullWebBrowser):
+ * UIProcess/API/APIHTTPCookieStore.cpp:
+ (API::HTTPCookieStore::filterAppBoundCookies):
+ * UIProcess/API/APIPageConfiguration.cpp:
+ (API::PageConfiguration::PageConfiguration):
+ (): Deleted.
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::WebProcessPool):
+ (WebKit::WebProcessPool::ensureNetworkProcess):
+ (WebKit::WebProcessPool::createNewWebProcess):
+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+ (WebKit::WebsiteDataStore::addTestDomains const):
+ (WebKit::WebsiteDataStore::ensureAppBoundDomains const):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ * WebKit.xcodeproj/project.pbxproj:
+
2020-07-28 Tim Horton <timothy_hor...@apple.com>
Web Share API Level 2: Can only perform one share action per share sheet invocation
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (265017 => 265018)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2020-07-28 23:14:10 UTC (rev 265018)
@@ -29,6 +29,7 @@
#import "AuthenticationChallengeDisposition.h"
#import "AuthenticationManager.h"
#import "DataReference.h"
+#import "DefaultWebBrowserChecks.h"
#import "Download.h"
#import "LegacyCustomProtocolManager.h"
#import "Logging.h"
@@ -63,7 +64,6 @@
#import <WebKitAdditions/NetworkSessionCocoaAdditions.h>
#else
#define NETWORK_SESSION_COCOA_ADDITIONS_1
-#define NETWORK_SESSION_COCOA_ADDITIONS_2 true
#endif
#import "DeviceManagementSoftLink.h"
@@ -1152,6 +1152,29 @@
session = [NSURLSession sessionWithConfiguration:configuration delegate:delegate.get() delegateQueue:[NSOperationQueue mainQueue]];
}
+#if HAVE(SESSION_CLEANUP)
+static void activateSessionCleanup(NetworkSessionCocoa& session, const NetworkSessionCreationParameters& parameters)
+{
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
+ // Don't override an explicitly set value.
+ if (parameters.resourceLoadStatisticsParameters.isItpStateExplicitlySet)
+ return;
+
+#if !PLATFORM(IOS_FAMILY_SIMULATOR)
+ auto parentAuditToken = session.networkProcess().parentProcessConnection()->getAuditToken();
+ RELEASE_ASSERT(parentAuditToken); // This should be impossible.
+
+ bool itpEnabled = doesParentProcessHaveITPEnabled(parentAuditToken);
+ bool passedEnabledState = session.isResourceLoadStatisticsEnabled();
+
+ if (itpEnabled != passedEnabledState)
+ WTFLogAlways("Passed ITP enabled state (%d) does not match TCC setting (%d)\n", itpEnabled, passedEnabledState);
+ session.setResourceLoadStatisticsEnabled(passedEnabledState);
+#endif
+#endif
+}
+#endif
+
NetworkSessionCocoa::NetworkSessionCocoa(NetworkProcess& networkProcess, NetworkSessionCreationParameters&& parameters)
: NetworkSession(networkProcess, parameters)
, m_boundInterfaceIdentifier(parameters.boundInterfaceIdentifier)
@@ -1292,7 +1315,7 @@
SessionWrapper& NetworkSessionCocoa::sessionWrapperForTask(const WebCore::ResourceRequest& request, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
{
auto shouldBeConsideredAppBound = isNavigatingToAppBoundDomain ? *isNavigatingToAppBoundDomain : NavigatingToAppBoundDomain::Yes;
- if (NETWORK_SESSION_COCOA_ADDITIONS_2)
+ if (isParentProcessAFullWebBrowser(networkProcess().parentProcessConnection()->getAuditToken()))
shouldBeConsideredAppBound = NavigatingToAppBoundDomain::No;
#if ENABLE(RESOURCE_LOAD_STATISTICS)
if (auto* storageSession = networkStorageSession()) {
Added: trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.h (0 => 265018)
--- trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.h (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.h 2020-07-28 23:14:10 UTC (rev 265018)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/spi/darwin/XPCSPI.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+class RegistrableDomain;
+}
+
+namespace WebKit {
+
+bool hasProhibitedUsageStrings();
+Optional<Vector<WebCore::RegistrableDomain>> getAppBoundDomainsTesting(const String&);
+bool shouldBeTreatedAsFullBrowser(const String& bundleID);
+void determineITPState();
+bool doesAppHaveITPEnabled();
+bool doesParentProcessHaveITPEnabled(Optional<audit_token_t>);
+bool isFullWebBrowser();
+bool isParentProcessAFullWebBrowser(Optional<audit_token_t>);
+
+} // namespace WebKit
Added: trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm (0 => 265018)
--- trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm 2020-07-28 23:14:10 UTC (rev 265018)
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "DefaultWebBrowserChecks.h"
+
+#import "TCCSPI.h"
+#import "VersionChecks.h"
+#import <WebCore/RegistrableDomain.h>
+#import <WebCore/RuntimeApplicationChecks.h>
+#import <wtf/HashMap.h>
+#import <wtf/RunLoop.h>
+#import <wtf/SoftLinking.h>
+#import <wtf/cocoa/Entitlements.h>
+#import <wtf/text/StringHash.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK(TCC)
+SOFT_LINK(TCC, TCCAccessPreflight, TCCAccessPreflightResult, (CFStringRef service, CFDictionaryRef options), (service, options))
+SOFT_LINK(TCC, TCCAccessPreflightWithAuditToken, TCCAccessPreflightResult, (CFStringRef service, audit_token_t token, CFDictionaryRef options), (service, token, options))
+SOFT_LINK_CONSTANT(TCC, kTCCServiceWebKitIntelligentTrackingPrevention, CFStringRef)
+
+
+namespace WebKit {
+
+static bool isFullWebBrowser(const String&);
+
+bool shouldBeTreatedAsFullBrowser(const String& bundleID)
+{
+ return bundleID == "com.apple.WebKit.TestWebKitAPI"_s || bundleID == "com.apple.WebKit.WebKitTestRunner"_s;
+}
+
+Optional<Vector<WebCore::RegistrableDomain>> getAppBoundDomainsTesting(const String& bundleID)
+{
+ if (bundleID.isNull())
+ return WTF::nullopt;
+
+ static auto appBoundDomainList = makeNeverDestroyed(HashMap<String, Vector<WebCore::RegistrableDomain>> {
+ {"inAppBrowserPrivacyTestIdentifier"_s, Vector<WebCore::RegistrableDomain> { WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString("127.0.0.1") }},
+ });
+
+ auto appBoundDomainIter = appBoundDomainList->find(bundleID);
+ if (appBoundDomainIter != appBoundDomainList->end())
+ return appBoundDomainIter->value;
+
+ return WTF::nullopt;
+}
+
+#if ASSERT_ENABLED
+static bool isInWebKitChildProcess()
+{
+ static bool isInSubProcess;
+
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+ isInSubProcess = [bundleIdentifier hasPrefix:@"com.apple.WebKit.WebContent"]
+ || [bundleIdentifier hasPrefix:@"com.apple.WebKit.Networking"]
+ || [bundleIdentifier hasPrefix:@"com.apple.WebKit.GPU"];
+ });
+
+ return isInSubProcess;
+}
+#endif
+
+enum class ITPState : uint8_t {
+ Uninitialized,
+ Initializing,
+ Enabled,
+ Disabled
+};
+
+static std::atomic<ITPState> g_currentITPState = ITPState::Uninitialized;
+
+static bool hasRequestedCrossWebsiteTrackingPermission()
+{
+ ASSERT(!isInWebKitChildProcess());
+
+ static std::atomic<bool> hasRequestedCrossWebsiteTrackingPermission = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSCrossWebsiteTrackingUsageDescription"];
+ return hasRequestedCrossWebsiteTrackingPermission;
+}
+
+static bool determineITPStateInternal(bool appWasLinkedOnOrAfter, const String& bundleIdentifier)
+{
+ ASSERT(!RunLoop::isMain());
+ ASSERT(!isInWebKitChildProcess());
+
+ if (!appWasLinkedOnOrAfter)
+ return false;
+
+ if (!isFullWebBrowser(bundleIdentifier) && !hasRequestedCrossWebsiteTrackingPermission())
+ return true;
+
+ TCCAccessPreflightResult result = kTCCAccessPreflightDenied;
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
+ result = TCCAccessPreflight(getkTCCServiceWebKitIntelligentTrackingPrevention(), nullptr);
+#endif
+ return result != kTCCAccessPreflightDenied;
+}
+
+static dispatch_queue_t g_itpQueue;
+
+void determineITPState()
+{
+ ASSERT(RunLoop::isMain());
+ if (g_currentITPState != ITPState::Uninitialized)
+ return;
+
+ g_currentITPState = ITPState::Initializing;
+ bool appWasLinkedOnOrAfter = linkedOnOrAfter(SDKVersion::FirstWithSessionCleanupByDefault, AssumeSafariIsAlwaysLinkedOnAfter::Yes);
+
+ g_itpQueue = dispatch_queue_create("com.apple.WebKit.itpCheckQueue", NULL);
+
+ dispatch_async(g_itpQueue, [appWasLinkedOnOrAfter, bundleIdentifier = WebCore::applicationBundleIdentifier().isolatedCopy()] {
+ g_currentITPState = determineITPStateInternal(appWasLinkedOnOrAfter, bundleIdentifier) ? ITPState::Enabled : ITPState::Disabled;
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ dispatch_release(g_itpQueue);
+ g_itpQueue = nullptr;
+ });
+ });
+}
+
+bool doesAppHaveITPEnabled()
+{
+ ASSERT(!isInWebKitChildProcess());
+ ASSERT(RunLoop::isMain());
+ if (g_currentITPState > ITPState::Initializing)
+ return g_currentITPState == ITPState::Enabled;
+
+ RELEASE_ASSERT(g_itpQueue);
+
+ __block bool isITPEnabled;
+ dispatch_sync(g_itpQueue, ^{
+ isITPEnabled = g_currentITPState == ITPState::Enabled;
+ });
+ return isITPEnabled;
+}
+
+bool doesParentProcessHaveITPEnabled(Optional<audit_token_t> auditToken)
+{
+ ASSERT(isInWebKitChildProcess());
+ ASSERT(RunLoop::isMain());
+
+ if (!isParentProcessAFullWebBrowser(auditToken))
+ return true;
+
+ TCCAccessPreflightResult result = kTCCAccessPreflightDenied;
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
+ if (auditToken)
+ result = TCCAccessPreflightWithAuditToken(getkTCCServiceWebKitIntelligentTrackingPrevention(), auditToken.value(), nullptr);
+#endif
+ return result != kTCCAccessPreflightDenied;
+}
+
+static std::atomic<bool> hasCheckedUsageStrings = false;
+bool hasProhibitedUsageStrings()
+{
+ ASSERT(!isInWebKitChildProcess());
+
+ static bool hasProhibitedUsageStrings = false;
+
+ if (hasCheckedUsageStrings)
+ return hasProhibitedUsageStrings;
+
+ NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
+ RELEASE_ASSERT(infoDictionary);
+
+ // See <rdar://problem/59979468> for details about how this list was selected.
+ auto prohibitedStrings = @[
+ @"NSHomeKitUsageDescription",
+ @"NSBluetoothAlwaysUsageDescription",
+ @"NSPhotoLibraryUsageDescription",
+ @"NSHealthShareUsageDescription",
+ @"NSHealthUpdateUsageDescription",
+ @"NSLocationAlwaysUsageDescription",
+ @"NSLocationAlwaysAndWhenInUseUsageDescription"
+ ];
+
+ for (NSString *prohibitedString : prohibitedStrings) {
+ if ([infoDictionary objectForKey:prohibitedString]) {
+ String message = [NSString stringWithFormat:@"[In-App Browser Privacy] %@ used prohibited usage string %@.", [[NSBundle mainBundle] bundleIdentifier], prohibitedString];
+ WTFLogAlways(message.utf8().data());
+ hasProhibitedUsageStrings = true;
+ break;
+ }
+ }
+ hasCheckedUsageStrings = true;
+ return hasProhibitedUsageStrings;
+}
+
+bool isParentProcessAFullWebBrowser(Optional<audit_token_t> auditToken)
+{
+ ASSERT(isInWebKitChildProcess());
+ RELEASE_ASSERT(auditToken);
+
+ static bool fullWebBrowser;
+
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ fullWebBrowser = WTF::hasEntitlement(auditToken.value(), "com.apple.developer.web-browser");
+ });
+
+ return fullWebBrowser || shouldBeTreatedAsFullBrowser(WebCore::applicationBundleIdentifier());
+}
+
+static bool isFullWebBrowser(const String& bundleIdentifier)
+{
+ ASSERT(!isInWebKitChildProcess());
+
+ static bool fullWebBrowser = WTF::processHasEntitlement("com.apple.developer.web-browser");
+
+ return fullWebBrowser || shouldBeTreatedAsFullBrowser(bundleIdentifier);
+}
+
+bool isFullWebBrowser()
+{
+ ASSERT(!isInWebKitChildProcess());
+ ASSERT(RunLoop::isMain());
+
+ return isFullWebBrowser(WebCore::applicationBundleIdentifier());
+}
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp 2020-07-28 23:14:10 UTC (rev 265018)
@@ -26,6 +26,10 @@
#include "config.h"
#include "APIHTTPCookieStore.h"
+#if PLATFORM(IOS_FAMILY)
+#include "DefaultWebBrowserChecks.h"
+#endif
+
#include "WebCookieManagerProxy.h"
#include "WebProcessPool.h"
#include "WebsiteDataStore.h"
@@ -35,12 +39,6 @@
#include <WebCore/HTTPCookieAcceptPolicy.h>
#include <WebCore/NetworkStorageSession.h>
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/HTTPCookieStoreAdditions.h>
-#else
-#define IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED false
-#endif
-
using namespace WebKit;
namespace API {
@@ -66,7 +64,7 @@
Vector<WebCore::Cookie> appBoundCookies;
#if PLATFORM(IOS_FAMILY)
m_owningDataStore->getAppBoundDomains([cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable {
- if (!domains.isEmpty() && IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED) {
+ if (!domains.isEmpty() && !isFullWebBrowser()) {
for (auto& cookie : cookies) {
if (domains.contains(WebCore::RegistrableDomain::uncheckedCreateFromHost(cookie.domain)))
appBoundCookies.append(cookie);
Modified: trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp 2020-07-28 23:14:10 UTC (rev 265018)
@@ -35,12 +35,6 @@
#include "WebURLSchemeHandler.h"
#include "WebUserContentControllerProxy.h"
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/PageConfigurationAdditions.h>
-#else
-#define PAGE_CONFIGURATION_ADDITIONS
-#endif
-
#if ENABLE(APPLICATION_MANIFEST)
#include "APIApplicationManifest.h"
#endif
@@ -54,7 +48,6 @@
}
PageConfiguration::PageConfiguration()
-PAGE_CONFIGURATION_ADDITIONS
{
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-07-28 23:14:10 UTC (rev 265018)
@@ -288,14 +288,9 @@
#include "MediaUsageManager.h"
#endif
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/WebPageProxyAdditions.h>
-#else
-static bool isFullWebBrowser() { return true; }
-#if PLATFORM(IOS_FAMILY)
-static bool hasProhibitedUsageStrings() { return false; }
+#if PLATFORM(COCOA)
+#include "DefaultWebBrowserChecks.h"
#endif
-#endif
// This controls what strategy we use for mouse wheel coalescing.
#define MERGE_WHEEL_EVENTS 1
@@ -1396,8 +1391,10 @@
{
RELEASE_LOG_IF_ALLOWED(Loading, "loadData:");
+#if PLATFORM(IOS_FAMILY)
if (MIMEType == "text/html"_s && !isFullWebBrowser())
m_limitsNavigationsToAppBoundDomains = true;
+#endif
if (m_isClosed) {
RELEASE_LOG_IF_ALLOWED(Loading, "loadData: page is closed");
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2020-07-28 23:14:10 UTC (rev 265018)
@@ -126,6 +126,7 @@
#endif
#if PLATFORM(COCOA)
+#include "DefaultWebBrowserChecks.h"
#include "VersionChecks.h"
#include <WebCore/GameControllerGamepadProvider.h>
#include <WebCore/HIDGamepadProvider.h>
@@ -141,15 +142,6 @@
#include <wtf/RefCountedLeakCounter.h>
#endif
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/WebProcessPoolAdditions.h>
-#else
-#define WEB_PROCESS_POOL_ADDITIONS
-#define WEB_PROCESS_POOL_ADDITIONS_2
-#define WEB_PROCESS_POOL_ADDITIONS_3
-#define WEB_PROCESS_POOL_ADDITIONS_4
-#endif
-
#define WEBPROCESSPOOL_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
#define WEBPROCESSPOOL_RELEASE_LOG_ERROR(channel, fmt, ...) RELEASE_LOG_ERROR(channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
#define WEBPROCESSPOOL_RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), channel, "%p - WebProcessPool::" fmt, this, ##__VA_ARGS__)
@@ -255,7 +247,6 @@
#endif
, m_alwaysRunsAtBackgroundPriority(m_configuration->alwaysRunsAtBackgroundPriority())
, m_shouldTakeUIBackgroundAssertion(m_configuration->shouldTakeUIBackgroundAssertion())
- WEB_PROCESS_POOL_ADDITIONS
, m_userObservablePageCounter([this](RefCounterEvent) { updateProcessSuppressionState(); })
, m_processSuppressionDisabledForPageCounter([this](RefCounterEvent) { updateProcessSuppressionState(); })
, m_hiddenPageThrottlingAutoIncreasesCounter([this](RefCounterEvent) { m_hiddenPageThrottlingTimer.startOneShot(0_s); })
@@ -271,7 +262,9 @@
WTF::setProcessPrivileges(allPrivileges());
WebCore::NetworkStorageSession::permitProcessToUseCookieAPI(true);
Process::setIdentifier(WebCore::ProcessIdentifier::generate());
- WEB_PROCESS_POOL_ADDITIONS_4
+#if PLATFORM(COCOA)
+ determineITPState();
+#endif
});
if (!m_websiteDataStore && WebKit::WebsiteDataStore::defaultDataStoreExists())
@@ -613,7 +606,22 @@
WebCore::RegistrableDomain standaloneApplicationDomain;
HashSet<WebCore::RegistrableDomain> appBoundDomains;
WebCore::RegistrableDomain manualPrevalentResource;
- WEB_PROCESS_POOL_ADDITIONS_2
+
+#if PLATFORM(COCOA)
+ m_tccPreferenceEnabled = doesAppHaveITPEnabled();
+ if (withWebsiteDataStore && !withWebsiteDataStore->isItpStateExplicitlySet()) {
+ enableResourceLoadStatistics = m_tccPreferenceEnabled;
+ withWebsiteDataStore->setResourceLoadStatisticsEnabled(enableResourceLoadStatistics);
+ } else if (m_websiteDataStore && !m_websiteDataStore->isItpStateExplicitlySet()) {
+ enableResourceLoadStatistics = m_tccPreferenceEnabled;
+ m_websiteDataStore->setResourceLoadStatisticsEnabled(enableResourceLoadStatistics);
+ } else if (WebsiteDataStore::defaultDataStoreExists() && !WebsiteDataStore::defaultDataStore()->isItpStateExplicitlySet()) {
+ enableResourceLoadStatistics = m_tccPreferenceEnabled;
+ WebsiteDataStore::defaultDataStore()->setResourceLoadStatisticsEnabled(enableResourceLoadStatistics);
+ } else
+ enableResourceLoadStatistics = m_tccPreferenceEnabled;
+#endif
+
if (withWebsiteDataStore) {
enableResourceLoadStatistics = withWebsiteDataStore->resourceLoadStatisticsEnabled();
#if ENABLE(RESOURCE_LOAD_STATISTICS)
@@ -884,7 +892,12 @@
WebProcessProxy& WebProcessPool::createNewWebProcess(WebsiteDataStore* websiteDataStore, WebProcessProxy::IsPrewarmed isPrewarmed)
{
- WEB_PROCESS_POOL_ADDITIONS_3
+#if PLATFORM(COCOA)
+ m_tccPreferenceEnabled = doesAppHaveITPEnabled();
+ if (websiteDataStore && !websiteDataStore->isItpStateExplicitlySet())
+ websiteDataStore->setResourceLoadStatisticsEnabled(m_tccPreferenceEnabled);
+#endif
+
auto processProxy = WebProcessProxy::create(*this, websiteDataStore, isPrewarmed);
auto& process = processProxy.get();
initializeNewWebProcess(process, websiteDataStore, isPrewarmed);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2020-07-28 23:14:10 UTC (rev 265018)
@@ -27,6 +27,7 @@
#import "WebsiteDataStore.h"
#import "CookieStorageUtilsCF.h"
+#import "DefaultWebBrowserChecks.h"
#import "SandboxUtilities.h"
#import "StorageManager.h"
#import "WebFramePolicyListenerProxy.h"
@@ -45,12 +46,6 @@
#import <wtf/URL.h>
#import <wtf/text/StringBuilder.h>
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WebsiteDataStoreAdditions.h>
-#else
-#define WEBSITE_DATA_STORE_ADDITIONS
-#endif
-
#if PLATFORM(IOS_FAMILY)
#import <UIKit/UIApplication.h>
#import <pal/ios/ManagedConfigurationSoftLink.h>
@@ -463,11 +458,23 @@
});
}
+void WebsiteDataStore::addTestDomains() const
+{
+ if (appBoundDomains().isEmpty()) {
+ auto bundleID = WebCore::applicationBundleIdentifier();
+ auto appBoundDomainsTesting = getAppBoundDomainsTesting(bundleID);
+ if (appBoundDomainsTesting) {
+ for (auto& domain : *appBoundDomainsTesting)
+ appBoundDomains().add(domain);
+ }
+ }
+}
+
void WebsiteDataStore::ensureAppBoundDomains(CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&, const HashSet<String>&)>&& completionHandler) const
{
if (hasInitializedAppBoundDomains) {
if (m_isInAppBrowserPrivacyTestModeEnabled) {
- WEBSITE_DATA_STORE_ADDITIONS;
+ addTestDomains();
}
completionHandler(appBoundDomains(), appBoundSchemes());
return;
@@ -479,7 +486,7 @@
RunLoop::main().dispatch([this, protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)] () mutable {
ASSERT(hasInitializedAppBoundDomains);
if (m_isInAppBrowserPrivacyTestModeEnabled) {
- WEBSITE_DATA_STORE_ADDITIONS;
+ addTestDomains();
}
completionHandler(appBoundDomains(), appBoundSchemes());
});
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (265017 => 265018)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2020-07-28 23:14:10 UTC (rev 265018)
@@ -312,6 +312,7 @@
private:
enum class ForceReinitialization : bool { No, Yes };
void initializeAppBoundDomains(ForceReinitialization = ForceReinitialization::No);
+ void addTestDomains() const;
void fetchDataAndApply(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, RefPtr<WorkQueue>&&, Function<void(Vector<WebsiteDataRecord>)>&& apply);
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (265017 => 265018)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-07-28 23:14:10 UTC (rev 265018)
@@ -963,6 +963,7 @@
49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */; };
49BCA19523A18CFD0028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */; };
49BCA19723A1930D0028A836 /* APIResourceLoadStatisticsThirdParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */; };
+ 49DAA38C24CBA1A800793D75 /* DefaultWebBrowserChecks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49DAA38B24CBA1A800793D75 /* DefaultWebBrowserChecks.mm */; };
49ECA41C23FCA5D80023358D /* PolicyDecision.h in Headers */ = {isa = PBXBuildFile; fileRef = 49ECA41B23FCA4860023358D /* PolicyDecision.h */; };
49FBEFFD239B011D00BD032F /* _WKResourceLoadStatisticsFirstParty.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FBEFFC239B011D00BD032F /* _WKResourceLoadStatisticsFirstParty.mm */; };
49FBEFFF239B012F00BD032F /* _WKResourceLoadStatisticsThirdParty.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FBEFFE239B012F00BD032F /* _WKResourceLoadStatisticsThirdParty.mm */; };
@@ -3586,6 +3587,8 @@
49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsFirstPartyInternal.h; sourceTree = "<group>"; };
49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsFirstParty.h; sourceTree = "<group>"; };
49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsThirdParty.h; sourceTree = "<group>"; };
+ 49DAA38B24CBA1A800793D75 /* DefaultWebBrowserChecks.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DefaultWebBrowserChecks.mm; sourceTree = "<group>"; };
+ 49DAA38D24CBA1BD00793D75 /* DefaultWebBrowserChecks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DefaultWebBrowserChecks.h; sourceTree = "<group>"; };
49ECA41B23FCA4860023358D /* PolicyDecision.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PolicyDecision.h; sourceTree = "<group>"; };
49FBEFFA239AD97800BD032F /* _WKResourceLoadStatisticsThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsThirdParty.h; sourceTree = "<group>"; };
49FBEFFB239ADB1800BD032F /* _WKResourceLoadStatisticsFirstParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsFirstParty.h; sourceTree = "<group>"; };
@@ -7483,6 +7486,8 @@
1C739E852347BCF600C621EC /* CoreTextHelpers.mm */,
C55F916C1C595E440029E92D /* DataDetectionResult.h */,
C55F916D1C595E440029E92D /* DataDetectionResult.mm */,
+ 49DAA38D24CBA1BD00793D75 /* DefaultWebBrowserChecks.h */,
+ 49DAA38B24CBA1A800793D75 /* DefaultWebBrowserChecks.mm */,
CE550E132283744400D28791 /* InsertTextOptions.cpp */,
CE550E12228373C800D28791 /* InsertTextOptions.h */,
C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */,
@@ -12730,6 +12735,7 @@
2D92A77D212B6A7100F493FD /* Connection.cpp in Sources */,
2D92A77E212B6A7100F493FD /* DataReference.cpp in Sources */,
2D92A77F212B6A7100F493FD /* Decoder.cpp in Sources */,
+ 49DAA38C24CBA1A800793D75 /* DefaultWebBrowserChecks.mm in Sources */,
2D0C56FE229F1DEA00BD33E7 /* DeviceManagementSoftLink.mm in Sources */,
1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */,
1A64229912DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp in Sources */,
Modified: trunk/Tools/ChangeLog (265017 => 265018)
--- trunk/Tools/ChangeLog 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Tools/ChangeLog 2020-07-28 23:14:10 UTC (rev 265018)
@@ -1,3 +1,20 @@
+2020-07-28 Kate Cheney <katherine_che...@apple.com>
+
+ Migrate App-Bound Domains code from WebKit Additions
+ https://bugs.webkit.org/show_bug.cgi?id=214889
+ <rdar://problem/66075857>
+
+ Reviewed by Brent Fulgham.
+
+ Replace WebKit Additions macros with code to set a different bundle
+ identifier indicating that we want to run an App-Bound Domains test.
+
+ Remove #if USE(APPLE_INTERNAL_SDK) check so we run these tests on EWS.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+ (cleanUpInAppBrowserPrivacyTestSettings):
+ (initializeInAppBrowserPrivacyTestSettings):
+
2020-07-28 Aakash Jain <aakash_j...@apple.com>
[ews] Add macOS Big Sur support in PrintConfiguration
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (265017 => 265018)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2020-07-28 23:04:21 UTC (rev 265017)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2020-07-28 23:14:10 UTC (rev 265018)
@@ -45,9 +45,6 @@
#if PLATFORM(IOS_FAMILY)
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/InAppBrowserPrivacyTestAdditions.h>
-
static bool isDone;
@interface AppBoundDomainDelegate : NSObject <WKNavigationDelegate>
@@ -131,7 +128,7 @@
static void cleanUpInAppBrowserPrivacyTestSettings()
{
WebCore::clearApplicationBundleIdentifierTestingOverride();
- IN_APP_BROWSER_PRIVACY_ADDITIONS_2
+ WebCore::setApplicationBundleIdentifier("com.apple.WebKit.TestWebKitAPI");
}
static void initializeInAppBrowserPrivacyTestSettings()
@@ -138,7 +135,7 @@
{
WTF::initializeMainThread();
WebCore::clearApplicationBundleIdentifierTestingOverride();
- IN_APP_BROWSER_PRIVACY_ADDITIONS
+ WebCore::setApplicationBundleIdentifier("inAppBrowserPrivacyTestIdentifier");
}
TEST(InAppBrowserPrivacy, NonAppBoundDomainFailedUserScriptAtStart)
@@ -1338,6 +1335,4 @@
TestWebKitAPI::Util::run(&isDone);
}
-#endif // USE(APPLE_INTERNAL_SDK)
-
#endif // PLATFORM(IOS_FAMILY)