- Revision
- 184851
- Author
- [email protected]
- Date
- 2015-05-25 08:15:38 -0700 (Mon, 25 May 2015)
Log Message
[GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
https://bugs.webkit.org/show_bug.cgi?id=140882
Reviewed by Gustavo Noronha Silva.
Source/WebKit2:
Add WebKitWebContext:indexed-db-database-directory construct only property.
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextGetProperty):
(webkitWebContextSetProperty):
(webkitWebContextConstructed):
(webkit_web_context_class_init):
Tools:
Make sure unit tests write IndexedDB databases to the temporary
directory, and add a test case to check that the directory is
correctly created at the expected path.
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
(testWebContextConfiguration):
(serverCallback):
* TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
(Test::Test):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (184850 => 184851)
--- trunk/Source/WebKit2/ChangeLog 2015-05-25 07:05:03 UTC (rev 184850)
+++ trunk/Source/WebKit2/ChangeLog 2015-05-25 15:15:38 UTC (rev 184851)
@@ -1,3 +1,18 @@
+2015-05-25 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
+ https://bugs.webkit.org/show_bug.cgi?id=140882
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Add WebKitWebContext:indexed-db-database-directory construct only property.
+
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (webkitWebContextGetProperty):
+ (webkitWebContextSetProperty):
+ (webkitWebContextConstructed):
+ (webkit_web_context_class_init):
+
2015-05-24 Sam Weinig <[email protected]>
Crash when using a removed ScriptMessageHandler
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (184850 => 184851)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2015-05-25 07:05:03 UTC (rev 184850)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp 2015-05-25 15:15:38 UTC (rev 184851)
@@ -102,7 +102,8 @@
enum {
PROP_0,
- PROP_LOCAL_STORAGE_DIRECTORY
+ PROP_LOCAL_STORAGE_DIRECTORY,
+ PROP_INDEXED_DB_DIRECTORY
};
enum {
@@ -182,6 +183,7 @@
GRefPtr<GVariant> webExtensionsInitializationUserData;
CString localStorageDirectory;
+ CString indexedDBDirectory;
};
static guint signals[LAST_SIGNAL] = { 0, };
@@ -235,6 +237,9 @@
case PROP_LOCAL_STORAGE_DIRECTORY:
g_value_set_string(value, context->priv->localStorageDirectory.data());
break;
+ case PROP_INDEXED_DB_DIRECTORY:
+ g_value_set_string(value, context->priv->indexedDBDirectory.data());
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
}
@@ -248,6 +253,9 @@
case PROP_LOCAL_STORAGE_DIRECTORY:
context->priv->localStorageDirectory = g_value_get_string(value);
break;
+ case PROP_INDEXED_DB_DIRECTORY:
+ context->priv->indexedDBDirectory = g_value_get_string(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
}
@@ -266,6 +274,8 @@
WebKitWebContextPrivate* priv = webContext->priv;
if (!priv->localStorageDirectory.isNull())
configuration->setLocalStorageDirectory(WebCore::filenameToString(priv->localStorageDirectory.data()));
+ if (!priv->indexedDBDirectory.isNull())
+ configuration->setIndexedDBDatabaseDirectory(WebCore::filenameToString(priv->indexedDBDirectory.data()));
priv->context = WebProcessPool::create(configuration.get());
@@ -332,6 +342,23 @@
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
/**
+ * WebKitWebContext:indexed-db-directory:
+ *
+ * The directory where IndexedDB databases will be saved.
+ *
+ * Since: 2.10
+ */
+ g_object_class_install_property(
+ gObjectClass,
+ PROP_INDEXED_DB_DIRECTORY,
+ g_param_spec_string(
+ "indexed-db-directory",
+ _("IndexedDB Directory"),
+ _("The directory where IndexedDB databases 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 (184850 => 184851)
--- trunk/Tools/ChangeLog 2015-05-25 07:05:03 UTC (rev 184850)
+++ trunk/Tools/ChangeLog 2015-05-25 15:15:38 UTC (rev 184851)
@@ -1,5 +1,22 @@
2015-05-25 Carlos Garcia Campos <[email protected]>
+ [GTK] Add construct property to WebKitWebContext to set the IndexedDB database directory
+ https://bugs.webkit.org/show_bug.cgi?id=140882
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Make sure unit tests write IndexedDB databases to the temporary
+ directory, and add a test case to check that the directory is
+ correctly created at the expected path.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
+ (testWebContextConfiguration):
+ (serverCallback):
+ * TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
+ (Test::Test):
+
+2015-05-25 Carlos Garcia Campos <[email protected]>
+
[GTK] Enable IndexedDB
https://bugs.webkit.org/show_bug.cgi?id=98932
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (184850 => 184851)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2015-05-25 07:05:03 UTC (rev 184850)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2015-05-25 15:15:38 UTC (rev 184851)
@@ -41,6 +41,12 @@
{
GUniquePtr<char> localStorageDirectory(g_build_filename(Test::dataDirectory(), "local-storage", nullptr));
g_assert(g_file_test(localStorageDirectory.get(), G_FILE_TEST_IS_DIR));
+
+ test->loadURI(kServer->getURIForPath("/empty").data());
+ test->waitUntilLoadFinished();
+ test->runJavaScriptAndWaitUntilFinished("window.indexedDB.open('TestDatabase');", nullptr);
+ GUniquePtr<char> indexedDBDirectory(g_build_filename(Test::dataDirectory(), "indexeddb", nullptr));
+ g_assert(g_file_test(indexedDBDirectory.get(), G_FILE_TEST_IS_DIR));
}
class PluginsTest: public Test {
@@ -330,6 +336,11 @@
soup_message_set_status(message, SOUP_STATUS_OK);
soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage));
soup_message_body_complete(message->response_body);
+ } else if (g_str_equal(path, "/empty")) {
+ const char* emptyHTML = "<html><body></body></html>";
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, emptyHTML, strlen(emptyHTML));
+ soup_message_body_complete(message->response_body);
+ soup_message_set_status(message, SOUP_STATUS_OK);
} else
soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
}
Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h (184850 => 184851)
--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h 2015-05-25 07:05:03 UTC (rev 184850)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h 2015-05-25 15:15:38 UTC (rev 184851)
@@ -68,7 +68,11 @@
Test()
{
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)));
+ GUniquePtr<char> indexedDBDirectory(g_build_filename(dataDirectory(), "indexeddb", nullptr));
+ m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT,
+ "local-storage-directory", localStorageDirectory.get(),
+ "indexed-db-directory", indexedDBDirectory.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));