Unreviewed, rolling out r235216.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 15:30:32 +0000 (15:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 15:30:32 +0000 (15:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188887

Caused 50+ Layout Tests to Crash and 173 api Failures on Debug
builds (Requested by Truitt on #webkit).

Reverted changeset:

"Move legacy directory configuration from WebProcessPool to
API::WebsiteDataStore"
https://bugs.webkit.org/show_bug.cgi?id=188765
https://trac.webkit.org/changeset/235216

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp
Source/WebKit/UIProcess/API/APIWebsiteDataStore.h
Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm
Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp
Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp
Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp

index 7d82e6f..04ab822 100644 (file)
@@ -1,3 +1,18 @@
+2018-08-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r235216.
+        https://bugs.webkit.org/show_bug.cgi?id=188887
+
+        Caused 50+ Layout Tests to Crash and 173 api Failures on Debug
+        builds (Requested by Truitt on #webkit).
+
+        Reverted changeset:
+
+        "Move legacy directory configuration from WebProcessPool to
+        API::WebsiteDataStore"
+        https://bugs.webkit.org/show_bug.cgi?id=188765
+        https://trac.webkit.org/changeset/235216
+
 2018-08-23  Zan Dobersek  <zdobersek@igalia.com>
 
         [CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
index 14fa8d6..af167de 100644 (file)
@@ -38,12 +38,22 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::create()
 
 Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions()
 {
-    auto configuration = ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(WebsiteDataStore::legacyDefaultDataStoreConfiguration());
+    auto configuration = ProcessPoolConfiguration::create();
 
     configuration->m_shouldHaveLegacyDataStore = true;
     configuration->m_maximumProcessCount = 1;
     configuration->m_cacheModel = WebKit::CacheModelDocumentViewer;
 
+    configuration->m_applicationCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory();
+    configuration->m_applicationCacheFlatFileSubdirectoryName = "ApplicationCache";
+    configuration->m_diskCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory();
+    configuration->m_mediaCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory();
+    configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
+    configuration->m_localStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory();
+    configuration->m_mediaKeysStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory();
+    configuration->m_webSQLDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory();
+    configuration->m_javaScriptConfigurationDirectory = WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory();
+
     return configuration;
 }
 
@@ -55,7 +65,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 = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
     configuration->m_localStorageDirectory = legacyConfiguration.localStorageDirectory;
     configuration->m_mediaKeysStorageDirectory = legacyConfiguration.mediaKeysStorageDirectory;
     configuration->m_resourceLoadStatisticsDirectory = legacyConfiguration.resourceLoadStatisticsDirectory;
index aba845a..d0472c8 100644 (file)
@@ -119,19 +119,4 @@ String WebsiteDataStore::defaultJavaScriptConfigurationDirectory()
 }
 #endif
 
-WebKit::WebsiteDataStore::Configuration WebsiteDataStore::legacyDefaultDataStoreConfiguration()
-{
-    WebKit::WebsiteDataStore::Configuration configuration;
-    configuration.applicationCacheDirectory = legacyDefaultApplicationCacheDirectory();
-    configuration.applicationCacheFlatFileSubdirectoryName = "ApplicationCache";
-    configuration.networkCacheDirectory = legacyDefaultNetworkCacheDirectory();
-    configuration.mediaCacheDirectory = legacyDefaultMediaCacheDirectory();
-    configuration.mediaKeysStorageDirectory = legacyDefaultMediaKeysStorageDirectory();
-    configuration.indexedDBDatabaseDirectory = legacyDefaultIndexedDBDatabaseDirectory();
-    configuration.webSQLDatabaseDirectory = legacyDefaultWebSQLDatabaseDirectory();
-    configuration.javaScriptConfigurationDirectory = legacyDefaultJavaScriptConfigurationDirectory();
-    
-    return configuration;
-}
-
-} // namespace API
+}
index bfcbecf..768555d 100644 (file)
@@ -57,27 +57,18 @@ public:
     static String defaultCacheStorageDirectory();
     static String defaultNetworkCacheDirectory();
     static String defaultMediaCacheDirectory();
+
     static String defaultIndexedDBDatabaseDirectory();
     static String defaultServiceWorkerRegistrationDirectory();
     static String defaultLocalStorageDirectory();
     static String defaultMediaKeysStorageDirectory();
     static String defaultWebSQLDatabaseDirectory();
     static String defaultResourceLoadStatisticsDirectory();
+
     static String defaultJavaScriptConfigurationDirectory();
 
     static WebKit::WebsiteDataStore::Configuration defaultDataStoreConfiguration();
 
-    static String legacyDefaultApplicationCacheDirectory();
-    static String legacyDefaultNetworkCacheDirectory();
-    static String legacyDefaultLocalStorageDirectory();
-    static String legacyDefaultIndexedDBDatabaseDirectory();
-    static String legacyDefaultWebSQLDatabaseDirectory();
-    static String legacyDefaultMediaKeysStorageDirectory();
-    static String legacyDefaultMediaCacheDirectory();
-    static String legacyDefaultJavaScriptConfigurationDirectory();
-
-    static WebKit::WebsiteDataStore::Configuration legacyDefaultDataStoreConfiguration();
-
 private:
     enum ShouldCreateDirectory { CreateDirectory, DontCreateDirectory };
 
index e418396..14c5e36 100644 (file)
 #include "SandboxExtension.h"
 #include "SandboxUtilities.h"
 
-#include <Foundation/Foundation.h>
-#include <WebCore/FileSystem.h>
-
 #if PLATFORM(IOS)
 #import <WebCore/RuntimeApplicationChecks.h>
 #endif
 
 namespace API {
 
-NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
-NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";
-NSString *WebKitMediaCacheDirectoryDefaultsKey = @"WebKitMediaCacheDirectory";
-NSString *WebKitMediaKeysStorageDirectoryDefaultsKey = @"WebKitMediaKeysStorageDirectory";
-
 String WebsiteDataStore::defaultApplicationCacheDirectory()
 {
 #if PLATFORM(IOS)
@@ -110,113 +102,6 @@ String WebsiteDataStore::defaultJavaScriptConfigurationDirectory()
     return tempDirectoryFileSystemRepresentation("JavaScriptCoreDebug", DontCreateDirectory);
 }
 
-String WebsiteDataStore::legacyDefaultApplicationCacheDirectory()
-{
-    NSString *appName = [[NSBundle mainBundle] bundleIdentifier];
-    if (!appName)
-        appName = [[NSProcessInfo processInfo] processName];
-#if PLATFORM(IOS)
-    // This quirk used to make these apps share application cache storage, but doesn't accomplish that any more.
-    // Preserving it avoids the need to migrate data when upgrading.
-    if (WebCore::IOSApplication::isMobileSafari() || WebCore::IOSApplication::isWebApp())
-        appName = @"com.apple.WebAppCache";
-#endif
-    
-    ASSERT(appName);
-    
-#if PLATFORM(IOS)
-    NSString *cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
-#else
-    char cacheDirectory[MAXPATHLEN];
-    size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
-    if (!cacheDirectoryLen)
-        return String();
-    
-    NSString *cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];
-#endif
-    NSString* cachePath = [cacheDir stringByAppendingPathComponent:appName];
-    return WebKit::stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultNetworkCacheDirectory()
-{
-    NSString *cachePath = CFBridgingRelease(_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache]));
-    if (!cachePath)
-        cachePath = @"~/Library/Caches/com.apple.WebKit.WebProcess";
-    
-    cachePath = [cachePath stringByAppendingPathComponent:@"WebKitCache"];
-    
-    return WebKit::stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory()
-{
-    NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey];
-    if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
-        databasesDirectory = @"~/Library/WebKit/Databases";
-    return WebKit::stringByResolvingSymlinksInPath([databasesDirectory stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory()
-{
-    // Indexed databases exist in a subdirectory of the "database directory path."
-    // Currently, the top level of that directory contains entities related to WebSQL databases.
-    // We should fix this, and move WebSQL into a subdirectory (https://bugs.webkit.org/show_bug.cgi?id=124807)
-    // In the meantime, an entity name prefixed with three underscores will not conflict with any WebSQL entities.
-    return WebCore::FileSystem::pathByAppendingComponent(legacyDefaultWebSQLDatabaseDirectory(), "___IndexedDB");
-}
-
-String WebsiteDataStore::legacyDefaultLocalStorageDirectory()
-{
-    NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey];
-    if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]])
-        localStorageDirectory = @"~/Library/WebKit/LocalStorage";
-    return WebKit::stringByResolvingSymlinksInPath([localStorageDirectory stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultMediaCacheDirectory()
-{
-    NSString *mediaKeysCacheDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaCacheDirectoryDefaultsKey];
-    if (!mediaKeysCacheDirectory || ![mediaKeysCacheDirectory isKindOfClass:[NSString class]]) {
-        mediaKeysCacheDirectory = NSTemporaryDirectory();
-        
-        if (!WebKit::processHasContainer()) {
-            NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier;
-            if (!bundleIdentifier)
-                bundleIdentifier = [NSProcessInfo processInfo].processName;
-            mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:bundleIdentifier];
-        }
-        mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:@"WebKit/MediaCache"];
-    }
-    return WebKit::stringByResolvingSymlinksInPath([mediaKeysCacheDirectory stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory()
-{
-    NSString *mediaKeysStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaKeysStorageDirectoryDefaultsKey];
-    if (!mediaKeysStorageDirectory || ![mediaKeysStorageDirectory isKindOfClass:[NSString class]])
-        mediaKeysStorageDirectory = @"~/Library/WebKit/MediaKeys";
-    return WebKit::stringByResolvingSymlinksInPath([mediaKeysStorageDirectory stringByStandardizingPath]);
-}
-
-String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory()
-{
-#if PLATFORM(IOS)
-    String path = WebKit::pathForProcessContainer();
-    if (path.isEmpty())
-        path = NSHomeDirectory();
-    
-    path = path + "/Library/WebKit/JavaScriptCoreDebug";
-    path = WebKit::stringByResolvingSymlinksInPath(path);
-    
-    return path;
-#else
-    RetainPtr<NSString> javaScriptConfigPath = @"~/Library/WebKit/JavaScriptCoreDebug";
-    
-    return WebKit::stringByResolvingSymlinksInPath([javaScriptConfigPath stringByStandardizingPath]);
-#endif
-}
-
 String WebsiteDataStore::tempDirectoryFileSystemRepresentation(const String& directoryName, ShouldCreateDirectory shouldCreateDirectory)
 {
     static dispatch_once_t onceToken;
@@ -324,4 +209,4 @@ WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfig
     return configuration;
 }
 
-} // namespace API
+}
index d8b13e7..5ee01c2 100644 (file)
@@ -93,75 +93,6 @@ String WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation(const Stri
     return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::stringFromFileSystemRepresentation(g_get_user_data_dir()), directoryName);
 }
 
