summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-12-14 10:51:07 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-12-14 10:51:07 -0800
commit0d7cec732e3f00f89749d4946fd22168d8d4111c (patch)
tree70da5b08c6449e344bba8b08476066bb98e7f47a /WebKit
parentac45fd040af509d8cc3470ad7f8dcdfe459d5c7c (diff)
parent09face10395095a906046a91e971351b4432093e (diff)
downloadexternal_webkit-0d7cec732e3f00f89749d4946fd22168d8d4111c.zip
external_webkit-0d7cec732e3f00f89749d4946fd22168d8d4111c.tar.gz
external_webkit-0d7cec732e3f00f89749d4946fd22168d8d4111c.tar.bz2
Merge "Set 660 permissions on Geolocation permissions DB"
Diffstat (limited to 'WebKit')
-rwxr-xr-xWebKit/android/WebCoreSupport/GeolocationPermissions.cpp22
-rw-r--r--WebKit/android/WebCoreSupport/GeolocationPermissions.h2
2 files changed, 21 insertions, 3 deletions
diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
index 32a5660..36a9b61 100755
--- a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
+++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
@@ -31,10 +31,13 @@
#include "Geolocation.h"
#include "Navigator.h"
#include "SQLiteDatabase.h"
+#include "SQLiteFileSystem.h"
#include "SQLiteStatement.h"
#include "SQLiteTransaction.h"
#include "WebViewCore.h"
+#include <text/CString.h>
+
using namespace WebCore;
namespace android {
@@ -46,7 +49,7 @@ bool GeolocationPermissions::s_permanentPermissionsLoaded = false;
bool GeolocationPermissions::s_permanentPermissionsModified = false;
String GeolocationPermissions::s_databasePath;
-static const char* databaseName = "/GeolocationPermissions.db";
+static const char* databaseName = "GeolocationPermissions.db";
GeolocationPermissions::GeolocationPermissions(WebViewCore* webViewCore, Frame* mainFrame)
: m_webViewCore(webViewCore)
@@ -327,7 +330,7 @@ void GeolocationPermissions::maybeLoadPermanentPermissions()
s_permanentPermissionsLoaded = true;
SQLiteDatabase database;
- if (!database.open(s_databasePath + databaseName))
+ if (!openDatabase(&database))
return;
// Create the table here, such that even if we've just created the DB, the
@@ -359,7 +362,7 @@ void GeolocationPermissions::maybeStorePermanentPermissions()
return;
SQLiteDatabase database;
- if (!database.open(s_databasePath + databaseName))
+ if (!openDatabase(&database))
return;
SQLiteTransaction transaction(database);
@@ -395,6 +398,19 @@ void GeolocationPermissions::setDatabasePath(String path)
s_databasePath = path;
}
+bool GeolocationPermissions::openDatabase(SQLiteDatabase* database)
+{
+ ASSERT(database);
+ String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(s_databasePath, databaseName);
+ if (!database->open(filename))
+ return false;
+ if (chmod(filename.utf8().data(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)) {
+ database->close();
+ return false;
+ }
+ return true;
+}
+
void GeolocationPermissions::setAlwaysDeny(bool deny)
{
s_alwaysDeny = deny;
diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.h b/WebKit/android/WebCoreSupport/GeolocationPermissions.h
index f40619b..fb31dfe 100644
--- a/WebKit/android/WebCoreSupport/GeolocationPermissions.h
+++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.h
@@ -38,6 +38,7 @@
namespace WebCore {
class Frame;
class Geolocation;
+ class SQLiteDatabase;
}
namespace android {
@@ -108,6 +109,7 @@ namespace android {
static void setAlwaysDeny(bool deny);
static void setDatabasePath(WTF::String path);
+ static bool openDatabase(WebCore::SQLiteDatabase*);
// Saves the permanent permissions to the DB if required.
static void maybeStorePermanentPermissions();