Diff
Modified: trunk/Source/WebKit/ChangeLog (278474 => 278475)
--- trunk/Source/WebKit/ChangeLog 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/ChangeLog 2021-06-04 18:02:04 UTC (rev 278475)
@@ -1,3 +1,89 @@
+2021-06-04 Alex Christensen <[email protected]>
+
+ Make attributedBundleIdendifier a property for WKWebViewConfiguration instead of _WKWebsiteDataStoreConfiguration
+ https://bugs.webkit.org/show_bug.cgi?id=226548
+ <rdar://78737547>
+
+ Reviewed by Brady Eidson.
+
+ We have been putting properties to go into the NSURLSessionConfiguration on the _WKWebsiteDataStoreConfiguration.
+ This has been ok so far, but now we have an application that needs to run networking attributed to different applications
+ but sharing the data storage in the same process. We now do what we should've done long ago: put these non-storage-related
+ properties on the WKWebViewConfiguration.
+
+ I introduce WebPageNetworkParameters which currently has only one member, but will soon have more.
+
+ I made it so that if multiple WKWebViews with the same data store have the same attributedBundleIdendifier, they share an NSURLSession.
+ Otherwise, they get their own NSURLSession in a different SessionSet.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::addWebPageNetworkParameters):
+ (WebKit::NetworkProcess::removeWebPageNetworkParameters):
+ (WebKit::NetworkProcess::countNonDefaultSessionSets):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * NetworkProcess/NetworkSession.h:
+ (WebKit::NetworkSession::addWebPageNetworkParameters):
+ (WebKit::NetworkSession::removeWebPageNetworkParameters):
+ (WebKit::NetworkSession::countNonDefaultSessionSets const):
+ * NetworkProcess/NetworkSessionCreationParameters.cpp:
+ (WebKit::NetworkSessionCreationParameters::encode const):
+ (WebKit::NetworkSessionCreationParameters::decode):
+ * NetworkProcess/NetworkSessionCreationParameters.h:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.h:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+ (WebKit::NetworkSessionCocoa::initializeNSURLSessionsInSet):
+ (WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded):
+ (WebKit::NetworkSessionCocoa::addWebPageNetworkParameters):
+ (WebKit::NetworkSessionCocoa::removeWebPageNetworkParameters):
+ (WebKit::NetworkSessionCocoa::countNonDefaultSessionSets const):
+ (WebKit::NetworkSessionCocoa::attributedBundleIdentifier const): Deleted.
+ (WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet): Deleted.
+ * Shared/WebPageNetworkParameters.cpp: Added.
+ (WebKit::WebPageNetworkParameters::encode const):
+ (WebKit::WebPageNetworkParameters::decode):
+ * Shared/WebPageNetworkParameters.h: Added.
+ (WebKit::WebPageNetworkParameters::WebPageNetworkParameters):
+ (WebKit::WebPageNetworkParameters::isHashTableDeletedValue const):
+ (WebKit::WebPageNetworkParameters::hash const):
+ (WebKit::WebPageNetworkParameters::operator== const):
+ (WebKit::WebPageNetworkParameters::attributedBundleIdentifier const):
+ (WTF::DefaultHash<WebKit::WebPageNetworkParameters>::hash):
+ (WTF::DefaultHash<WebKit::WebPageNetworkParameters>::equal):
+ * Sources.txt:
+ * UIProcess/API/APIPageConfiguration.cpp:
+ (API::PageConfiguration::copy const):
+ * UIProcess/API/APIPageConfiguration.h:
+ (API::PageConfiguration::setAttributedBundleIdentifier):
+ (API::PageConfiguration::attributedBundleIdentifier const):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration _setAttributedBundleIdentifier:]):
+ (-[WKWebViewConfiguration _attributedBundleIdentifier]):
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+ (-[WKWebsiteDataStore _countNonDefaultSessionSets:]):
+ * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+ * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
+ * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
+ (-[_WKWebsiteDataStoreConfiguration setAttributedBundleIdentifier:]): Deleted.
+ (-[_WKWebsiteDataStoreConfiguration attributedBundleIdentifier]): Deleted.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::~WebPageProxy):
+ (WebKit::WebPageProxy::initializeWebPage):
+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+ (WebKit::WebsiteDataStore::platformSetNetworkParameters):
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::countNonDefaultSessionSets):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
+ (WebKit::WebsiteDataStoreConfiguration::copy const):
+ * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
+ (WebKit::WebsiteDataStoreConfiguration::setSourceApplicationSecondaryIdentifier):
+ (WebKit::WebsiteDataStoreConfiguration::attributedBundleIdentifier const): Deleted.
+ (WebKit::WebsiteDataStoreConfiguration::setAttributedBundleIdentifier): Deleted.
+ * WebKit.xcodeproj/project.pbxproj:
+
2021-06-04 Chris Dumez <[email protected]>
Avoid wasteful large allocation in SpeechRecognitionRemoteRealtimeMediaSource::setStorage()
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -2794,4 +2794,31 @@
}
#endif
+void NetworkProcess::addWebPageNetworkParameters(const PAL::SessionID& sessionID, WebPageProxyIdentifier pageID, WebPageNetworkParameters&& parameters)
+{
+ auto session = networkSession(sessionID);
+ if (!session)
+ return;
+
+ session->addWebPageNetworkParameters(pageID, WTFMove(parameters));
+}
+
+void NetworkProcess::removeWebPageNetworkParameters(const PAL::SessionID& sessionID, WebPageProxyIdentifier pageID)
+{
+ auto session = networkSession(sessionID);
+ if (!session)
+ return;
+
+ session->removeWebPageNetworkParameters(pageID);
+}
+
+void NetworkProcess::countNonDefaultSessionSets(const PAL::SessionID& sessionID, CompletionHandler<void(size_t)>&& completionHandler)
+{
+ auto session = networkSession(sessionID);
+ if (!session)
+ return completionHandler(0);
+
+ completionHandler(session->countNonDefaultSessionSets());
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -106,6 +106,7 @@
class NetworkProximityManager;
class NetworkResourceLoader;
class StorageManagerSet;
+class WebPageNetworkParameters;
class WebSWServerConnection;
class WebSWServerToContextConnection;
enum class CallDownloadDidStart : bool;
@@ -452,6 +453,10 @@
void flushCookies(const PAL::SessionID&, CompletionHandler<void()>&&);
+ void addWebPageNetworkParameters(const PAL::SessionID&, WebPageProxyIdentifier, WebPageNetworkParameters&&);
+ void removeWebPageNetworkParameters(const PAL::SessionID&, WebPageProxyIdentifier);
+ void countNonDefaultSessionSets(const PAL::SessionID&, CompletionHandler<void(size_t)>&&);
+
#if USE(SOUP)
void setIgnoreTLSErrors(PAL::SessionID, bool);
void userPreferredLanguagesChanged(const Vector<String>&);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2021-06-04 18:02:04 UTC (rev 278475)
@@ -196,4 +196,8 @@
AppBoundNavigationData(PAL::SessionID sessionID) -> (struct WebKit::AppBoundNavigationTestingData data) Async
ClearAppBoundNavigationData(PAL::SessionID sessionID) -> () Async
#endif
+
+ AddWebPageNetworkParameters(PAL::SessionID sessionID, WebKit::WebPageProxyIdentifier pageID, WebKit::WebPageNetworkParameters parameters)
+ RemoveWebPageNetworkParameters(PAL::SessionID sessionID, WebKit::WebPageProxyIdentifier pageID)
+ CountNonDefaultSessionSets(PAL::SessionID sessionID) -> (size_t count) Async
}
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -59,6 +59,7 @@
class NetworkProcess;
class NetworkResourceLoader;
class NetworkSocketChannel;
+class WebPageNetworkParameters;
class WebResourceLoadStatisticsStore;
class WebSocketTask;
struct NetworkSessionCreationParameters;
@@ -168,6 +169,10 @@
virtual void removeNetworkWebsiteData(std::optional<WallTime>, std::optional<HashSet<WebCore::RegistrableDomain>>&&, CompletionHandler<void()>&& completionHandler) { completionHandler(); }
+ virtual void addWebPageNetworkParameters(WebPageProxyIdentifier, WebPageNetworkParameters&&) { }
+ virtual void removeWebPageNetworkParameters(WebPageProxyIdentifier) { }
+ virtual size_t countNonDefaultSessionSets() const { return 0; }
+
protected:
NetworkSession(NetworkProcess&, const NetworkSessionCreationParameters&);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -47,7 +47,6 @@
encoder << proxyConfiguration;
encoder << sourceApplicationBundleIdentifier;
encoder << sourceApplicationSecondaryIdentifier;
- encoder << attributedBundleIdentifier;
encoder << shouldLogCookieInformation;
encoder << httpProxy;
encoder << httpsProxy;
@@ -120,11 +119,6 @@
decoder >> sourceApplicationSecondaryIdentifier;
if (!sourceApplicationSecondaryIdentifier)
return std::nullopt;
-
- std::optional<String> attributedBundleIdentifier;
- decoder >> attributedBundleIdentifier;
- if (!attributedBundleIdentifier)
- return std::nullopt;
std::optional<bool> shouldLogCookieInformation;
decoder >> shouldLogCookieInformation;
@@ -301,7 +295,6 @@
, WTFMove(proxyConfiguration)
, WTFMove(*sourceApplicationBundleIdentifier)
, WTFMove(*sourceApplicationSecondaryIdentifier)
- , WTFMove(*attributedBundleIdentifier)
, WTFMove(*shouldLogCookieInformation)
, WTFMove(*httpProxy)
, WTFMove(*httpsProxy)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -60,7 +60,6 @@
RetainPtr<CFDictionaryRef> proxyConfiguration;
String sourceApplicationBundleIdentifier;
String sourceApplicationSecondaryIdentifier;
- String attributedBundleIdentifier;
bool shouldLogCookieInformation { false };
URL httpProxy;
URL httpsProxy;
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -38,6 +38,7 @@
#include "DownloadID.h"
#include "NetworkDataTaskCocoa.h"
#include "NetworkSession.h"
+#include "WebPageNetworkParameters.h"
#include "WebPageProxyIdentifier.h"
#include "WebSocketTask.h"
#include <WebCore/NetworkLoadMetrics.h>
@@ -75,7 +76,6 @@
const String& boundInterfaceIdentifier() const;
const String& sourceApplicationBundleIdentifier() const;
const String& sourceApplicationSecondaryIdentifier() const;
- const String& attributedBundleIdentifier() const;
#if PLATFORM(IOS_FAMILY)
const String& dataConnectionServiceType() const;
#endif
@@ -128,6 +128,10 @@
void removeWebSocketTask(WebPageProxyIdentifier, WebSocketTask&) final;
#endif
+ void addWebPageNetworkParameters(WebPageProxyIdentifier, WebPageNetworkParameters&&) final;
+ void removeWebPageNetworkParameters(WebPageProxyIdentifier) final;
+ size_t countNonDefaultSessionSets() const final;
+
struct IsolatedSession {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -136,7 +140,7 @@
WallTime lastUsed;
};
- struct SessionSet : public RefCounted<SessionSet> {
+ struct SessionSet : public RefCounted<SessionSet>, public CanMakeWeakPtr<SessionSet> {
public:
static Ref<SessionSet> create()
{
@@ -159,8 +163,9 @@
Ref<SessionSet> m_defaultSessionSet;
HashMap<WebPageProxyIdentifier, Ref<SessionSet>> m_perPageSessionSets;
+ HashMap<WebPageNetworkParameters, WeakPtr<SessionSet>> m_perParametersSessionSets;
- void initializeStandardSessionsInSet(SessionSet&, NSURLSessionConfiguration *);
+ void initializeNSURLSessionsInSet(SessionSet&, NSURLSessionConfiguration *);
SessionSet& sessionSetForPage(WebPageProxyIdentifier);
const SessionSet& sessionSetForPage(WebPageProxyIdentifier) const;
void invalidateAndCancelSessionSet(SessionSet&);
@@ -168,7 +173,6 @@
String m_boundInterfaceIdentifier;
String m_sourceApplicationBundleIdentifier;
String m_sourceApplicationSecondaryIdentifier;
- String m_attributedBundleIdentifier;
RetainPtr<CFDictionaryRef> m_proxyConfiguration;
RetainPtr<DMFWebsitePolicyMonitor> m_deviceManagementPolicyMonitor;
bool m_deviceManagementRestrictionsEnabled { false };
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (278474 => 278475)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -36,6 +36,7 @@
#import "NetworkLoad.h"
#import "NetworkProcess.h"
#import "NetworkSessionCreationParameters.h"
+#import "WebPageNetworkParameters.h"
#import "WebSocketTask.h"
#import <Foundation/NSURLSession.h>
#import <WebCore/Credential.h>
@@ -1099,11 +1100,6 @@
return m_sourceApplicationSecondaryIdentifier;
}
-const String& NetworkSessionCocoa::attributedBundleIdentifier() const
-{
- return m_attributedBundleIdentifier;
-}
-
#if PLATFORM(IOS_FAMILY)
const String& NetworkSessionCocoa::dataConnectionServiceType() const
{
@@ -1176,7 +1172,6 @@
, m_boundInterfaceIdentifier(parameters.boundInterfaceIdentifier)
, m_sourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier)
, m_sourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier)
- , m_attributedBundleIdentifier(parameters.attributedBundleIdentifier)
, m_proxyConfiguration(parameters.proxyConfiguration)
, m_shouldLogCookieInformation(parameters.shouldLogCookieInformation)
, m_fastServerTrustEvaluationEnabled(parameters.fastServerTrustEvaluationEnabled)
@@ -1228,13 +1223,6 @@
if (!m_sourceApplicationSecondaryIdentifier.isEmpty())
configuration._sourceApplicationSecondaryIdentifier = m_sourceApplicationSecondaryIdentifier;
-#if HAVE(CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER)
- if (!m_attributedBundleIdentifier.isEmpty()) {
- if ([configuration respondsToSelector:@selector(_attributedBundleIdentifier)])
- configuration._attributedBundleIdentifier = m_attributedBundleIdentifier;
- }
-#endif
-
#if HAVE(CFNETWORK_ALTERNATIVE_SERVICE)
if (!parameters.alternativeServiceDirectory.isEmpty()) {
SandboxExtension::consumePermanently(parameters.alternativeServiceDirectoryExtensionHandle);
@@ -1284,7 +1272,7 @@
cookieStorage.get()._overrideSessionCookieAcceptPolicy = YES;
#endif
- initializeStandardSessionsInSet(m_defaultSessionSet.get(), configuration);
+ initializeNSURLSessionsInSet(m_defaultSessionSet.get(), configuration);
m_deviceManagementRestrictionsEnabled = parameters.deviceManagementRestrictionsEnabled;
m_allLoadsBlockedByDeviceManagementRestrictionsForTesting = parameters.allLoadsBlockedByDeviceManagementRestrictionsForTesting;
@@ -1301,7 +1289,7 @@
NetworkSessionCocoa::~NetworkSessionCocoa() = default;
-void NetworkSessionCocoa::initializeStandardSessionsInSet(SessionSet& sessionSet, NSURLSessionConfiguration *configuration)
+void NetworkSessionCocoa::initializeNSURLSessionsInSet(SessionSet& sessionSet, NSURLSessionConfiguration *configuration)
{
sessionSet.sessionWithCredentialStorage.initialize(configuration, *this, WebCore::StoredCredentialsPolicy::Use, NavigatingToAppBoundDomain::No);
LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
@@ -1347,10 +1335,6 @@
#if PLATFORM(IOS_FAMILY)
configuration._CTDataConnectionServiceType = existingConfiguration._CTDataConnectionServiceType;
#endif
-#if HAVE(CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER)
- if ([configuration respondsToSelector:@selector(_attributedBundleIdentifier)])
- configuration._attributedBundleIdentifier = existingConfiguration._attributedBundleIdentifier;
-#endif
ephemeralStatelessSession.initialize(configuration, session, WebCore::StoredCredentialsPolicy::EphemeralStateless, isNavigatingToAppBoundDomain);
@@ -1677,6 +1661,38 @@
#endif // HAVE(NSURLSESSION_WEBSOCKET)
+void NetworkSessionCocoa::addWebPageNetworkParameters(WebPageProxyIdentifier pageID, WebPageNetworkParameters&& parameters)
+{
+ auto addResult1 = m_perParametersSessionSets.add(parameters, nullptr);
+ if (auto set = addResult1.iterator->value) {
+ m_perPageSessionSets.add(pageID, *set);
+ return;
+ }
+
+ auto addResult2 = m_perPageSessionSets.add(pageID, SessionSet::create());
+ ASSERT(addResult2.isNewEntry);
+ RetainPtr<NSURLSessionConfiguration> configuration = adoptNS([m_defaultSessionSet->sessionWithCredentialStorage.session.get().configuration copy]);
+#if HAVE(CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER)
+ if ([configuration respondsToSelector:@selector(_attributedBundleIdentifier)])
+ configuration.get()._attributedBundleIdentifier = parameters.attributedBundleIdentifier();
+#endif
+ initializeNSURLSessionsInSet(addResult2.iterator->value.get(), configuration.get());
+ addResult1.iterator->value = makeWeakPtr(addResult2.iterator->value.get());
+}
+
+void NetworkSessionCocoa::removeWebPageNetworkParameters(WebPageProxyIdentifier pageID)
+{
+ m_perPageSessionSets.remove(pageID);
+}
+
+size_t NetworkSessionCocoa::countNonDefaultSessionSets() const
+{
+ HashSet<Ref<SessionSet>> uniqueSets;
+ for (auto& set : m_perPageSessionSets.values())
+ uniqueSets.add(set);
+ return uniqueSets.size();
+}
+
Vector<WebCore::SecurityOriginData> NetworkSessionCocoa::hostNamesWithAlternativeServices() const
{
#if HAVE(CFNETWORK_ALTERNATIVE_SERVICE)
Added: trunk/Source/WebKit/Shared/WebPageNetworkParameters.cpp (0 => 278475)
--- trunk/Source/WebKit/Shared/WebPageNetworkParameters.cpp (rev 0)
+++ trunk/Source/WebKit/Shared/WebPageNetworkParameters.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "config.h"
+#include "WebPageNetworkParameters.h"
+
+namespace WebKit {
+
+void WebPageNetworkParameters::encode(IPC::Encoder& encoder) const
+{
+ encoder << m_attributedBundleIdentifier;
+}
+
+std::optional<WebPageNetworkParameters> WebPageNetworkParameters::decode(IPC::Decoder& decoder)
+{
+ std::optional<String> attributedBundleIdentifier;
+ decoder >> attributedBundleIdentifier;
+ if (!attributedBundleIdentifier)
+ return std::nullopt;
+
+ return {{
+ WTFMove(*attributedBundleIdentifier)
+ }};
+}
+
+}
Added: trunk/Source/WebKit/Shared/WebPageNetworkParameters.h (0 => 278475)
--- trunk/Source/WebKit/Shared/WebPageNetworkParameters.h (rev 0)
+++ trunk/Source/WebKit/Shared/WebPageNetworkParameters.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2021 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/text/WTFString.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+class WebPageNetworkParameters {
+public:
+ WebPageNetworkParameters(const String& attributedBundleIdentifier)
+ : m_attributedBundleIdentifier(attributedBundleIdentifier) { }
+
+ void encode(IPC::Encoder&) const;
+ static std::optional<WebPageNetworkParameters> decode(IPC::Decoder&);
+
+ WebPageNetworkParameters() = default;
+ WebPageNetworkParameters(WTF::HashTableDeletedValueType)
+ : m_attributedBundleIdentifier(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_attributedBundleIdentifier.isHashTableDeletedValue(); }
+ unsigned hash() const { return m_attributedBundleIdentifier.hash(); }
+ bool operator==(const WebPageNetworkParameters& other) const { return m_attributedBundleIdentifier == other.m_attributedBundleIdentifier; }
+
+ const String& attributedBundleIdentifier() const { return m_attributedBundleIdentifier; }
+private:
+ String m_attributedBundleIdentifier;
+};
+
+} // namespace WebKit
+
+namespace WTF {
+
+template<> struct DefaultHash<WebKit::WebPageNetworkParameters> {
+ static unsigned hash(const WebKit::WebPageNetworkParameters& key) { return key.hash(); }
+ static bool equal(const WebKit::WebPageNetworkParameters& a, const WebKit::WebPageNetworkParameters& b) { return a == b; }
+ static constexpr bool safeToCompareToEmptyOrDeleted = false;
+};
+
+template<> struct HashTraits<WebKit::WebPageNetworkParameters> : public SimpleClassHashTraits<WebKit::WebPageNetworkParameters> { };
+
+} // namespace WTF
Modified: trunk/Source/WebKit/Shared/mac/SecItemResponseData.h (278474 => 278475)
--- trunk/Source/WebKit/Shared/mac/SecItemResponseData.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/Shared/mac/SecItemResponseData.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -25,6 +25,7 @@
#pragma once
+#include <optional>
#include <wtf/RetainPtr.h>
namespace IPC {
Modified: trunk/Source/WebKit/Sources.txt (278474 => 278475)
--- trunk/Source/WebKit/Sources.txt 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/Sources.txt 2021-06-04 18:02:04 UTC (rev 278475)
@@ -217,6 +217,7 @@
Shared/WebMouseEvent.cpp @no-unify
Shared/WebPageCreationParameters.cpp
Shared/WebPageGroupData.cpp
+Shared/WebPageNetworkParameters.cpp
Shared/WebPlatformTouchPoint.cpp @no-unify
Shared/WebPopupItem.cpp
Shared/WebPreferencesDefaultValues.cpp
Modified: trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -79,6 +79,7 @@
copy->m_applicationManifest = this->m_applicationManifest;
#endif
copy->m_shouldRelaxThirdPartyCookieBlocking = this->m_shouldRelaxThirdPartyCookieBlocking;
+ copy->m_attributedBundleIdentifier = this->m_attributedBundleIdentifier;
for (auto& pair : this->m_urlSchemeHandlers)
copy->m_urlSchemeHandlers.set(pair.key, pair.value.copyRef());
copy->m_corsDisablingPatterns = this->m_corsDisablingPatterns;
Modified: trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -166,7 +166,10 @@
void setShouldRelaxThirdPartyCookieBlocking(WebCore::ShouldRelaxThirdPartyCookieBlocking value) { m_shouldRelaxThirdPartyCookieBlocking = value; }
WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking() const { return m_shouldRelaxThirdPartyCookieBlocking; }
-
+
+ void setAttributedBundleIdentifier(WTF::String&& identifier) { m_attributedBundleIdentifier = WTFMove(identifier); }
+ const WTF::String& attributedBundleIdentifier() const { return m_attributedBundleIdentifier; }
+
private:
RefPtr<WebKit::WebProcessPool> m_processPool;
@@ -217,6 +220,7 @@
bool m_httpsUpgradeEnabled { true };
WebCore::ShouldRelaxThirdPartyCookieBlocking m_shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
+ WTF::String m_attributedBundleIdentifier;
};
} // namespace API
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -1322,6 +1322,19 @@
return _sampledPageTopColorMinHeight;
}
+- (void)_setAttributedBundleIdentifier:(NSString *)identifier
+{
+ _pageConfiguration->setAttributedBundleIdentifier(identifier);
+}
+
+- (NSString *)_attributedBundleIdentifier
+{
+ auto& identifier = _pageConfiguration->attributedBundleIdentifier();
+ if (!identifier)
+ return nil;
+ return identifier;
+}
+
@end
@implementation WKWebViewConfiguration (WKDeprecated)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -132,6 +132,9 @@
// Expects 0 (the color doesn't need to continue into the page at all) or any positive number.
@property (nonatomic, setter=_setSampledPageTopColorMinHeight:) double _sampledPageTopColorMinHeight WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+// Attributes network activity from this WKWebView to the app with this bundle.
+@property (nonatomic, setter=_setAttributedBundleIdentifier:) NSString *_attributedBundleIdentifier;
+
@end
#if TARGET_OS_IPHONE
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -741,4 +741,11 @@
return !!WebKit::NetworkProcessProxy::defaultNetworkProcess();
}
+- (void)_countNonDefaultSessionSets:(void(^)(size_t))completionHandler
+{
+ _websiteDataStore->countNonDefaultSessionSets([completionHandler = makeBlockPtr(completionHandler)] (size_t count) {
+ completionHandler(count);
+ });
+}
+
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -100,6 +100,7 @@
+ (void)_makeNextNetworkProcessLaunchFailForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
- (BOOL)_networkProcessExists WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+ (BOOL)_defaultNetworkProcessExists WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_countNonDefaultSessionSets:(void(^)(size_t))completionHandler;
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -39,7 +39,6 @@
// These properties apply to both persistent and non-persistent data stores.
@property (nonatomic, nullable, copy) NSString *sourceApplicationBundleIdentifier WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
@property (nonatomic, nullable, copy) NSString *sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
-@property (nonatomic, nullable, copy) NSString *attributedBundleIdentifier WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, nullable, copy, setter=setHTTPProxy:) NSURL *httpProxy WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
@property (nonatomic, nullable, copy, setter=setHTTPSProxy:) NSURL *httpsProxy WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
@property (nonatomic) BOOL deviceManagementRestrictionsEnabled WK_API_AVAILABLE(macos(10.15), ios(13.0));
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -242,16 +242,6 @@
_configuration->setSourceApplicationSecondaryIdentifier(identifier);
}
-- (void)setAttributedBundleIdentifier:(NSString *)identifier
-{
- _configuration->setAttributedBundleIdentifier(identifier);
-}
-
-- (NSString *)attributedBundleIdentifier
-{
- return _configuration->attributedBundleIdentifier();
-}
-
- (NSURL *)applicationCacheDirectory
{
return [NSURL fileURLWithPath:_configuration->applicationCacheDirectory() isDirectory:YES];
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -128,6 +128,7 @@
#include "WebPageGroupData.h"
#include "WebPageInspectorController.h"
#include "WebPageMessages.h"
+#include "WebPageNetworkParameters.h"
#include "WebPageProxyMessages.h"
#include "WebPasteboardProxy.h"
#include "WebPaymentCoordinatorProxy.h"
@@ -605,6 +606,8 @@
for (auto& callback : m_nextActivityStateChangeCallbacks)
callback();
+ websiteDataStore().networkProcess().send(Messages::NetworkProcess::RemoveWebPageNetworkParameters(sessionID(), m_identifier), 0);
+
#if ENABLE(MEDIA_SESSION_COORDINATOR)
WEBPAGEPROXY_DESTRUCTOR_WKCOORDINATOR_ADDITIONS
#endif
@@ -1101,6 +1104,11 @@
Inspector::RemoteInspector::singleton();
#endif
+ if (auto& attributedBundleIdentifier = m_configuration->attributedBundleIdentifier(); !!attributedBundleIdentifier) {
+ WebPageNetworkParameters parameters { attributedBundleIdentifier };
+ websiteDataStore().networkProcess().send(Messages::NetworkProcess::AddWebPageNetworkParameters(sessionID(), m_identifier, WTFMove(parameters)), 0);
+ }
+
send(Messages::WebProcess::CreateWebPage(m_webPageID, creationParameters(m_process, *m_drawingArea)), 0);
m_process->addVisitedLinkStoreUser(visitedLinkStore(), m_identifier);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -159,7 +159,6 @@
parameters.networkSessionParameters.proxyConfiguration = configuration().proxyConfiguration();
parameters.networkSessionParameters.sourceApplicationBundleIdentifier = configuration().sourceApplicationBundleIdentifier();
parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = configuration().sourceApplicationSecondaryIdentifier();
- parameters.networkSessionParameters.attributedBundleIdentifier = configuration().attributedBundleIdentifier();
parameters.networkSessionParameters.shouldLogCookieInformation = shouldLogCookieInformation;
parameters.networkSessionParameters.httpProxy = WTFMove(httpProxy);
parameters.networkSessionParameters.httpsProxy = WTFMove(httpsProxy);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -2179,6 +2179,11 @@
networkProcess().clearBundleIdentifier([callbackAggregator] { });
}
+void WebsiteDataStore::countNonDefaultSessionSets(CompletionHandler<void(size_t)>&& completionHandler)
+{
+ networkProcess().sendWithAsyncReply(Messages::NetworkProcess::CountNonDefaultSessionSets(m_sessionID), WTFMove(completionHandler));
+}
+
static bool nextNetworkProcessLaunchShouldFailForTesting { false };
void WebsiteDataStore::makeNextNetworkProcessLaunchFailForTesting()
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -351,7 +351,9 @@
#endif
void updateBundleIdentifierInNetworkProcess(const String&, CompletionHandler<void()>&&);
void clearBundleIdentifierInNetworkProcess(CompletionHandler<void()>&&);
-
+
+ void countNonDefaultSessionSets(CompletionHandler<void(size_t)>&&);
+
private:
enum class ForceReinitialization : bool { No, Yes };
#if ENABLE(APP_BOUND_DOMAINS)
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp 2021-06-04 18:02:04 UTC (rev 278475)
@@ -77,7 +77,6 @@
copy->m_cookieStorageFile = this->m_cookieStorageFile;
copy->m_sourceApplicationBundleIdentifier = this->m_sourceApplicationBundleIdentifier;
copy->m_sourceApplicationSecondaryIdentifier = this->m_sourceApplicationSecondaryIdentifier;
- copy->m_attributedBundleIdentifier = this->m_attributedBundleIdentifier;
copy->m_httpProxy = this->m_httpProxy;
copy->m_httpsProxy = this->m_httpsProxy;
copy->m_deviceManagementRestrictionsEnabled = this->m_deviceManagementRestrictionsEnabled;
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h (278474 => 278475)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h 2021-06-04 18:02:04 UTC (rev 278475)
@@ -132,9 +132,6 @@
const String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
void setSourceApplicationSecondaryIdentifier(String&& identifier) { m_sourceApplicationSecondaryIdentifier = WTFMove(identifier); }
-
- const String& attributedBundleIdentifier() const { return m_attributedBundleIdentifier; }
- void setAttributedBundleIdentifier(String&& identifier) { m_attributedBundleIdentifier = WTFMove(identifier); }
const URL& httpProxy() const { return m_httpProxy; }
void setHTTPProxy(URL&& proxy) { m_httpProxy = WTFMove(proxy); }
@@ -197,7 +194,6 @@
String m_cookieStorageFile;
String m_sourceApplicationBundleIdentifier;
String m_sourceApplicationSecondaryIdentifier;
- String m_attributedBundleIdentifier;
String m_boundInterfaceIdentifier;
String m_dataConnectionServiceType;
URL m_httpProxy;
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (278474 => 278475)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-04 18:02:04 UTC (rev 278475)
@@ -4440,6 +4440,8 @@
5C14271B1C23F8CC00D41183 /* LegacyCustomProtocolManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyCustomProtocolManagerCocoa.mm; sourceTree = "<group>"; };
5C19A51E1FD0B14600EEA323 /* URLSchemeTaskParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSchemeTaskParameters.cpp; sourceTree = "<group>"; };
5C19A51F1FD0B14700EEA323 /* URLSchemeTaskParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSchemeTaskParameters.h; sourceTree = "<group>"; };
+ 5C1B38DF2667140700B1545B /* WebPageNetworkParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPageNetworkParameters.h; sourceTree = "<group>"; };
+ 5C1B38E02667140700B1545B /* WebPageNetworkParameters.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageNetworkParameters.cpp; sourceTree = "<group>"; };
5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkSessionCocoa.mm; sourceTree = "<group>"; };
5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkSession.h; sourceTree = "<group>"; };
5C26958420042F12005C439B /* WKOpenPanelParametersPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParametersPrivate.h; sourceTree = "<group>"; };
@@ -6836,6 +6838,8 @@
C06C6094124C14430001682F /* WebPageCreationParameters.h */,
BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */,
BC7B625012A43C9600D174A4 /* WebPageGroupData.h */,
+ 5C1B38E02667140700B1545B /* WebPageNetworkParameters.cpp */,
+ 5C1B38DF2667140700B1545B /* WebPageNetworkParameters.h */,
C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */,
BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */,
BC5744EE12638FB3006F0F12 /* WebPopupItem.h */,
Modified: trunk/Tools/ChangeLog (278474 => 278475)
--- trunk/Tools/ChangeLog 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Tools/ChangeLog 2021-06-04 18:02:04 UTC (rev 278475)
@@ -1,3 +1,13 @@
+2021-06-04 Alex Christensen <[email protected]>
+
+ Make attributedBundleIdendifier a property for WKWebViewConfiguration instead of _WKWebsiteDataStoreConfiguration
+ https://bugs.webkit.org/show_bug.cgi?id=226548
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
+ (TestWebKitAPI::TEST):
+
2021-06-04 Martin Robinson <[email protected]>
The CMake cache is removed when specifying a build target
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm (278474 => 278475)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm 2021-06-04 17:58:37 UTC (rev 278474)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm 2021-06-04 18:02:04 UTC (rev 278475)
@@ -267,7 +267,6 @@
[configuration setHTTPSProxy:[NSURL URLWithString:@"https://www.apple.com/"]];
[configuration setSourceApplicationBundleIdentifier:@"com.apple.Safari"];
[configuration setSourceApplicationSecondaryIdentifier:@"com.apple.Safari"];
- [configuration setAttributedBundleIdentifier:@"com.apple.Safari"];
}
TEST(WKWebsiteDataStore, FetchNonPersistentWebStorage)
@@ -312,6 +311,38 @@
TestWebKitAPI::Util::run(&readyToContinue);
}
+TEST(WKWebsiteDataStore, SessionSetCount)
+{
+ auto countSessionSets = [] {
+ __block bool done = false;
+ __block size_t result = 0;
+ [[WKWebsiteDataStore defaultDataStore] _countNonDefaultSessionSets:^(size_t count) {
+ result = count;
+ done = true;
+ }];
+ TestWebKitAPI::Util::run(&done);
+ return result;
+ };
+ @autoreleasepool {
+ auto webView0 = adoptNS([WKWebView new]);
+ EXPECT_EQ(countSessionSets(), 0u);
+ auto configuration = adoptNS([WKWebViewConfiguration new]);
+ EXPECT_NULL(configuration.get()._attributedBundleIdentifier);
+ configuration.get()._attributedBundleIdentifier = @"test.bundle.id.1";
+ auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSZeroRect configuration:configuration.get()]);
+ [webView1 loadHTMLString:@"hi" baseURL:nil];
+ EXPECT_EQ(countSessionSets(), 1u);
+ auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSZeroRect configuration:configuration.get()]);
+ [webView2 loadHTMLString:@"hi" baseURL:nil];
+ EXPECT_EQ(countSessionSets(), 1u);
+ configuration.get()._attributedBundleIdentifier = @"test.bundle.id.2";
+ auto webView3 = adoptNS([[WKWebView alloc] initWithFrame:NSZeroRect configuration:configuration.get()]);
+ [webView3 loadHTMLString:@"hi" baseURL:nil];
+ EXPECT_EQ(countSessionSets(), 2u);
+ }
+ while (countSessionSets()) { }
+}
+
TEST(WebKit, ClearCustomDataStoreNoWebViews)
{
HTTPServer server([connectionCount = 0] (Connection connection) mutable {