Commit 6148bfe2 authored by philn@webkit.org's avatar philn@webkit.org

2011-03-10 Philippe Normand <pnormand@igalia.com>

        Reviewed by Xan Lopez.

        [GTK] unittests/testapplicationcache crashes
        https://bugs.webkit.org/show_bug.cgi?id=56083

        Removed the webkit_application_cache_get_database_directory_path
        API as the underlying ApplicationCacheStorage doesn't allow
        setting the cache path multiple times.

        * tests/testapplicationcache.c:
        (main):
        * webkit/webkitapplicationcache.cpp:
        (webkit_application_cache_get_database_directory_path):
        * webkit/webkitapplicationcache.h:
        * webkit/webkitglobals.cpp:
        (webkitInit):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eb7aefb1
2011-03-10 Philippe Normand <pnormand@igalia.com>
Reviewed by Xan Lopez.
[GTK] unittests/testapplicationcache crashes
https://bugs.webkit.org/show_bug.cgi?id=56083
Removed the webkit_application_cache_get_database_directory_path
API as the underlying ApplicationCacheStorage doesn't allow
setting the cache path multiple times.
* tests/testapplicationcache.c:
(main):
* webkit/webkitapplicationcache.cpp:
(webkit_application_cache_get_database_directory_path):
* webkit/webkitapplicationcache.h:
* webkit/webkitglobals.cpp:
(webkitInit):
2011-03-09 Peter Kasting <pkasting@google.com>
Reviewed by Mihai Parparita.
......
......@@ -37,25 +37,6 @@ static void test_application_cache_maximum_size()
g_assert(maxSize == webkit_application_cache_get_maximum_size());
}
static void test_application_cache_database_directory_path()
{
unsigned long long maxSize = 8192;
webkit_application_cache_set_maximum_size(maxSize);
gchar* databaseDirectorySet = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
webkit_application_cache_set_database_directory_path(databaseDirectorySet);
// Creating a WebView - make sure that it didn't change anything
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(webView);
g_object_unref(webView);
const gchar* databaseDirectoryGet = webkit_application_cache_get_database_directory_path();
g_assert_cmpstr(databaseDirectorySet, ==, databaseDirectoryGet);
g_free(databaseDirectorySet);
}
int main(int argc, char** argv)
{
g_thread_init(NULL);
......@@ -64,8 +45,6 @@ int main(int argc, char** argv)
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/application_cache/maximum_size",
test_application_cache_maximum_size);
g_test_add_func("/webkit/application_cache/database_directory_path",
test_application_cache_database_directory_path);
return g_test_run();
}
......
......@@ -26,8 +26,6 @@
#include <wtf/UnusedParam.h>
#include <wtf/text/CString.h>
// keeps current directory path to offline web applications cache database
static WTF::CString cacheDirectoryPath = "";
// web application cache maximum storage size
static unsigned long long cacheMaxSize = UINT_MAX;
......@@ -89,33 +87,9 @@ G_CONST_RETURN gchar* webkit_application_cache_get_database_directory_path()
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
CString path = WebCore::fileSystemRepresentation(WebCore::cacheStorage().cacheDirectory());
if (path != cacheDirectoryPath)
cacheDirectoryPath = path;
return cacheDirectoryPath.data();
return path.data();
#else
return "";
#endif
}
/**
* webkit_application_cache_set_database_directory_path:
* @path: the new web application cache database path
*
* Sets the current path to the directory WebKit will write web aplication cache
* databases.
*
* Since: 1.3.13
**/
void webkit_application_cache_set_database_directory_path(const gchar* path)
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
WTF::CString pathString(path);
if (pathString != cacheDirectoryPath)
cacheDirectoryPath = pathString;
WebCore::cacheStorage().setCacheDirectory(WebCore::filenameToString(cacheDirectoryPath.data()));
#endif
}
......@@ -33,9 +33,6 @@ webkit_application_cache_set_maximum_size(unsigned long long size);
WEBKIT_API G_CONST_RETURN gchar*
webkit_application_cache_get_database_directory_path (void);
WEBKIT_API void
webkit_application_cache_set_database_directory_path (const gchar* path);
G_END_DECLS
#endif /* webkitapplicationcache_h */
......@@ -265,7 +265,7 @@ void webkitInit()
gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
webkit_set_web_database_directory_path(databaseDirectory);
webkit_application_cache_set_database_directory_path(databaseDirectory);
WebCore::cacheStorage().setCacheDirectory(databaseDirectory);
g_free(databaseDirectory);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment