Title: [225490] trunk/Source
Revision
225490
Author
beid...@apple.com
Date
2017-12-04 13:50:31 -0800 (Mon, 04 Dec 2017)

Log Message

Get a directory path to SWServers for storing ServiceWorker registrations.
https://bugs.webkit.org/show_bug.cgi?id=180362

Reviewed by Chris Dumez.

Source/WebCore:

No new tests (No observable behavior change yet).

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::SWServer):
* workers/service/server/SWServer.h:

Source/WebKit:

This gets all of the plumbing in place for specifying a ServiceWorker registration storage path
in a particular WebsiteDataStore.

* Shared/Storage/StorageProcessCreationParameters.cpp:
(WebKit::StorageProcessCreationParameters::encode const):
(WebKit::StorageProcessCreationParameters::decode):
* Shared/Storage/StorageProcessCreationParameters.h:

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::initializeWebsiteDataStore):
(WebKit::StorageProcess::swServerForSession):
* StorageProcess/StorageProcess.h:

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
(API::ProcessPoolConfiguration::ProcessPoolConfiguration):
* UIProcess/API/APIProcessPoolConfiguration.h:

* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
(API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
* UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
(API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
(WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
* UIProcess/WebProcessPool.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
(WebKit::WebsiteDataStore::storageProcessParameters):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedServiceWorkerRegistrationDirectory const):

* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):

* UIProcess/wpe/WebProcessPoolWPE.cpp:
(WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225489 => 225490)


--- trunk/Source/WebCore/ChangeLog	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebCore/ChangeLog	2017-12-04 21:50:31 UTC (rev 225490)
@@ -1,3 +1,16 @@
+2017-12-04  Brady Eidson  <beid...@apple.com>
+
+        Get a directory path to SWServers for storing ServiceWorker registrations.
+        https://bugs.webkit.org/show_bug.cgi?id=180362
+
+        Reviewed by Chris Dumez.
+
+        No new tests (No observable behavior change yet).
+
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::SWServer):
+        * workers/service/server/SWServer.h:
+
 2017-12-04  Devin Rousso  <web...@devinrousso.com>
 
         Web Inspector: provide method for recording CanvasRenderingContext2D from _javascript_

Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (225489 => 225490)


--- trunk/Source/WebCore/workers/service/server/SWServer.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -204,9 +204,10 @@
         m_server.syncTerminateWorker(*worker);
 }
 
