Title: [140153] trunk
Revision
140153
Author
[email protected]
Date
2013-01-18 08:27:12 -0800 (Fri, 18 Jan 2013)

Log Message

[GTK] Add property for IndexedDB database path to WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=106136

Reviewed by Gustavo Noronha Silva.

Source/WebKit/gtk:

Make the web database directory affect both the legacy SQLite web
database API and the newer indexed database API. This will allow us
to run IDB tests in WebKit1.

* webkit/webkitglobals.cpp:
(webkitPageGroupName): Added this helper to get the default page
group name.
* webkit/webkitglobalsprivate.h: Added a declaration for the helper.
* webkit/webkitwebdatabase.cpp:
(webkit_get_web_database_directory_path): Just return the cached value.
This is always set by webkitInit.
(webkit_set_web_database_directory_path): Set both the IDB and legacy
database paths.
* webkit/webkitwebview.cpp:
(webkit_web_view_init): Use the new page group name helper.

Tools:

During testing, set the web database directory to DUMPRENDERTREE_TEMP
before falling back to the old default. This is necessary because
indexed database tests require that each DRT shard is using a different
IDB database location.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(temporaryDatabaseDirectory): Added this helper for getting the
database directory.
(setDefaultsToConsistentStateValuesForTesting): Use the new helper.

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (140152 => 140153)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-01-18 16:27:12 UTC (rev 140153)
@@ -1,3 +1,26 @@
+2013-01-18  Martin Robinson  <[email protected]>
+
+        [GTK] Add property for IndexedDB database path to WebKitGTK+
+        https://bugs.webkit.org/show_bug.cgi?id=106136
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Make the web database directory affect both the legacy SQLite web
+        database API and the newer indexed database API. This will allow us
+        to run IDB tests in WebKit1.
+
+        * webkit/webkitglobals.cpp:
+        (webkitPageGroupName): Added this helper to get the default page
+        group name.
+        * webkit/webkitglobalsprivate.h: Added a declaration for the helper.
+        * webkit/webkitwebdatabase.cpp:
+        (webkit_get_web_database_directory_path): Just return the cached value.
+        This is always set by webkitInit.
+        (webkit_set_web_database_directory_path): Set both the IDB and legacy
+        database paths.
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_init): Use the new page group name helper.
+
 2013-01-18  Seokju Kwon  <[email protected]>
 
         Add explicit keyword to constructors in platform-specific InspectorClient

Modified: trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp (140152 => 140153)


--- trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp	2013-01-18 16:27:12 UTC (rev 140153)
@@ -570,3 +570,8 @@
 
     atexit(webkitExit);
 }
+
+const char* webkitPageGroupName()
+{
+    return "org.webkit.gtk.WebKitGTK";
+}

Modified: trunk/Source/WebKit/gtk/webkit/webkitglobalsprivate.h (140152 => 140153)


--- trunk/Source/WebKit/gtk/webkit/webkitglobalsprivate.h	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Source/WebKit/gtk/webkit/webkitglobalsprivate.h	2013-01-18 16:27:12 UTC (rev 140153)
@@ -33,6 +33,7 @@
 extern "C" {
 
 void webkitInit();
+const char* webkitPageGroupName();
 
 }
 

Modified: trunk/Source/WebKit/gtk/webkit/webkitwebdatabase.cpp (140152 => 140153)


--- trunk/Source/WebKit/gtk/webkit/webkitwebdatabase.cpp	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebdatabase.cpp	2013-01-18 16:27:12 UTC (rev 140153)
@@ -22,6 +22,9 @@
 
 #include "DatabaseDetails.h"
 #include "DatabaseManager.h"
+#include "FileSystem.h"
+#include "GroupSettings.h"
+#include "PageGroup.h"
 #include "webkitglobalsprivate.h"
 #include "webkitsecurityoriginprivate.h"
 #include <glib/gi18n-lib.h>
@@ -74,7 +77,7 @@
     gchar* filename;
 };
 
-static gchar* webkit_database_directory_path = NULL;
+static CString gWebKitWebDatabasePath;
 static guint64 webkit_default_database_quota = 5 * 1024 * 1024;
 
 static void webkit_web_database_set_security_origin(WebKitWebDatabase* webDatabase, WebKitSecurityOrigin* security_origin);
@@ -457,47 +460,40 @@
  * webkit_get_web_database_directory_path:
  *
  * Returns the current path to the directory WebKit will write Web 
