summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-12-21 11:55:38 +0000
committerSteve Block <steveblock@google.com>2010-12-21 12:40:14 +0000
commit15c397de884b833e41ae7fecd67e47ce89913267 (patch)
treed8dcece710b038ec3741d519634b72527786ec99
parent81eca27e9fc1d1106ad44a8ff902f01c28dfca30 (diff)
downloadexternal_webkit-15c397de884b833e41ae7fecd67e47ce89913267.zip
external_webkit-15c397de884b833e41ae7fecd67e47ce89913267.tar.gz
external_webkit-15c397de884b833e41ae7fecd67e47ce89913267.tar.bz2
Set 660 permissions on HTML5 Database API meta database
Bug: 3244281 Change-Id: I7af7c47c92fc180435cff2416922916a1114c88f
-rw-r--r--WebKit/android/jni/WebSettings.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index 05c92e5..d293942 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -462,8 +462,18 @@ public:
if (flag) {
// If the user has set the database path, sync it to the DatabaseTracker.
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
- if (str)
- WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(jstringToWtfString(env, str));
+ if (str) {
+ String path = jstringToWtfString(env, str);
+ DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
+ // This database is created when the first HTML5 Database object is
+ // instantiated. If the file doesn't exist, we create it and set its
+ // permissions. The filename must match that in
+ // DatabaseTracker.cpp.
+ String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "Databases.db");
+ int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+ if (fd >= 0)
+ close(fd);
+ }
}
#endif
#if ENABLE(DOM_STORAGE)