https://bugs.webkit.org/show_bug.cgi?id=135834
Reviewed by Philippe Normand.
Make sure the user cache directory exists. If creating the
directory fails for whatever reason, do not try to save the cache
to disk.
* UIProcess/Plugins/gtk/PluginInfoCache.cpp:
(WebKit::PluginInfoCache::PluginInfoCache):
(WebKit::PluginInfoCache::updatePluginInfo):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172442
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-08-12 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] The plugins metadata cache doesn't work if the user cache directory doesn't exist
+ https://bugs.webkit.org/show_bug.cgi?id=135834
+
+ Reviewed by Philippe Normand.
+
+ Make sure the user cache directory exists. If creating the
+ directory fails for whatever reason, do not try to save the cache
+ to disk.
+
+ * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
+ (WebKit::PluginInfoCache::PluginInfoCache):
+ (WebKit::PluginInfoCache::updatePluginInfo):
+
2014-08-12 Alexey Proskuryakov <ap@apple.com>
[Mac] Allow reading CoreGraphics debugging preferences
2014-08-12 Alexey Proskuryakov <ap@apple.com>
[Mac] Allow reading CoreGraphics debugging preferences
PluginInfoCache::PluginInfoCache()
: m_cacheFile(g_key_file_new())
PluginInfoCache::PluginInfoCache()
: m_cacheFile(g_key_file_new())
- , m_cachePath(g_build_filename(g_get_user_cache_dir(), "webkitgtk", "plugins", nullptr))
- g_key_file_load_from_file(m_cacheFile.get(), m_cachePath.get(), G_KEY_FILE_NONE, nullptr);
+ GUniquePtr<char> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "webkitgtk", nullptr));
+ if (WebCore::makeAllDirectories(cacheDirectory.get())) {
+ m_cachePath.reset(g_build_filename(cacheDirectory.get(), "plugins", nullptr));
+ g_key_file_load_from_file(m_cacheFile.get(), m_cachePath.get(), G_KEY_FILE_NONE, nullptr);
+ }
if (g_key_file_has_group(m_cacheFile.get(), "schema")) {
unsigned schemaVersion = static_cast<unsigned>(g_key_file_get_integer(m_cacheFile.get(), "schema", "version", nullptr));
if (g_key_file_has_group(m_cacheFile.get(), "schema")) {
unsigned schemaVersion = static_cast<unsigned>(g_key_file_get_integer(m_cacheFile.get(), "schema", "version", nullptr));
g_key_file_set_boolean(m_cacheFile.get(), pluginGroup.data(), "requires-gtk2", plugin.requiresGtk2);
g_key_file_set_boolean(m_cacheFile.get(), pluginGroup.data(), "requires-gtk2", plugin.requiresGtk2);
- // Save the cache file in an idle to make sure it happens in the main thread and
- // it's done only once when this is called multiple times in a very short time.
- std::lock_guard<std::mutex> lock(m_mutex);
- if (m_saveToFileIdle.isScheduled())
- return;
+ if (m_cachePath) {
+ // Save the cache file in an idle to make sure it happens in the main thread and
+ // it's done only once when this is called multiple times in a very short time.
+ std::lock_guard<std::mutex> lock(m_mutex);
+ if (m_saveToFileIdle.isScheduled())
+ return;
- m_saveToFileIdle.schedule("[WebKit] PluginInfoCache::saveToFile", std::bind(&PluginInfoCache::saveToFile, this), G_PRIORITY_DEFAULT_IDLE);
+ m_saveToFileIdle.schedule("[WebKit] PluginInfoCache::saveToFile", std::bind(&PluginInfoCache::saveToFile, this), G_PRIORITY_DEFAULT_IDLE);
+ }