-SWServer::SWServer(UniqueRef<SWOriginStore>&& originStore)
+SWServer::SWServer(UniqueRef<SWOriginStore>&& originStore, const String& registrationDatabaseDirectory)
     : m_originStore(WTFMove(originStore))
 {
+    UNUSED_PARAM(registrationDatabaseDirectory);
     allServers().add(this);
     m_taskThread = Thread::create(ASCIILiteral("ServiceWorker Task Thread"), [this] {
         taskThreadEntryPoint();

Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (225489 => 225490)


--- trunk/Source/WebCore/workers/service/server/SWServer.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -105,7 +105,7 @@
         Identifier m_identifier;
     };
 
-    WEBCORE_EXPORT explicit SWServer(UniqueRef<SWOriginStore>&&);
+    WEBCORE_EXPORT explicit SWServer(UniqueRef<SWOriginStore>&&, const String& registrationDatabaseDirectory);
     WEBCORE_EXPORT ~SWServer();
 
     WEBCORE_EXPORT void clearAll();

Modified: trunk/Source/WebKit/ChangeLog (225489 => 225490)


--- trunk/Source/WebKit/ChangeLog	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/ChangeLog	2017-12-04 21:50:31 UTC (rev 225490)
@@ -1,3 +1,54 @@
+2017-12-04  Brady Eidson  <beid...@apple.com>
+
+        Get a directory path to SWServers for storing ServiceWorker registrations.
+        https://bugs.webkit.org/show_bug.cgi?id=180362
+
+        Reviewed by Chris Dumez.
+
+        This gets all of the plumbing in place for specifying a ServiceWorker registration storage path
+        in a particular WebsiteDataStore.
+
+        * Shared/Storage/StorageProcessCreationParameters.cpp:
+        (WebKit::StorageProcessCreationParameters::encode const):
+        (WebKit::StorageProcessCreationParameters::decode):
+        * Shared/Storage/StorageProcessCreationParameters.h:
+
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::initializeWebsiteDataStore):
+        (WebKit::StorageProcess::swServerForSession):
+        * StorageProcess/StorageProcess.h:
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::createWithLegacyOptions):
+        (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
+        (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+
+        * UIProcess/API/APIWebsiteDataStore.h:
+        * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
+        (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
+        * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
+        (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
+        (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
+        * UIProcess/WebProcessPool.h:
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
+        (WebKit::WebsiteDataStore::storageProcessParameters):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::resolvedServiceWorkerRegistrationDirectory const):
+
+        * UIProcess/gtk/WebProcessPoolGtk.cpp:
+        (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
+
+        * UIProcess/wpe/WebProcessPoolWPE.cpp:
+        (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
+
 2017-12-04  Frederic Wang  <fw...@igalia.com>
 
         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes

Modified: trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp (225489 => 225490)


--- trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -36,23 +36,31 @@
 
 void StorageProcessCreationParameters::encode(IPC::Encoder& encoder) const
 {
+    encoder << sessionID;
 #if ENABLE(INDEXED_DATABASE)
-    encoder << sessionID;
-    encoder << indexedDatabaseDirectory;
-    encoder << indexedDatabaseDirectoryExtensionHandle;
+    encoder << indexedDatabaseDirectory << indexedDatabaseDirectoryExtensionHandle;
 #endif
+#if ENABLE(SERVICE_WORKER)
+    encoder << serviceWorkerRegistrationDirectory << serviceWorkerRegistrationDirectoryExtensionHandle;
+#endif
 }
 
 bool StorageProcessCreationParameters::decode(IPC::Decoder& decoder, StorageProcessCreationParameters& result)
 {
-#if ENABLE(INDEXED_DATABASE)
     if (!decoder.decode(result.sessionID))
         return false;
+#if ENABLE(INDEXED_DATABASE)
     if (!decoder.decode(result.indexedDatabaseDirectory))
         return false;
     if (!decoder.decode(result.indexedDatabaseDirectoryExtensionHandle))
         return false;
 #endif
+#if ENABLE(SERVICE_WORKER)
+    if (!decoder.decode(result.serviceWorkerRegistrationDirectory))
+        return false;
+    if (!decoder.decode(result.serviceWorkerRegistrationDirectoryExtensionHandle))
+        return false;
+#endif
 
     return true;
 }

Modified: trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.h (225489 => 225490)


--- trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/Shared/Storage/StorageProcessCreationParameters.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -49,6 +49,11 @@
     String indexedDatabaseDirectory;
     SandboxExtension::Handle indexedDatabaseDirectoryExtensionHandle;
 #endif
+
+#if ENABLE(SERVICE_WORKER)
+    String serviceWorkerRegistrationDirectory;
+    SandboxExtension::Handle serviceWorkerRegistrationDirectoryExtensionHandle;
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (225489 => 225490)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -143,15 +143,23 @@
     // IMPORTANT: Do not change the directory structure for indexed databases on disk without first consulting a reviewer from Apple (<rdar://problem/17454712>)
     // *********
 
-    auto addResult = m_idbDatabasePaths.add(parameters.sessionID, String());
-    if (!addResult.isNewEntry)
-        return;
-
-    addResult.iterator->value = parameters.indexedDatabaseDirectory;
-    SandboxExtension::consumePermanently(parameters.indexedDatabaseDirectoryExtensionHandle);
-
-    postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.indexedDatabaseDirectory));
+    auto addResult = m_idbDatabasePaths.ensure(parameters.sessionID, [path = parameters.indexedDatabaseDirectory] {
+        return path;
+    });
+    if (addResult.isNewEntry) {
+        SandboxExtension::consumePermanently(parameters.indexedDatabaseDirectoryExtensionHandle);
+        postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.indexedDatabaseDirectory));
+    }
 #endif
+#if ENABLE(SERVICE_WORKER)
+    addResult = m_swDatabasePaths.ensure(parameters.sessionID, [path = parameters.serviceWorkerRegistrationDirectory] {
+        return path;
+    });
+    if (addResult.isNewEntry) {
+        SandboxExtension::consumePermanently(parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
+        postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.serviceWorkerRegistrationDirectory));
+    }
+#endif
 }
 
 void StorageProcess::ensurePathExists(const String& path)