- * Database databases. By default this path will be in the user data
- * directory.
+ * Database and Indexed Database databases. By default this path will
+ * be in the user data directory.
  *
- * Returns: the current database directory path
+ * Returns: the current database directory path in the filesystem encoding
  *
  * Since: 1.1.14
  **/
 const gchar* webkit_get_web_database_directory_path()
 {
-#if ENABLE(SQL_DATABASE)
-    WTF::String path = WebCore::DatabaseManager::manager().databaseDirectoryPath();
-
-    if (path.isEmpty())
-        return "";
-
-    g_free(webkit_database_directory_path);
-    webkit_database_directory_path = g_strdup(path.utf8().data());
-    return webkit_database_directory_path;
-#else
-    return "";
-#endif
+    return gWebKitWebDatabasePath.data();
 }
 
 /**
  * webkit_set_web_database_directory_path:
- * @path: the new database directory path
+ * @path: the new database directory path in the filesystem encoding
  *
  * Sets the current path to the directory WebKit will write Web 
- * Database databases. 
+ * Database and Indexed Database databases. 
  *
  * Since: 1.1.14
  **/
 void webkit_set_web_database_directory_path(const gchar* path)
 {
+    gWebKitWebDatabasePath = path;
+
+    String pathString = WebCore::filenameToString(path);
 #if ENABLE(SQL_DATABASE)
-    WTF::String corePath = WTF::String::fromUTF8(path);
-    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(corePath);
+    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(pathString);
+#endif
 
-    g_free(webkit_database_directory_path);
-    webkit_database_directory_path = g_strdup(corePath.utf8().data());
+#if ENABLE(INDEXED_DATABASE)
+    WebCore::PageGroup::pageGroup(webkitPageGroupName())->groupSettings()->setIndexedDBDatabasePath(pathString);
 #endif
+
 }
 
 /**

Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (140152 => 140153)


--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp	2013-01-18 16:27:12 UTC (rev 140153)
@@ -3659,7 +3659,7 @@
     // as visited link coloration (across pages) and changing popup window location will not work.
     // To keep the default behavior simple (and because no PageGroup API exist in WebKitGTK at the
     // time of writing this comment), we simply set all the pages to the same group.
-    priv->corePage->setGroupName("org.webkit.gtk.WebKitGTK");
+    priv->corePage->setGroupName(webkitPageGroupName());
 
     // We also add a simple wrapper class to provide the public
     // interface for the Web Inspector.

Modified: trunk/Tools/ChangeLog (140152 => 140153)


--- trunk/Tools/ChangeLog	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Tools/ChangeLog	2013-01-18 16:27:12 UTC (rev 140153)
@@ -1,3 +1,20 @@
+2013-01-18  Martin Robinson  <[email protected]>
+
+        [GTK] Add property for IndexedDB database path to WebKitGTK+
+        https://bugs.webkit.org/show_bug.cgi?id=106136
+
+        Reviewed by Gustavo Noronha Silva.
+
+        During testing, set the web database directory to DUMPRENDERTREE_TEMP
+        before falling back to the old default. This is necessary because
+        indexed database tests require that each DRT shard is using a different
+        IDB database location.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (temporaryDatabaseDirectory): Added this helper for getting the
+        database directory.
+        (setDefaultsToConsistentStateValuesForTesting): Use the new helper.
+
 2013-01-18  Sudarsana Nagineni  <[email protected]>
 
         [EFL][WK2] Enable API test InjectedBundleFrameHitTest on EFL

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (140152 => 140153)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-01-18 16:21:08 UTC (rev 140152)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-01-18 16:27:12 UTC (rev 140153)
@@ -650,6 +650,15 @@
     gtk_main_quit();
 }
 
+static CString temporaryDatabaseDirectory()
+{
+    const char* directoryFromEnvironment = g_getenv("DUMPRENDERTREE_TEMP");
+    if (directoryFromEnvironment)
+        return directoryFromEnvironment;
+    GOwnPtr<char> fallback(g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL));
+    return fallback.get();
+}
+
 static void setDefaultsToConsistentStateValuesForTesting()
 {
     resetDefaultsToConsistentValues();
@@ -658,9 +667,7 @@
     webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR);
 #endif
 
-    gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL);
-    webkit_set_web_database_directory_path(databaseDirectory);
-    g_free(databaseDirectory);
+    webkit_set_web_database_directory_path(temporaryDatabaseDirectory().data());
 
 #if defined(GTK_API_VERSION_2)
     gtk_rc_parse_string("style \"nix_scrollbar_spacing\"                    "
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to