Changeset 140153 in webkit


Ignore:
Timestamp:
Jan 18, 2013 8:27:12 AM (11 years ago)
Author:
Martin Robinson
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.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r140148 r140153  
     12013-01-18  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Add property for IndexedDB database path to WebKitGTK+
     4        https://bugs.webkit.org/show_bug.cgi?id=106136
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Make the web database directory affect both the legacy SQLite web
     9        database API and the newer indexed database API. This will allow us
     10        to run IDB tests in WebKit1.
     11
     12        * webkit/webkitglobals.cpp:
     13        (webkitPageGroupName): Added this helper to get the default page
     14        group name.
     15        * webkit/webkitglobalsprivate.h: Added a declaration for the helper.
     16        * webkit/webkitwebdatabase.cpp:
     17        (webkit_get_web_database_directory_path): Just return the cached value.
     18        This is always set by webkitInit.
     19        (webkit_set_web_database_directory_path): Set both the IDB and legacy
     20        database paths.
     21        * webkit/webkitwebview.cpp:
     22        (webkit_web_view_init): Use the new page group name helper.
     23
    1242013-01-18  Seokju Kwon  <seokju.kwon@gmail.com>
    225
  • trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp

    r137486 r140153  
    571571    atexit(webkitExit);
    572572}
     573
     574const char* webkitPageGroupName()
     575{
     576    return "org.webkit.gtk.WebKitGTK";
     577}
  • trunk/Source/WebKit/gtk/webkit/webkitglobalsprivate.h

    r111914 r140153  
    3434
    3535void webkitInit();
     36const char* webkitPageGroupName();
    3637
    3738}
  • trunk/Source/WebKit/gtk/webkit/webkitwebdatabase.cpp

    r137520 r140153  
    2323#include "DatabaseDetails.h"
    2424#include "DatabaseManager.h"
     25#include "FileSystem.h"
     26#include "GroupSettings.h"
     27#include "PageGroup.h"
    2528#include "webkitglobalsprivate.h"
    2629#include "webkitsecurityoriginprivate.h"
     
    7578};
    7679
    77 static gchar* webkit_database_directory_path = NULL;
     80static CString gWebKitWebDatabasePath;
    7881static guint64 webkit_default_database_quota = 5 * 1024 * 1024;
    7982
     
    458461 *
    459462 * Returns the current path to the directory WebKit will write Web
    460  * Database databases. By default this path will be in the user data
    461  * directory.
    462  *
    463  * Returns: the current database directory path
     463 * Database and Indexed Database databases. By default this path will
     464 * be in the user data directory.
     465 *
     466 * Returns: the current database directory path in the filesystem encoding
    464467 *
    465468 * Since: 1.1.14
     
    467470const gchar* webkit_get_web_database_directory_path()
    468471{
    469 #if ENABLE(SQL_DATABASE)
    470     WTF::String path = WebCore::DatabaseManager::manager().databaseDirectoryPath();
    471 
    472     if (path.isEmpty())
    473         return "";
    474 
    475     g_free(webkit_database_directory_path);
    476     webkit_database_directory_path = g_strdup(path.utf8().data());
    477     return webkit_database_directory_path;
    478 #else
    479     return "";
    480 #endif
     472    return gWebKitWebDatabasePath.data();
    481473}
    482474
    483475/**
    484476 * webkit_set_web_database_directory_path:
    485  * @path: the new database directory path
     477 * @path: the new database directory path in the filesystem encoding
    486478 *
    487479 * Sets the current path to the directory WebKit will write Web
    488  * Database databases.
     480 * Database and Indexed Database databases.
    489481 *
    490482 * Since: 1.1.14
     
    492484void webkit_set_web_database_directory_path(const gchar* path)
    493485{
    494 #if ENABLE(SQL_DATABASE)
    495     WTF::String corePath = WTF::String::fromUTF8(path);
    496     WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(corePath);
    497 
    498     g_free(webkit_database_directory_path);
    499     webkit_database_directory_path = g_strdup(corePath.utf8().data());
    500 #endif
     486    gWebKitWebDatabasePath = path;
     487
     488    String pathString = WebCore::filenameToString(path);
     489#if ENABLE(SQL_DATABASE)
     490    WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(pathString);
     491#endif
     492
     493#if ENABLE(INDEXED_DATABASE)
     494    WebCore::PageGroup::pageGroup(webkitPageGroupName())->groupSettings()->setIndexedDBDatabasePath(pathString);
     495#endif
     496
    501497}
    502498
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r137520 r140153  
    36603660    // To keep the default behavior simple (and because no PageGroup API exist in WebKitGTK at the
    36613661    // time of writing this comment), we simply set all the pages to the same group.
    3662     priv->corePage->setGroupName("org.webkit.gtk.WebKitGTK");
     3662    priv->corePage->setGroupName(webkitPageGroupName());
    36633663
    36643664    // We also add a simple wrapper class to provide the public
  • trunk/Tools/ChangeLog

    r140146 r140153  
     12013-01-18  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Add property for IndexedDB database path to WebKitGTK+
     4        https://bugs.webkit.org/show_bug.cgi?id=106136
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        During testing, set the web database directory to DUMPRENDERTREE_TEMP
     9        before falling back to the old default. This is necessary because
     10        indexed database tests require that each DRT shard is using a different
     11        IDB database location.
     12
     13        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     14        (temporaryDatabaseDirectory): Added this helper for getting the
     15        database directory.
     16        (setDefaultsToConsistentStateValuesForTesting): Use the new helper.
     17
    1182013-01-18  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
    219
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r138983 r140153  
    651651}
    652652
     653static CString temporaryDatabaseDirectory()
     654{
     655    const char* directoryFromEnvironment = g_getenv("DUMPRENDERTREE_TEMP");
     656    if (directoryFromEnvironment)
     657        return directoryFromEnvironment;
     658    GOwnPtr<char> fallback(g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL));
     659    return fallback.get();
     660}
     661
    653662static void setDefaultsToConsistentStateValuesForTesting()
    654663{
     
    659668#endif
    660669
    661     gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "gtkwebkitdrt", "databases", NULL);
    662     webkit_set_web_database_directory_path(databaseDirectory);
    663     g_free(databaseDirectory);
     670    webkit_set_web_database_directory_path(temporaryDatabaseDirectory().data());
    664671
    665672#if defined(GTK_API_VERSION_2)
Note: See TracChangeset for help on using the changeset viewer.