@@ -371,10 +379,17 @@
 SWServer& StorageProcess::swServerForSession(PAL::SessionID sessionID)
 {
     auto result = m_swServers.add(sessionID, nullptr);
-    if (result.isNewEntry)
-        result.iterator->value = std::make_unique<SWServer>(makeUniqueRef<WebSWOriginStore>());
+    if (!result.isNewEntry) {
+        ASSERT(result.iterator->value);
+        return *result.iterator->value;
+    }
 
-    ASSERT(result.iterator->value);
+    auto path = m_swDatabasePaths.get(sessionID);
+    // There should already be a registered path for this PAL::SessionID.
+    // If there's not, then where did this PAL::SessionID come from?
+    ASSERT(!path.isEmpty());
+
+    result.iterator->value = std::make_unique<SWServer>(makeUniqueRef<WebSWOriginStore>(), path);
     return *result.iterator->value;
 }
 

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (225489 => 225490)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -161,6 +161,7 @@
 
     RefPtr<WebSWServerToContextConnection> m_serverToContextConnection;
     bool m_waitingForServerToContextProcessConnection { false };
+    HashMap<PAL::SessionID, String> m_swDatabasePaths;
     HashMap<PAL::SessionID, std::unique_ptr<WebCore::SWServer>> m_swServers;
     HashMap<WebCore::SWServerConnectionIdentifier, WebSWServerConnection*> m_swServerConnections;
 #endif

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -49,6 +49,7 @@
     configuration->m_diskCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory();
     configuration->m_mediaCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory();
     configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
+    configuration->m_serviceWorkerRegistrationDirectory = WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory();
     configuration->m_localStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory();
     configuration->m_mediaKeysStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory();
     configuration->m_webSQLDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory();
@@ -66,6 +67,7 @@
     configuration->m_diskCacheDirectory = legacyConfiguration.networkCacheDirectory;
     configuration->m_mediaCacheDirectory = legacyConfiguration.mediaCacheDirectory;
     configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
+    configuration->m_serviceWorkerRegistrationDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
     configuration->m_localStorageDirectory = legacyConfiguration.localStorageDirectory;
     configuration->m_mediaKeysStorageDirectory = legacyConfiguration.mediaKeysStorageDirectory;
     configuration->m_resourceLoadStatisticsDirectory = legacyConfiguration.resourceLoadStatisticsDirectory;
@@ -80,6 +82,7 @@
     , m_diskCacheDirectory(WebsiteDataStore::defaultNetworkCacheDirectory())
     , m_mediaCacheDirectory(WebsiteDataStore::defaultMediaCacheDirectory())
     , m_indexedDBDatabaseDirectory(WebsiteDataStore::defaultIndexedDBDatabaseDirectory())
+    , m_serviceWorkerRegistrationDirectory(WebsiteDataStore::defaultServiceWorkerRegistrationDirectory())
     , m_localStorageDirectory(WebsiteDataStore::defaultLocalStorageDirectory())
     , m_webSQLDatabaseDirectory(WebsiteDataStore::defaultWebSQLDatabaseDirectory())
     , m_mediaKeysStorageDirectory(WebsiteDataStore::defaultMediaKeysStorageDirectory())

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -76,6 +76,9 @@
     const WTF::String& indexedDBDatabaseDirectory() const { return m_indexedDBDatabaseDirectory; }
     void setIndexedDBDatabaseDirectory(const WTF::String& indexedDBDatabaseDirectory) { m_indexedDBDatabaseDirectory = indexedDBDatabaseDirectory; }
 
+    const WTF::String& serviceWorkerRegistrationDirectory() const { return m_serviceWorkerRegistrationDirectory; }
+    void setServiceWorkerRegistrationDirectory(const WTF::String& directory) { m_serviceWorkerRegistrationDirectory = directory; }
+    
     const WTF::String& injectedBundlePath() const { return m_injectedBundlePath; }
     void setInjectedBundlePath(const WTF::String& injectedBundlePath) { m_injectedBundlePath = injectedBundlePath; }
 
