Diff
Modified: trunk/Source/WebKit2/ChangeLog (176511 => 176512)
--- trunk/Source/WebKit2/ChangeLog 2014-11-24 05:21:13 UTC (rev 176511)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-24 07:24:01 UTC (rev 176512)
@@ -1,3 +1,19 @@
+2014-11-23 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Add API to override the default local storage directory
+ https://bugs.webkit.org/show_bug.cgi?id=138828
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Add WebKitWebContext:local-storage-directory construct-only
+ property. If not provided the default will be used.
+
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (webkitWebContextGetProperty):
+ (webkitWebContextSetProperty):
+ (webkitWebContextConstructed):
+ (webkit_web_context_class_init):
+
2014-11-23 Conrad Shultz <[email protected]>
Page previews should have titles
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (176511 => 176512)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2014-11-24 05:21:13 UTC (rev 176511)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2014-11-24 07:24:01 UTC (rev 176512)
@@ -48,6 +48,7 @@
#include <WebCore/FileSystem.h>
#include <WebCore/IconDatabase.h>
#include <WebCore/Language.h>
+#include <glib/gi18n-lib.h>
#include <libintl.h>
#include <memory>
#include <wtf/HashMap.h>
@@ -95,6 +96,12 @@
*/
enum {
+ PROP_0,
+
+ PROP_LOCAL_STORAGE_DIRECTORY
+};
+
+enum {
DOWNLOAD_STARTED,
INITIALIZE_WEB_EXTENSIONS,
@@ -169,6 +176,8 @@
CString webExtensionsDirectory;
GRefPtr<GVariant> webExtensionsInitializationUserData;
+
+ CString localStorageDirectory;
};
static guint signals[LAST_SIGNAL] = { 0, };
@@ -212,6 +221,32 @@
return injectedBundlePath;
}
+static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* paramSpec)
+{
+ WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object);
+
+ switch (propID) {
+ case PROP_LOCAL_STORAGE_DIRECTORY:
+ g_value_set_string(value, context->priv->localStorageDirectory.data());
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
+ }
+}
+
+static void webkitWebContextSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* paramSpec)
+{
+ WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object);
+
+ switch (propID) {
+ case PROP_LOCAL_STORAGE_DIRECTORY:
+ context->priv->localStorageDirectory = g_value_get_string(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
+ }
+}
+
static void webkitWebContextConstructed(GObject* object)
{
G_OBJECT_CLASS(webkit_web_context_parent_class)->constructed(object);
@@ -220,9 +255,11 @@
WebContextConfiguration webContextConfiguration;
webContextConfiguration.injectedBundlePath = WebCore::filenameToString(bundleFilename.get());
WebContext::applyPlatformSpecificConfigurationDefaults(webContextConfiguration);
-
WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
WebKitWebContextPrivate* priv = webContext->priv;
+ if (!priv->localStorageDirectory.isNull())
+ webContextConfiguration.localStorageDirectory = WebCore::filenameToString(priv->localStorageDirectory.data());
+
priv->context = WebContext::create(WTF::move(webContextConfiguration));
priv->requestManager = priv->context->supplement<WebSoupCustomProtocolRequestManager>();
@@ -265,10 +302,29 @@
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ gObjectClass->get_property = webkitWebContextGetProperty;
+ gObjectClass->set_property = webkitWebContextSetProperty;
gObjectClass->constructed = webkitWebContextConstructed;
gObjectClass->dispose = webkitWebContextDispose;
/**
+ * WebKitWebContext:local-storage-directory:
+ *
+ * The directory where local storage data will be saved.
+ *
+ * Since: 2.8
+ */
+ g_object_class_install_property(
+ gObjectClass,
+ PROP_LOCAL_STORAGE_DIRECTORY,
+ g_param_spec_string(
+ "local-storage-directory",
+ _("Local Storage Directory"),
+ _("The directory where local storage data will be saved"),
+ nullptr,
+ static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+
+ /**
* WebKitWebContext::download-started:
* @context: the #WebKitWebContext
* @download: the #WebKitDownload associated with this event
Modified: trunk/Tools/ChangeLog (176511 => 176512)
--- trunk/Tools/ChangeLog 2014-11-24 05:21:13 UTC (rev 176511)
+++ trunk/Tools/ChangeLog 2014-11-24 07:24:01 UTC (rev 176512)
@@ -1,3 +1,20 @@
+2014-11-23 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Add API to override the default local storage directory
+ https://bugs.webkit.org/show_bug.cgi?id=138828
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Add test to check that the local storage directory is created at
+ the path given on construction.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
+ (testWebContextConfiguration):
+ (beforeAll):
+ * TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
+ (Test::Test):
+ (Test::~Test): Deleted.
+
2014-11-21 Zalan Bujtas <[email protected]>
Simple line layout: Add "show simple line layout debug borders" setting to MiniBrowser.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (176511 => 176512)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2014-11-24 05:21:13 UTC (rev 176511)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2014-11-24 07:24:01 UTC (rev 176512)
@@ -37,6 +37,12 @@
g_assert(webkit_web_context_get_default() != test->m_webContext.get());
}
+static void testWebContextConfiguration(WebViewTest* test, gconstpointer)
+{
+ GUniquePtr<char> localStorageDirectory(g_build_filename(Test::dataDirectory(), "local-storage", nullptr));
+ g_assert(g_file_test(localStorageDirectory.get(), G_FILE_TEST_IS_DIR));
+}
+
class PluginsTest: public Test {
public:
MAKE_GLIB_TEST_FIXTURE(PluginsTest);
@@ -411,6 +417,7 @@
kServer->run(serverCallback);
Test::add("WebKitWebContext", "default-context", testWebContextDefault);
+ WebViewTest::add("WebKitWebContext", "configuration", testWebContextConfiguration);
PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins);
URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme);
Test::add("WebKitWebContext", "spell-checker", testWebContextSpellChecker);
Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h (176511 => 176512)
--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h 2014-11-24 05:21:13 UTC (rev 176511)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h 2014-11-24 07:24:01 UTC (rev 176512)
@@ -66,8 +66,10 @@
}
Test()
- : m_webContext(adoptGRef(webkit_web_context_new()))
{
+ GUniquePtr<char> localStorageDirectory(g_build_filename(dataDirectory(), "local-storage", nullptr));
+ m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "local-storage-directory", localStorageDirectory.get(), nullptr)));
+
g_signal_connect(m_webContext.get(), "initialize-web-extensions", G_CALLBACK(initializeWebExtensionsCallback), this);
GUniquePtr<char> diskCacheDirectory(g_build_filename(dataDirectory(), "disk-cache", nullptr));
webkit_web_context_set_disk_cache_directory(m_webContext.get(), diskCacheDirectory.get());