Skip to content
Permalink
Browse files
Stop using legacy IDB path by default when creating WebProcessPool fr…
…om websiteDataStore

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

Reviewed by Geoffrey Garen.

Source/WebKit:

ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration should not use fixed IDB path.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::createLegacy):
(API::indexedDBDatabaseDirectory):
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::legacyWebsiteDataStoreConfiguration):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBUserDelete.mm:
(TEST):


Canonical link: https://commits.webkit.org/209495@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
szewai committed Feb 28, 2019
1 parent 0bf469e commit e8d4c44474a7db6f9aec42e19773e73f17afcec1
Showing 9 changed files with 66 additions and 1 deletion.
@@ -1,3 +1,24 @@
2019-02-28 Sihui Liu <sihui_liu@apple.com>

Stop using legacy IDB path by default when creating WebProcessPool from websiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=194958

Reviewed by Geoffrey Garen.

ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration should not use fixed IDB path.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::createLegacy):
(API::indexedDBDatabaseDirectory):
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::legacyWebsiteDataStoreConfiguration):

2019-02-28 Carlos Garcia Campos <cgarcia@igalia.com>

[CoordinatedGraphics] Unify all LayerTreeHost classes
@@ -54,7 +54,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithWebsiteDataSto
configuration->m_applicationCacheFlatFileSubdirectoryName = legacyConfiguration.applicationCacheFlatFileSubdirectoryName();
configuration->m_diskCacheDirectory = legacyConfiguration.networkCacheDirectory();
configuration->m_mediaCacheDirectory = legacyConfiguration.mediaCacheDirectory();
configuration->m_indexedDBDatabaseDirectory = WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory();
configuration->m_indexedDBDatabaseDirectory = legacyConfiguration.indexedDBDatabaseDirectory();
configuration->m_localStorageDirectory = legacyConfiguration.localStorageDirectory();
configuration->m_deviceIdHashSaltsStorageDirectory = legacyConfiguration.deviceIdHashSaltsStorageDirectory();
configuration->m_mediaKeysStorageDirectory = legacyConfiguration.mediaKeysStorageDirectory();
@@ -66,6 +66,7 @@ Ref<WebsiteDataStore> WebsiteDataStore::createNonPersistentDataStore()

Ref<WebsiteDataStore> WebsiteDataStore::createLegacy(Ref<WebKit::WebsiteDataStoreConfiguration>&& configuration)
{
configuration->setIndexedDBDatabaseDirectory(legacyDefaultIndexedDBDatabaseDirectory());
return adoptRef(*new WebsiteDataStore(WTFMove(configuration), PAL::SessionID::defaultSessionID()));
}

@@ -88,6 +89,11 @@ HTTPCookieStore& WebsiteDataStore::httpCookieStore()
return m_websiteDataStore->cookieStore();
}

WTF::String WebsiteDataStore:: indexedDBDatabaseDirectory()
{
return m_websiteDataStore->configuration().indexedDBDatabaseDirectory();
}

bool WebsiteDataStore::isPersistent()
{
return m_websiteDataStore->isPersistent();
@@ -54,6 +54,8 @@ class WebsiteDataStore final : public ObjectImpl<Object::Type::WebsiteDataStore>
WebKit::WebsiteDataStore& websiteDataStore() { return m_websiteDataStore.get(); }
HTTPCookieStore& httpCookieStore();

WTF::String indexedDBDatabaseDirectory();

static WTF::String defaultApplicationCacheDirectory();
static WTF::String defaultCacheStorageDirectory();
static WTF::String defaultNetworkCacheDirectory();
@@ -368,6 +368,11 @@ - (NSDictionary *)_proxyConfiguration
return (__bridge NSDictionary *)_websiteDataStore->websiteDataStore().proxyConfiguration();
}

- (NSURL *)_indexedDBDatabaseDirectory
{
return [NSURL fileURLWithPath:_websiteDataStore->indexedDBDatabaseDirectory() isDirectory:YES];
}