@@ -148,6 +151,7 @@
     WTF::String m_diskCacheDirectory;
     WTF::String m_mediaCacheDirectory;
     WTF::String m_indexedDBDatabaseDirectory;
+    WTF::String m_serviceWorkerRegistrationDirectory;
     WTF::String m_injectedBundlePath;
     WTF::String m_localStorageDirectory;
     WTF::String m_webSQLDatabaseDirectory;

Modified: trunk/Source/WebKit/UIProcess/API/APIWebsiteDataStore.h (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/API/APIWebsiteDataStore.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsiteDataStore.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -58,6 +58,7 @@
     static String defaultMediaCacheDirectory();
 
     static String defaultIndexedDBDatabaseDirectory();
+    static String defaultServiceWorkerRegistrationDirectory();
     static String defaultLocalStorageDirectory();
     static String defaultMediaKeysStorageDirectory();
     static String defaultWebSQLDatabaseDirectory();

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2017-12-04 21:50:31 UTC (rev 225490)
@@ -72,6 +72,11 @@
     return websiteDataDirectoryFileSystemRepresentation("IndexedDB");
 }
 
+String WebsiteDataStore::defaultServiceWorkerRegistrationDirectory()
+{
+    return websiteDataDirectoryFileSystemRepresentation("ServiceWorkers");
+}
+
 String WebsiteDataStore::defaultLocalStorageDirectory()
 {
     return websiteDataDirectoryFileSystemRepresentation("LocalStorage");

Modified: trunk/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -58,6 +58,12 @@
     return websiteDataDirectoryFileSystemRepresentation(BASE_DIRECTORY G_DIR_SEPARATOR_S "databases" G_DIR_SEPARATOR_S "indexeddb");
 }
 
+String WebsiteDataStore::defaultServiceWorkerRegistrationDirectory()
+{
+    // FIXME: Implement
+    return { };
+}
+
 String WebsiteDataStore::defaultLocalStorageDirectory()
 {
     return websiteDataDirectoryFileSystemRepresentation(BASE_DIRECTORY G_DIR_SEPARATOR_S "localstorage");

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-12-04 21:50:31 UTC (rev 225490)
@@ -62,6 +62,7 @@
 using namespace WebCore;
 
 NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
+NSString *WebServiceWorkerRegistrationDirectoryDefaultsKey = @"WebServiceWorkerRegistrationDirectory";
 NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
 NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";
 NSString *WebKitJSCJITEnabledDefaultsKey = @"WebKitJSCJITEnabledDefaultsKey";
@@ -389,6 +390,16 @@
     return FileSystem::pathByAppendingComponent(legacyPlatformDefaultWebSQLDatabaseDirectory(), "___IndexedDB");
 }
 
+String WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory()
+{
+    registerUserDefaultsIfNeeded();
+
+    NSString *directory = [[NSUserDefaults standardUserDefaults] objectForKey:WebServiceWorkerRegistrationDirectoryDefaultsKey];
+    if (!directory || ![directory isKindOfClass:[NSString class]])
+        directory = @"~/Library/WebKit/ServiceWorkers";
+    return stringByResolvingSymlinksInPath([directory stringByStandardizingPath]);
+}
+
 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
 {
     registerUserDefaultsIfNeeded();

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -559,6 +559,12 @@
             SandboxExtension::createHandleForReadWriteDirectory(parameters.indexedDatabaseDirectory, parameters.indexedDatabaseDirectoryExtensionHandle);
         }
 #endif
