diff options
| author | Steve Block <steveblock@google.com> | 2011-01-13 11:39:52 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-13 11:39:52 -0800 |
| commit | 32b1eebcf86772d08786dbfb4e518fc2ddf00cc1 (patch) | |
| tree | 5989921038fc70bb3dfbb34d0670a517567149ed | |
| parent | 0b77bcc1e3f1198bd705c0efc11d6a8be0a3b9b4 (diff) | |
| parent | ffbb7741a62dd5c598ac92875ddac101bbc665c9 (diff) | |
| download | external_webkit-32b1eebcf86772d08786dbfb4e518fc2ddf00cc1.zip external_webkit-32b1eebcf86772d08786dbfb4e518fc2ddf00cc1.tar.gz external_webkit-32b1eebcf86772d08786dbfb4e518fc2ddf00cc1.tar.bz2 | |
am ffbb7741: DO NOT MERGE - Set 660 permissions on Appcache database
* commit 'ffbb7741a62dd5c598ac92875ddac101bbc665c9':
DO NOT MERGE - Set 660 permissions on Appcache database
| -rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index 2136f67..62a9cc8 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -33,6 +33,8 @@ #include "DatabaseTracker.h" #include "DocLoader.h" #include "Document.h" +#include "EditorClientAndroid.h" +#include "FileSystem.h" #include "Frame.h" #include "FrameLoader.h" #include "FrameView.h" @@ -54,6 +56,8 @@ namespace android { +static const int permissionFlags660 = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; + struct FieldIds { FieldIds(JNIEnv* env, jclass clazz) { mLayoutAlgorithm = env->GetFieldID(clazz, "mLayoutAlgorithm", @@ -334,6 +338,13 @@ public: WebCore::String path = to_string(env, str); if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) { WebCore::cacheStorage().setCacheDirectory(path); + // This database is created on the first load. If the file + // doesn't exist, we create it and set its permissions. The + // filename must match that in ApplicationCacheStorage.cpp. + String filename = pathByAppendingComponent(path, "ApplicationCache.db"); + int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660); + if (fd >= 0) + close(fd); } } jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize); @@ -362,8 +373,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(to_string(env, str)); + if (str) { + String path = to_string(env, str); + WebCore::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, permissionFlags660); + if (fd >= 0) + close(fd); + } } #endif #if ENABLE(DOM_STORAGE) @@ -391,7 +412,7 @@ public: // GeolocationPositionCache.cpp. WebCore::String filename = WebCore::SQLiteFileSystem::appendDatabaseFileNameToPath( path, "CachedGeoposition.db"); - int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660); if (fd >= 0) close(fd); } |
