Title: [267729] trunk/Source/WebKit
Revision
267729
Author
[email protected]
Date
2020-09-29 00:20:13 -0700 (Tue, 29 Sep 2020)

Log Message

[GTK] Stop using the default website data store for the inspector
https://bugs.webkit.org/show_bug.cgi?id=217034

Patch by Carlos Garcia Campos <[email protected]> on 2020-09-29
Reviewed by Michael Catanzaro.

The GTK should never use the default website data store. Use a dedicated website data store for the inspector
with its own configuration to store persistent data.

* UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
(WebKit::inspectorWebsiteDataStore):
(WebKit::WebInspectorProxy::platformCreateFrontendPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (267728 => 267729)


--- trunk/Source/WebKit/ChangeLog	2020-09-29 06:25:46 UTC (rev 267728)
+++ trunk/Source/WebKit/ChangeLog	2020-09-29 07:20:13 UTC (rev 267729)
@@ -1,3 +1,17 @@
+2020-09-29  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Stop using the default website data store for the inspector
+        https://bugs.webkit.org/show_bug.cgi?id=217034
+
+        Reviewed by Michael Catanzaro.
+
+        The GTK should never use the default website data store. Use a dedicated website data store for the inspector
+        with its own configuration to store persistent data.
+
+        * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::inspectorWebsiteDataStore):
+        (WebKit::WebInspectorProxy::platformCreateFrontendPage):
+
 2020-09-28  Peng Liu  <[email protected]>
 
         [Media in GPU Process] Use VideoLayerManager to manage layers of MediaPlayerPrivateRemote

Modified: trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp (267728 => 267729)


--- trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp	2020-09-29 06:25:46 UTC (rev 267728)
+++ trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp	2020-09-29 07:20:13 UTC (rev 267729)
@@ -42,6 +42,7 @@
 #include "WebPageGroup.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
+#include "WebsiteDataStore.h"
 #include <WebCore/CertificateInfo.h>
 #include <WebCore/GtkUtilities.h>
 #include <WebCore/GtkVersioning.h>
@@ -137,6 +138,26 @@
     *newMenuRef = menuItems;
 }
 
+static Ref<WebsiteDataStore> inspectorWebsiteDataStore()
+{
+    static const char* versionedDirectory = "webkitgtk-" WEBKITGTK_API_VERSION_STRING G_DIR_SEPARATOR_S "WebInspector" G_DIR_SEPARATOR_S;
+    String baseCacheDirectory = FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_user_cache_dir()), versionedDirectory);
+    String baseDataDirectory = FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(g_get_user_data_dir()), versionedDirectory);
+
+    auto configuration = WebsiteDataStoreConfiguration::create(IsPersistent::Yes, WillCopyPathsFromExistingConfiguration::Yes);
+    configuration->setNetworkCacheDirectory(FileSystem::pathByAppendingComponent(baseCacheDirectory, "WebKitCache"));
+    configuration->setApplicationCacheDirectory(FileSystem::pathByAppendingComponent(baseCacheDirectory, "applications"));
+    configuration->setHSTSStorageDirectory(String(baseCacheDirectory));
+    configuration->setCacheStorageDirectory(FileSystem::pathByAppendingComponent(baseCacheDirectory, "CacheStorage"));
+    configuration->setLocalStorageDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "localstorage"));
+    configuration->setIndexedDBDatabaseDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "indexeddb"));
+    configuration->setWebSQLDatabaseDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "databases"));
+    configuration->setResourceLoadStatisticsDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "itp"));
+    configuration->setServiceWorkerRegistrationDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "serviceworkers"));
+    configuration->setDeviceIdHashSaltsStorageDirectory(FileSystem::pathByAppendingComponent(baseDataDirectory, "deviceidhashsalts"));
+    return WebsiteDataStore::create(WTFMove(configuration), PAL::SessionID::defaultSessionID());
+}
+
 WebPageProxy* WebInspectorProxy::platformCreateFrontendPage()
 {
     ASSERT(inspectedPage());
@@ -152,11 +173,15 @@
     preferences->setJavaScriptRuntimeFlags({
     });
     auto pageGroup = WebPageGroup::create(inspectorPageGroupIdentifierForPage(inspectedPage()));
+    auto websiteDataStore = inspectorWebsiteDataStore();
+    auto& processPool = inspectorProcessPool(inspectionLevel());
+    processPool.setPrimaryDataStore(websiteDataStore.get());
 
     auto pageConfiguration = API::PageConfiguration::create();
-    pageConfiguration->setProcessPool(&inspectorProcessPool(inspectionLevel()));
+    pageConfiguration->setProcessPool(&processPool);
     pageConfiguration->setPreferences(preferences.ptr());
     pageConfiguration->setPageGroup(pageGroup.ptr());
+    pageConfiguration->setWebsiteDataStore(websiteDataStore.ptr());
     m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(*pageConfiguration.ptr()));
     g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast<void**>(&m_inspectorView));
     g_signal_connect(m_inspectorView, "destroy", G_CALLBACK(inspectorViewDestroyed), this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to