Title: [96702] trunk/Source
Revision
96702
Author
[email protected]
Date
2011-10-05 07:20:22 -0700 (Wed, 05 Oct 2011)

Log Message

[Qt][WK2] Default directories and paths are missing for LocalStorage, Database and IconDatabase.
https://bugs.webkit.org/show_bug.cgi?id=69111

Reviewed by Kenneth Rohde Christiansen.

Provide default path for LocalStorage, Database and IconDatabase using QDesktopServices.

Source/WebCore:

No new tests : existing ones should cover.

* platform/qt/CookieJarQt.cpp:
(WebCore::SharedCookieJarQt::SharedCookieJarQt):

Source/WebKit2:

* UIProcess/qt/WebContextQt.cpp:
(WebKit::defaultDataLocation):
(WebKit::WebContext::platformInitializeWebProcess):
(WebKit::WebContext::platformDefaultDatabaseDirectory):
(WebKit::WebContext::platformDefaultIconDatabasePath):
(WebKit::WebContext::platformDefaultLocalStorageDirectory):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96701 => 96702)


--- trunk/Source/WebCore/ChangeLog	2011-10-05 14:19:51 UTC (rev 96701)
+++ trunk/Source/WebCore/ChangeLog	2011-10-05 14:20:22 UTC (rev 96702)
@@ -1,3 +1,17 @@
+2011-10-05  Alexis Menard  <[email protected]>
+
+        [Qt][WK2] Default directories and paths are missing for LocalStorage, Database and IconDatabase.
+        https://bugs.webkit.org/show_bug.cgi?id=69111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Provide default path for LocalStorage, Database and IconDatabase using QDesktopServices.
+
+        No new tests : existing ones should cover.
+
+        * platform/qt/CookieJarQt.cpp:
+        (WebCore::SharedCookieJarQt::SharedCookieJarQt):
+
 2011-10-05  Patrick Gansterer  <[email protected]>
 
         Unreviewed build fix for !ENABLE(FILTERS) after r96203.

Modified: trunk/Source/WebCore/platform/qt/CookieJarQt.cpp (96701 => 96702)


--- trunk/Source/WebCore/platform/qt/CookieJarQt.cpp	2011-10-05 14:19:51 UTC (rev 96701)
+++ trunk/Source/WebCore/platform/qt/CookieJarQt.cpp	2011-10-05 14:20:22 UTC (rev 96702)
@@ -42,7 +42,6 @@
 #include "qwebpage.h"
 #include "qwebsettings.h"
 #include <QDateTime>
-#include <QDir>
 #include <QNetworkAccessManager>
 #include <QNetworkCookie>
 #include <QSqlQuery>
@@ -227,8 +226,7 @@
 {
     m_database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"));
     const QString cookieStoragePath = cookieStorageDirectory;
-    QDir().mkpath(cookieStoragePath + QLatin1String(".QtWebKit/"));
-    const QString dataBaseName = cookieStoragePath + QLatin1String(".QtWebKit/cookies.db");
+    const QString dataBaseName = cookieStoragePath + QLatin1String("cookies.db");
     m_database.setDatabaseName(dataBaseName);
     ensureDatabaseTable();
     loadCookies();

Modified: trunk/Source/WebKit2/ChangeLog (96701 => 96702)


--- trunk/Source/WebKit2/ChangeLog	2011-10-05 14:19:51 UTC (rev 96701)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-05 14:20:22 UTC (rev 96702)
@@ -1,3 +1,19 @@
+2011-10-05  Alexis Menard  <[email protected]>
+
+        [Qt][WK2] Default directories and paths are missing for LocalStorage, Database and IconDatabase.
+        https://bugs.webkit.org/show_bug.cgi?id=69111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Provide default path for LocalStorage, Database and IconDatabase using QDesktopServices.
+
+        * UIProcess/qt/WebContextQt.cpp:
+        (WebKit::defaultDataLocation):
+        (WebKit::WebContext::platformInitializeWebProcess):
+        (WebKit::WebContext::platformDefaultDatabaseDirectory):
+        (WebKit::WebContext::platformDefaultIconDatabasePath):
+        (WebKit::WebContext::platformDefaultLocalStorageDirectory):
+
 2011-10-05  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Use WKRetainPtr for WK types in WebKit2 GTK+

Modified: trunk/Source/WebKit2/UIProcess/qt/WebContextQt.cpp (96701 => 96702)


--- trunk/Source/WebKit2/UIProcess/qt/WebContextQt.cpp	2011-10-05 14:19:51 UTC (rev 96701)
+++ trunk/Source/WebKit2/UIProcess/qt/WebContextQt.cpp	2011-10-05 14:20:22 UTC (rev 96702)
@@ -28,12 +28,33 @@
 #include "WebContext.h"
 
 #include "ApplicationCacheStorage.h"
+#include "FileSystem.h"
 #include "WebProcessCreationParameters.h"
+#include <QCoreApplication>
 #include <QDesktopServices>
+#include <QDir>
 #include <QProcess>
 
 namespace WebKit {
 
+static QString defaultDataLocation()
+{
+    static QString s_dataLocation;
+
+    if (!s_dataLocation.isEmpty())
+        return s_dataLocation;
+
+    QString dataLocation = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
+    if (dataLocation.isEmpty())
+        dataLocation = WebCore::pathByAppendingComponent(QDir::homePath(), QCoreApplication::applicationName());
+    s_dataLocation = WebCore::pathByAppendingComponent(dataLocation, ".QtWebKit/");
+    WebCore::makeAllDirectories(s_dataLocation);
+    return s_dataLocation;
+}
+
+static QString s_defaultDatabaseDirectory;
+static QString s_defaultLocalStorageDirectory;
+
 String WebContext::applicationCacheDirectory()
 {
     return WebCore::cacheStorage().cacheDirectory();
@@ -42,7 +63,7 @@
 void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
-    parameters.cookieStorageDirectory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
+    parameters.cookieStorageDirectory = defaultDataLocation();
 }
 
 void WebContext::platformInvalidateContext()
@@ -51,20 +72,27 @@
 
 String WebContext::platformDefaultDatabaseDirectory() const
 {
-    // FIXME: Implement.
-    return "";
+    if (!s_defaultDatabaseDirectory.isEmpty())
+        return s_defaultDatabaseDirectory;
+
+    s_defaultDatabaseDirectory = defaultDataLocation() + QLatin1String("Databases");
+    QDir().mkpath(s_defaultDatabaseDirectory);
+    return s_defaultDatabaseDirectory;
 }
 
 String WebContext::platformDefaultIconDatabasePath() const
 {
-    // FIXME: Implement.
-    return "";
+    return defaultDataLocation();
 }
 
 String WebContext::platformDefaultLocalStorageDirectory() const
 {
-    // FIXME: Implement.
-    return "";
+    if (!s_defaultLocalStorageDirectory.isEmpty())
+        return s_defaultLocalStorageDirectory;
+
+    s_defaultLocalStorageDirectory = defaultDataLocation() + QLatin1String("LocalStorage");
+    QDir().mkpath(s_defaultLocalStorageDirectory);
+    return s_defaultLocalStorageDirectory;
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to