-String WebsiteDataStore::legacyDefaultApplicationCacheDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());
-#endif
-    return defaultApplicationCacheDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultNetworkCacheDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get());
-#endif
-    return defaultNetworkCacheDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get());
-#endif
-    return defaultWebSQLDatabaseDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get());
-#endif
-    return defaultIndexedDBDatabaseDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultLocalStorageDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(storageDirectory.get());
-#endif
-    return defaultLocalStorageDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultMediaCacheDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());
-#endif
-    return defaultMediaCacheDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory()
-{
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get());
-#endif
-    return defaultMediaKeysStorageDirectory();
-}
-
-String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory()
-{
-    GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), BASE_DIRECTORY, "JavaScriptCoreDebug", nullptr));
-    return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());
-}
-
 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
 {
     WebKit::WebsiteDataStore::Configuration configuration;
index 50df2aa..eafa470 100644 (file)
@@ -85,46 +85,6 @@ String WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation(const Stri
     return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), directoryName);
 }
 
-String WebsiteDataStore::legacyDefaultApplicationCacheDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache");
-}
-
-String WebsiteDataStore::legacyDefaultNetworkCacheDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache");
-}
-
-String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL");
-}
-
-String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB");
-}
-
-String WebsiteDataStore::legacyDefaultLocalStorageDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage");
-}
-
-String WebsiteDataStore::legacyDefaultMediaCacheDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaCache");
-}
-
-String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage");
-}
-
-String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory()
-{
-    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug");
-}
-
 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
 {
     WebKit::WebsiteDataStore::Configuration configuration;
index e19f04d..232273f 100644 (file)
 
 using namespace WebCore;
 
+NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
 NSString *WebServiceWorkerRegistrationDirectoryDefaultsKey = @"WebServiceWorkerRegistrationDirectory";
 NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
+NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";
 NSString *WebKitJSCJITEnabledDefaultsKey = @"WebKitJSCJITEnabledDefaultsKey";
 NSString *WebKitJSCFTLJITEnabledDefaultsKey = @"WebKitJSCFTLJITEnabledDefaultsKey";
+NSString *WebKitMediaKeysStorageDirectoryDefaultsKey = @"WebKitMediaKeysStorageDirectory";
+NSString *WebKitMediaCacheDirectoryDefaultsKey = @"WebKitMediaCacheDirectory";
 
 #if !PLATFORM(IOS)
 static NSString *WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification = @"NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification";
@@ -389,6 +393,121 @@ String WebProcessPool::containerTemporaryDirectory() const
 }
 #endif
 
