summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-12-20 13:25:03 +0000
committerSteve Block <steveblock@google.com>2010-12-20 17:21:05 +0000
commit81eca27e9fc1d1106ad44a8ff902f01c28dfca30 (patch)
treefd879b7e371fd2b0fcb8f3364a277818e849dd3c
parent74427af10b1794f0e99b7e7a451c4a40902c98f4 (diff)
downloadexternal_webkit-81eca27e9fc1d1106ad44a8ff902f01c28dfca30.zip
external_webkit-81eca27e9fc1d1106ad44a8ff902f01c28dfca30.tar.gz
external_webkit-81eca27e9fc1d1106ad44a8ff902f01c28dfca30.tar.bz2
Set 660 permissions on Geolocation cache DB
Bug: 3256540 Change-Id: I2774f100c9e9c458ebdaf9b6d188c52e79fd2568
-rw-r--r--WebKit/android/jni/WebSettings.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index dc3723d..05c92e5 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -44,6 +44,7 @@
#include "Page.h"
#include "PageCache.h"
#include "RenderTable.h"
+#include "SQLiteFileSystem.h"
#include "Settings.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
@@ -55,6 +56,7 @@
#include <JNIHelp.h>
#include <utils/misc.h>
+#include <wtf/text/CString.h>
namespace android {
@@ -480,8 +482,17 @@ public:
GeolocationPermissions::setAlwaysDeny(!flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mGeolocationDatabasePath);
if (str) {
- GeolocationPermissions::setDatabasePath(jstringToWtfString(env,str));
- WebCore::GeolocationPositionCache::setDatabasePath(jstringToWtfString(env,str));
+ String path = jstringToWtfString(env, str);
+ GeolocationPermissions::setDatabasePath(path);
+ GeolocationPositionCache::setDatabasePath(path);
+ // This database is created when the first Geolocation object is
+ // instantiated. If the file doesn't exist, we create it and set its
+ // permissions. The filename must match that in
+ // GeolocationPositionCache.cpp.
+ String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "CachedGeoposition.db");
+ int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+ if (fd >= 0)
+ close(fd);
}
flag = env->GetBooleanField(obj, gFieldIds->mXSSAuditorEnabled);