- (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value
{
#if ENABLE(RESOURCE_LOAD_STATISTICS)
@@ -58,6 +58,8 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
@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, readonly) NSURL *_indexedDBDatabaseDirectory;

- (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_setResourceLoadStatisticsTestingCallback:(nullable void (^)(WKWebsiteDataStore *, NSString *))callback WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_getAllStorageAccessEntriesFor:(WKWebView *)webView completionHandler:(void (^)(NSArray<NSString *> *domains))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
@@ -219,6 +219,7 @@ static Ref<WebsiteDataStoreConfiguration> legacyWebsiteDataStoreConfiguration(AP
configuration->setApplicationCacheFlatFileSubdirectoryName(String(processPoolConfiguration.applicationCacheFlatFileSubdirectoryName()));
configuration->setMediaCacheDirectory(String(processPoolConfiguration.mediaCacheDirectory()));
configuration->setMediaKeysStorageDirectory(String(processPoolConfiguration.mediaKeysStorageDirectory()));
configuration->setIndexedDBDatabaseDirectory(String(processPoolConfiguration.indexedDBDatabaseDirectory()));
configuration->setResourceLoadStatisticsDirectory(String(processPoolConfiguration.resourceLoadStatisticsDirectory()));
configuration->setNetworkCacheDirectory(String(processPoolConfiguration.diskCacheDirectory()));
configuration->setJavaScriptConfigurationDirectory(String(processPoolConfiguration.javaScriptConfigurationDirectory()));
@@ -1,3 +1,13 @@
2019-02-28 Sihui Liu <sihui_liu@apple.com>

Stop using legacy IDB path by default when creating WebProcessPool from websiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=194958

Reviewed by Geoffrey Garen.

* TestWebKitAPI/Tests/WebKitCocoa/IndexedDBUserDelete.mm:
(TEST):

2019-02-28 Aakash Jain <aakash_jain@apple.com>

[ews-app] Update method to save build to handle builder_display_name
@@ -31,9 +31,11 @@
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKUserContentControllerPrivate.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
#import <WebKit/WKWebsiteDataStorePrivate.h>
#import <WebKit/WebKit.h>
#import <WebKit/_WKProcessPoolConfiguration.h>
#import <WebKit/_WKUserStyleSheet.h>
#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
#import <wtf/RetainPtr.h>

#if WK_API_ENABLED
@@ -79,4 +81,20 @@ - (void)userContentController:(WKUserContentController *)userContentController d
EXPECT_WK_STREQ(@"Continue", string.get());
}

TEST(IndexedDB, IndexedDBUserDeleteBeforeLoading)
{
NSURL *idbURL = [[WKWebsiteDataStore defaultDataStore] _indexedDBDatabaseDirectory];
NSURL *fileIDBURL = [[idbURL URLByAppendingPathComponent:@"file__0"] URLByAppendingPathComponent:@"IndexedDBUserDeleteBeforeLoading"];
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"IndexedDB" withExtension:@"sqlite3" subdirectory:@"TestWebKitAPI.resources"];
[[NSFileManager defaultManager] createDirectoryAtURL:fileIDBURL withIntermediateDirectories:YES attributes:nil error:nil];
[[NSFileManager defaultManager] copyItemAtURL:fileURL toURL:[fileIDBURL URLByAppendingPathComponent:@"IndexedDB.sqlite3"] error:nil];
EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:fileIDBURL.path]);

[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[NSSet setWithObjects:WKWebsiteDataTypeIndexedDBDatabases, nil] modifiedSince:[NSDate distantPast] completionHandler:^() {
EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:fileIDBURL.path]);
readyToContinue = true;
}];
readyToContinue = false;
TestWebKitAPI::Util::run(&readyToContinue);
}
#endif

0 comments on commit e8d4c44

Please sign in to comment.