+String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()
+{
+    registerUserDefaultsIfNeeded();
+
+    NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey];
+    if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
+        databasesDirectory = @"~/Library/WebKit/Databases";
+    return stringByResolvingSymlinksInPath([databasesDirectory stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()
+{
+    // Indexed databases exist in a subdirectory of the "database directory path."
+    // Currently, the top level of that directory contains entities related to WebSQL databases.
+    // We should fix this, and move WebSQL into a subdirectory (https://bugs.webkit.org/show_bug.cgi?id=124807)
+    // In the meantime, an entity name prefixed with three underscores will not conflict with any WebSQL entities.
+    return FileSystem::pathByAppendingComponent(legacyPlatformDefaultWebSQLDatabaseDirectory(), "___IndexedDB");
+}
+
+String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
+{
+    registerUserDefaultsIfNeeded();
+
+    NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey];
+    if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]])
+        localStorageDirectory = @"~/Library/WebKit/LocalStorage";
+    return stringByResolvingSymlinksInPath([localStorageDirectory stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()
+{
+    registerUserDefaultsIfNeeded();
+    
+    NSString *mediaKeysCacheDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaCacheDirectoryDefaultsKey];
+    if (!mediaKeysCacheDirectory || ![mediaKeysCacheDirectory isKindOfClass:[NSString class]]) {
+        mediaKeysCacheDirectory = NSTemporaryDirectory();
+        
+        if (!WebKit::processHasContainer()) {
+            NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier;
+            if (!bundleIdentifier)
+                bundleIdentifier = [NSProcessInfo processInfo].processName;
+            mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:bundleIdentifier];
+        }
+        mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:@"WebKit/MediaCache"];
+    }
+    return stringByResolvingSymlinksInPath([mediaKeysCacheDirectory stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()
+{
+    registerUserDefaultsIfNeeded();
+
+    NSString *mediaKeysStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaKeysStorageDirectoryDefaultsKey];
+    if (!mediaKeysStorageDirectory || ![mediaKeysStorageDirectory isKindOfClass:[NSString class]])
+        mediaKeysStorageDirectory = @"~/Library/WebKit/MediaKeys";
+    return stringByResolvingSymlinksInPath([mediaKeysStorageDirectory stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
+{
+    NSString *appName = [[NSBundle mainBundle] bundleIdentifier];
+    if (!appName)
+        appName = [[NSProcessInfo processInfo] processName];
+#if PLATFORM(IOS)
+    // This quirk used to make these apps share application cache storage, but doesn't accomplish that any more.
+    // Preserving it avoids the need to migrate data when upgrading.
+    if (IOSApplication::isMobileSafari() || IOSApplication::isWebApp())
+        appName = @"com.apple.WebAppCache";
+#endif
+
+    ASSERT(appName);
+
+#if PLATFORM(IOS)
+    NSString *cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
+#else
+    char cacheDirectory[MAXPATHLEN];
+    size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
+    if (!cacheDirectoryLen)
+        return String();
+
+    NSString *cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];
+#endif
+    NSString* cachePath = [cacheDir stringByAppendingPathComponent:appName];
+    return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
+{
+    NSString *cachePath = CFBridgingRelease(_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache]));
+    if (!cachePath)
+        cachePath = @"~/Library/Caches/com.apple.WebKit.WebProcess";
+
+    cachePath = [cachePath stringByAppendingPathComponent:@"WebKitCache"];
+
+    return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
+}
+
+String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()
+{
+#if PLATFORM(IOS)
+    String path = pathForProcessContainer();
+    if (path.isEmpty())
+        path = NSHomeDirectory();
+    
+    path = path + "/Library/WebKit/JavaScriptCoreDebug";
+    path = stringByResolvingSymlinksInPath(path);
+
+    return path;
+#else
+    RetainPtr<NSString> javaScriptConfigPath = @"~/Library/WebKit/JavaScriptCoreDebug";
+    
+    return stringByResolvingSymlinksInPath([javaScriptConfigPath stringByStandardizingPath]);
+#endif
+}
+
 #if PLATFORM(IOS)
 void WebProcessPool::setJavaScriptConfigurationFileEnabledFromDefaults()
 {
index 08ddb1f..6a29140 100644 (file)
@@ -417,6 +417,16 @@ public:
         return m_hiddenPageThrottlingAutoIncreasesCounter.count();
     }
 
+    // FIXME: Move these to API::WebsiteDataStore.
+    static String legacyPlatformDefaultLocalStorageDirectory();
+    static String legacyPlatformDefaultIndexedDBDatabaseDirectory();
+    static String legacyPlatformDefaultWebSQLDatabaseDirectory();
+    static String legacyPlatformDefaultMediaKeysStorageDirectory();
+    static String legacyPlatformDefaultMediaCacheDirectory();
+    static String legacyPlatformDefaultApplicationCacheDirectory();
+    static String legacyPlatformDefaultNetworkCacheDirectory();
+    static String legacyPlatformDefaultJavaScriptConfigurationDirectory();
+
     void setResourceLoadStatisticsEnabled(bool);
     void clearResourceLoadStatistics();
 
index 3d04453..adedb98 100644 (file)
@@ -77,6 +77,16 @@ void WebProcessPool::platformInitialize()
 #endif
 }
 
+WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
+{
+    return API::WebsiteDataStore::defaultApplicationCacheDirectory();
+}
+
+WTF::String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()
+{
+    return API::WebsiteDataStore::defaultMediaCacheDirectory();
+}
+
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;
@@ -100,6 +110,37 @@ void WebProcessPool::platformInvalidateContext()
 {
 }
 
+String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()
+{
+    return API::WebsiteDataStore::defaultWebSQLDatabaseDirectory();
+}
+
+String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()
+{
+    return API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory();
+}
+
+String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
+{
+    return API::WebsiteDataStore::defaultLocalStorageDirectory();
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()
+{
+    return API::WebsiteDataStore::defaultMediaKeysStorageDirectory();
+}
+
+String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
+{
+    return API::WebsiteDataStore::defaultNetworkCacheDirectory();
+}
+
+String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()
+{
+    GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), "webkitgtk", "JavaScriptCoreDebug", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());
+}
+
 void WebProcessPool::platformResolvePathsForSandboxExtensions()
 {
 }
index 1015ff0..a88b53f 100644 (file)
@@ -53,6 +53,46 @@ void WebProcessPool::platformInvalidateContext()
     notImplemented();
 }
 
+String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache");
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaCache");
+}
+
+String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL");
+}
+
+String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB");
+}
+
+String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage");
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage");
+}
+
+String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache");
+}
+
+String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()
+{
+    return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug");
+}
+
 void WebProcessPool::platformResolvePathsForSandboxExtensions()
 {
 }
index c03e4e8..7cb8951 100644 (file)
@@ -78,6 +78,18 @@ void WebProcessPool::platformInitialize()
 #endif
 }
 
+WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
+{
+    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());
+}
+
+WTF::String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()
+{
+    GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());
+}
+
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;
@@ -97,6 +109,42 @@ void WebProcessPool::platformInvalidateContext()
     notImplemented();
 }
 
+String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()
+{
+    GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()
+{
+    GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
+{
+    GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(storageDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()
+{
+    GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
+{
+    GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get());
+}
+
+String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()
+{
+    GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "JavaScriptCoreDebug", nullptr));
+    return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());
+}
+
 void WebProcessPool::platformResolvePathsForSandboxExtensions()
 {
 }