+#if ENABLE(SERVICE_WORKER)
+        if (parameters.serviceWorkerRegistrationDirectory.isEmpty()) {
+            parameters.serviceWorkerRegistrationDirectory = m_configuration->serviceWorkerRegistrationDirectory();
+            SandboxExtension::createHandleForReadWriteDirectory(parameters.serviceWorkerRegistrationDirectory, parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
+        }
+#endif
 
         m_storageProcess = StorageProcessProxy::create(*this);
         m_storageProcess->send(Messages::StorageProcess::InitializeWebsiteDataStore(parameters), 0);

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -390,6 +390,7 @@
     // FIXME: Move these to API::WebsiteDataStore.
     static String legacyPlatformDefaultLocalStorageDirectory();
     static String legacyPlatformDefaultIndexedDBDatabaseDirectory();
+    static String legacyPlatformDefaultServiceWorkerRegistrationDirectory();
     static String legacyPlatformDefaultWebSQLDatabaseDirectory();
     static String legacyPlatformDefaultMediaKeysStorageDirectory();
     static String legacyPlatformDefaultMediaCacheDirectory();

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -113,13 +113,12 @@
         m_resolvedConfiguration.mediaKeysStorageDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.mediaKeysStorageDirectory);
     if (!m_configuration.webSQLDatabaseDirectory.isEmpty())
         m_resolvedConfiguration.webSQLDatabaseDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.webSQLDatabaseDirectory);
-
     if (!m_configuration.indexedDBDatabaseDirectory.isEmpty())
         m_resolvedConfiguration.indexedDBDatabaseDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.indexedDBDatabaseDirectory);
-
+    if (!m_configuration.serviceWorkerRegistrationDirectory.isEmpty())
+        m_resolvedConfiguration.serviceWorkerRegistrationDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration.serviceWorkerRegistrationDirectory);
     if (!m_configuration._javascript_ConfigurationDirectory.isEmpty())
         m_resolvedConfiguration._javascript_ConfigurationDirectory = resolvePathForSandboxExtension(m_configuration._javascript_ConfigurationDirectory);
-
     if (!m_configuration.cacheStorageDirectory.isEmpty() && m_resolvedConfiguration.cacheStorageDirectory.isEmpty())
         m_resolvedConfiguration.cacheStorageDirectory = resolvePathForSandboxExtension(m_configuration.cacheStorageDirectory);
 
@@ -1376,6 +1375,11 @@
     if (!parameters.indexedDatabaseDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(parameters.indexedDatabaseDirectory, parameters.indexedDatabaseDirectoryExtensionHandle);
 #endif
+#if ENABLE(SERVICE_WORKER)
+    parameters.serviceWorkerRegistrationDirectory = resolvedServiceWorkerRegistrationDirectory();
+    if (!parameters.serviceWorkerRegistrationDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(parameters.serviceWorkerRegistrationDirectory, parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
+#endif
 
     return parameters;
 }

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2017-12-04 21:50:31 UTC (rev 225490)
@@ -79,6 +79,7 @@
 
         String mediaCacheDirectory;
         String indexedDBDatabaseDirectory;
+        String serviceWorkerRegistrationDirectory;
         String webSQLDatabaseDirectory;
         String localStorageDirectory;
         String mediaKeysStorageDirectory;
@@ -127,6 +128,7 @@
     const String& resolvedJavaScriptConfigurationDirectory() const { return m_resolvedConfiguration._javascript_ConfigurationDirectory; }
     const String& resolvedCookieStorageFile() const { return m_resolvedConfiguration.cookieStorageFile; }
     const String& resolvedIndexedDatabaseDirectory() const { return m_resolvedConfiguration.indexedDBDatabaseDirectory; }
+    const String& resolvedServiceWorkerRegistrationDirectory() const { return m_resolvedConfiguration.serviceWorkerRegistrationDirectory; }
 
     StorageManager* storageManager() { return m_storageManager.get(); }
 

Modified: trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -106,6 +106,11 @@
     return API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory();
 }
 
+String WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory()
+{
+    return API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory();
+}
+
 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
 {
     return API::WebsiteDataStore::defaultLocalStorageDirectory();

Modified: trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp (225489 => 225490)


--- trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp	2017-12-04 21:43:36 UTC (rev 225489)
+++ trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp	2017-12-04 21:50:31 UTC (rev 225490)
@@ -111,6 +111,13 @@
     return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get());
 }
 
+String WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory()
+{
+    // FIXME: Implement when implementing ServiceWorkers
+    notImplemented();
+    return String();
+}
+
 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()
 {
     GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to