Skip to content
Permalink
Browse files
Add support for configuring WebsiteDatastore service worker and cache…
… storage path

https://bugs.webkit.org/show_bug.cgi?id=182674

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-13
Reviewed by Chris Dumez.

Beef up WKWebsiteDataStoreConfiguration to easily set the WebsiteDataStore
service worker registration and cache storage directory path.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _initWithConfiguration:]):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration _cacheStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setCacheStorageDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _serviceWorkerRegistrationDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setServiceWorkerRegistrationDirectory:]):

Canonical link: https://commits.webkit.org/198538@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf authored and webkit-commit-queue committed Feb 14, 2018
1 parent 5629c0f commit 1698be08bdb1875e52ecaeb447059b03c9705dcc
@@ -1,3 +1,22 @@
2018-02-13 Youenn Fablet <youenn@apple.com>

Add support for configuring WebsiteDatastore service worker and cache storage path
https://bugs.webkit.org/show_bug.cgi?id=182674

Reviewed by Chris Dumez.

Beef up WKWebsiteDataStoreConfiguration to easily set the WebsiteDataStore
service worker registration and cache storage directory path.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _initWithConfiguration:]):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration _cacheStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setCacheStorageDirectory:]):
(-[_WKWebsiteDataStoreConfiguration _serviceWorkerRegistrationDirectory]):
(-[_WKWebsiteDataStoreConfiguration _setServiceWorkerRegistrationDirectory:]):

2018-02-13 Brian Burg <bburg@apple.com>

Web Automation: don't return an error if resizing/moving a window has no effect
@@ -200,6 +200,10 @@ - (instancetype)_initWithConfiguration:(_WKWebsiteDataStoreConfiguration *)confi
config.cookieStorageFile = configuration._cookieStorageFile.path;
if (configuration._resourceLoadStatisticsDirectory)
config.resourceLoadStatisticsDirectory = configuration._resourceLoadStatisticsDirectory.path;
if (configuration._cacheStorageDirectory)
config.cacheStorageDirectory = configuration._cacheStorageDirectory.path;
if (configuration._serviceWorkerRegistrationDirectory)
config.serviceWorkerRegistrationDirectory = configuration._serviceWorkerRegistrationDirectory.path;

API::Object::constructInWrapper<API::WebsiteDataStore>(self, config, PAL::SessionID::generatePersistentSessionID());

@@ -39,6 +39,8 @@ WK_CLASS_AVAILABLE(macosx(10.13), ios(11.0))
@property (nonatomic, copy, setter=_setWebSQLDatabaseDirectory:) NSURL *_webSQLDatabaseDirectory;
@property (nonatomic, copy, setter=_setCookieStorageFile:) NSURL *_cookieStorageFile;
@property (nonatomic, copy, setter=_setResourceLoadStatisticsDirectory:) NSURL *_resourceLoadStatisticsDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, copy, setter=_setCacheStorageDirectory:) NSURL *_cacheStorageDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, copy, setter=_setServiceWorkerRegistrationDirectory:) NSURL *_serviceWorkerRegistrationDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));

@end

@@ -42,6 +42,8 @@ @implementation _WKWebsiteDataStoreConfiguration {
RetainPtr<NSURL> _webSQLDatabaseDirectoryURL;
RetainPtr<NSURL> _cookieStorageFileURL;
RetainPtr<NSURL> _resourceLoadStatisticsDirectoryURL;
RetainPtr<NSURL> _cacheStorageDirectoryURL;
RetainPtr<NSURL> _serviceWorkerRegistrationDirectoryURL;
}

- (NSURL *)_webStorageDirectory
@@ -102,6 +104,28 @@ - (void)_setResourceLoadStatisticsDirectory:(NSURL *)url
_resourceLoadStatisticsDirectoryURL = adoptNS([url copy]);
}

- (NSURL *)_cacheStorageDirectory
{
return _cacheStorageDirectoryURL.get();
}

- (void)_setCacheStorageDirectory:(NSURL *)url
{
checkURLArgument(url);
_cacheStorageDirectoryURL = adoptNS([url copy]);
}

- (NSURL *)_serviceWorkerRegistrationDirectory
{
return _serviceWorkerRegistrationDirectoryURL.get();
}

- (void)_setServiceWorkerRegistrationDirectory:(NSURL *)url
{
checkURLArgument(url);
_serviceWorkerRegistrationDirectoryURL = adoptNS([url copy]);
}

@end

#endif

0 comments on commit 1698be0

Please sign in to comment.