Diff
Modified: trunk/Source/WebKit/ChangeLog (242301 => 242302)
--- trunk/Source/WebKit/ChangeLog 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/ChangeLog 2019-03-02 02:27:21 UTC (rev 242302)
@@ -1,3 +1,35 @@
+2019-03-01 Alex Christensen <achristen...@webkit.org>
+
+ Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+ https://bugs.webkit.org/show_bug.cgi?id=195229
+ <rdar://problem/48520362>
+
+ Reviewed by Chris Dumez.
+
+ Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
+ but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
+
+ Functionality verified by manual testing. See radar.
+ Added an API test that verifies the setter restrictions work as expected.
+
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+ (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
+ (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
+ (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
+ (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
+ * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::toPKPaymentRequest):
+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+ (WebKit::WebsiteDataStore::parameters):
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::WebsiteDataStore):
+ (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
+ (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
+ (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
+
2019-03-01 Antoine Quint <grao...@apple.com>
[iOS] Turn mouse event simulation on by default
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2019-03-02 02:27:21 UTC (rev 242302)
@@ -363,6 +363,28 @@
_websiteDataStore->websiteDataStore().setProxyConfiguration((__bridge CFDictionaryRef)configuration);
}
+- (NSString *)_sourceApplicationBundleIdentifier
+{
+ return _websiteDataStore->websiteDataStore().sourceApplicationBundleIdentifier();
+}
+
+- (void)_setSourceApplicationBundleIdentifier:(NSString *)identifier
+{
+ if (!_websiteDataStore->websiteDataStore().setSourceApplicationBundleIdentifier(identifier))
+ [NSException raise:NSGenericException format:@"_setSourceApplicationBundleIdentifier cannot be called after networking has begun"];
+}
+
+- (NSString *)_sourceApplicationSecondaryIdentifier
+{
+ return _websiteDataStore->websiteDataStore().sourceApplicationSecondaryIdentifier();
+}
+
+- (void)_setSourceApplicationSecondaryIdentifier:(NSString *)identifier
+{
+ if (!_websiteDataStore->websiteDataStore().setSourceApplicationSecondaryIdentifier(identifier))
+ [NSException raise:NSGenericException format:@"_setSourceApplicationSecondaryIdentifier cannot be called after networking has begun"];
+}
+
- (NSDictionary *)_proxyConfiguration
{
return (__bridge NSDictionary *)_websiteDataStore->websiteDataStore().proxyConfiguration();
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2019-03-02 02:27:21 UTC (rev 242302)
@@ -57,6 +57,8 @@
@property (nonatomic, setter=_setBoundInterfaceIdentifier:) NSString *_boundInterfaceIdentifier WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
@property (nonatomic, setter=_setAllowsCellularAccess:) BOOL _allowsCellularAccess WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
@property (nonatomic, setter=_setProxyConfiguration:) NSDictionary *_proxyConfiguration WK_API_AVAILABLE(macosx(10.14), ios(12.0));
+@property (nonatomic, copy, setter=_setSourceApplicationBundleIdentifier:) NSString *_sourceApplicationBundleIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, copy, setter=_setSourceApplicationSecondaryIdentifier:) NSString *_sourceApplicationSecondaryIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, readonly) NSURL *_indexedDBDatabaseDirectory;
Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2019-03-02 02:27:21 UTC (rev 242302)
@@ -506,13 +506,13 @@
#endif
// FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
- auto& configuration = webPageProxy.websiteDataStore().configuration();
+ auto& websiteDataStore = webPageProxy.websiteDataStore();
- if (!configuration.sourceApplicationBundleIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
- [result setSourceApplicationBundleIdentifier:configuration.sourceApplicationBundleIdentifier()];
+ if (!websiteDataStore.sourceApplicationBundleIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
+ [result setSourceApplicationBundleIdentifier:websiteDataStore.sourceApplicationBundleIdentifier()];
- if (!configuration.sourceApplicationSecondaryIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
- [result setSourceApplicationSecondaryIdentifier:configuration.sourceApplicationSecondaryIdentifier()];
+ if (!websiteDataStore.sourceApplicationSecondaryIdentifier().isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
+ [result setSourceApplicationSecondaryIdentifier:websiteDataStore.sourceApplicationSecondaryIdentifier()];
#if PLATFORM(IOS_FAMILY)
if (!webPageProxy.process().processPool().configuration().ctDataConnectionServiceType().isEmpty() && [result respondsToSelector:@selector(setCTDataConnectionServiceType:)])
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-02 02:27:21 UTC (rev 242302)
@@ -490,6 +490,9 @@
if (m_websiteDataStore) {
parameters.defaultDataStoreParameters.pendingCookies = copyToVector(m_websiteDataStore->websiteDataStore().pendingCookies());
m_websiteDataStore->websiteDataStore().clearPendingCookies();
+ parameters.defaultDataStoreParameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_websiteDataStore->websiteDataStore().sourceApplicationBundleIdentifier();
+ parameters.defaultDataStoreParameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_websiteDataStore->websiteDataStore().sourceApplicationSecondaryIdentifier();
+ m_websiteDataStore->websiteDataStore().finalizeApplicationIdentifiers();
}
parameters.cacheModel = cacheModel();
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-03-02 02:27:21 UTC (rev 242302)
@@ -94,8 +94,8 @@
m_boundInterfaceIdentifier,
m_allowsCellularAccess,
m_proxyConfiguration,
- m_configuration->sourceApplicationBundleIdentifier(),
- m_configuration->sourceApplicationSecondaryIdentifier(),
+ m_sourceApplicationBundleIdentifier,
+ m_sourceApplicationSecondaryIdentifier,
shouldLogCookieInformation,
Seconds { [defaults integerForKey:WebKitNetworkLoadThrottleLatencyMillisecondsDefaultsKey] / 1000. },
WTFMove(httpProxy),
@@ -104,6 +104,7 @@
WTFMove(resourceLoadStatisticsDirectoryHandle),
false
};
+ finalizeApplicationIdentifiers();
auto cookieFile = resolvedCookieStorageFile();
@@ -115,8 +116,8 @@
}
parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier;
- parameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_configuration->sourceApplicationBundleIdentifier();
- parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_configuration->sourceApplicationSecondaryIdentifier();
+ parameters.networkSessionParameters.sourceApplicationBundleIdentifier = m_sourceApplicationBundleIdentifier;
+ parameters.networkSessionParameters.sourceApplicationSecondaryIdentifier = m_sourceApplicationSecondaryIdentifier;
parameters.pendingCookies = copyToVector(m_pendingCookies);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-03-02 02:27:21 UTC (rev 242302)
@@ -98,6 +98,8 @@
, m_storageManager(StorageManager::create(m_configuration->localStorageDirectory()))
, m_deviceIdHashSaltStorage(DeviceIdHashSaltStorage::create(isPersistent() ? m_configuration->deviceIdHashSaltsStorageDirectory() : String()))
, m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
+ , m_sourceApplicationBundleIdentifier(m_configuration->sourceApplicationBundleIdentifier())
+ , m_sourceApplicationSecondaryIdentifier(m_configuration->sourceApplicationSecondaryIdentifier())
#if ENABLE(WEB_AUTHN)
, m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
#endif
@@ -2101,4 +2103,20 @@
{
}
+bool WebsiteDataStore::setSourceApplicationSecondaryIdentifier(String&& identifier)
+{
+ if (!m_allowedToSetApplicationIdentifiers)
+ return false;
+ m_sourceApplicationSecondaryIdentifier = WTFMove(identifier);
+ return true;
}
+
+bool WebsiteDataStore::setSourceApplicationBundleIdentifier(String&& identifier)
+{
+ if (!m_allowedToSetApplicationIdentifiers)
+ return false;
+ m_sourceApplicationBundleIdentifier = WTFMove(identifier);
+ return true;
+}
+
+}
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (242301 => 242302)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-03-02 02:27:21 UTC (rev 242302)
@@ -200,7 +200,15 @@
void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); }
const String& boundInterfaceIdentifier() { return m_boundInterfaceIdentifier; }
+
+ const String& sourceApplicationBundleIdentifier() const { return m_sourceApplicationBundleIdentifier; }
+ bool setSourceApplicationBundleIdentifier(String&&);
+
+ const String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
+ bool setSourceApplicationSecondaryIdentifier(String&&);
+ void finalizeApplicationIdentifiers() { m_allowedToSetApplicationIdentifiers = false; }
+
void setAllowsCellularAccess(AllowsCellularAccess allows) { m_allowsCellularAccess = allows; }
AllowsCellularAccess allowsCellularAccess() { return m_allowsCellularAccess; }
@@ -304,6 +312,9 @@
String m_boundInterfaceIdentifier;
AllowsCellularAccess m_allowsCellularAccess { AllowsCellularAccess::Yes };
+ String m_sourceApplicationBundleIdentifier;
+ String m_sourceApplicationSecondaryIdentifier;
+ bool m_allowedToSetApplicationIdentifiers { true };
#if HAVE(SEC_KEY_PROXY)
Vector<Ref<SecKeyProxyStore>> m_secKeyProxyStores;
Modified: trunk/Tools/ChangeLog (242301 => 242302)
--- trunk/Tools/ChangeLog 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Tools/ChangeLog 2019-03-02 02:27:21 UTC (rev 242302)
@@ -1,3 +1,14 @@
+2019-03-01 Alex Christensen <achristen...@webkit.org>
+
+ Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
+ https://bugs.webkit.org/show_bug.cgi?id=195229
+ <rdar://problem/48520362>
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
+ (TEST):
+
2019-03-01 Simon Fraser <simon.fra...@apple.com>
Add a system trace scope for event region building
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm (242301 => 242302)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm 2019-03-02 01:33:17 UTC (rev 242301)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm 2019-03-02 02:27:21 UTC (rev 242302)
@@ -28,6 +28,7 @@
#import "PlatformUtilities.h"
#import "Test.h"
#import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
#import <WebKit/WKPreferencesRef.h>
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKUserContentControllerPrivate.h>
@@ -452,4 +453,29 @@
[webView _test_waitForDidFinishNavigation];
}
+TEST(WebKit, ApplicationIdentifiers)
+{
+ auto websiteDataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]);
+ [websiteDataStoreConfiguration setSourceApplicationBundleIdentifier:@"testidentifier"];
+
+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ auto websiteDataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration.get()] autorelease];
+ EXPECT_TRUE([websiteDataStore._sourceApplicationBundleIdentifier isEqualToString:@"testidentifier"]);
+ [websiteDataStore _setSourceApplicationBundleIdentifier:@"otheridentifier"];
+
+ [webViewConfiguration setWebsiteDataStore:websiteDataStore];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+ RetainPtr<NSException> exception;
+ @try {
+ [websiteDataStore _setSourceApplicationBundleIdentifier:@"settingShouldFailNow"];
+ } @catch(NSException *caught) {
+ exception = caught;
+ }
+ EXPECT_TRUE([[exception reason] isEqualToString:@"_setSourceApplicationBundleIdentifier cannot be called after networking has begun"]);
+ EXPECT_TRUE([websiteDataStore._sourceApplicationBundleIdentifier isEqualToString:@"otheridentifier"]);
+ EXPECT_TRUE([[websiteDataStoreConfiguration sourceApplicationBundleIdentifier] isEqualToString:@"testidentifier"]);
+}
+
#endif