Do not register Chromium's HTML5 DB VFS as the default
[WebKit-https.git] / WebCore / platform / sql / chromium / SQLiteFileSystemChromium.cpp
index fdb50d0a2ae8b4123e5657abf10f170a5db0f75a..752c61312427c8def2c74863579e3cd7d5c9328a 100644 (file)
@@ -50,7 +50,13 @@ SQLiteFileSystem::SQLiteFileSystem()
 
 int SQLiteFileSystem::openDatabase(const String& fileName, sqlite3** database)
 {
-    // open databases using Chromium's VFS
+    if (!ChromiumBridge::sandboxEnabled()) {
+        String path = fileName;
+        return sqlite3_open16(path.charactersWithNullTermination(), database);
+    }
+
+    // open databases using the default VFS
+    // in renderers, it should be Chromium's VFS; in the browser process it should be SQLite's default VFS
     return sqlite3_open_v2(fileName.utf8().data(), database,
                            SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX,
                            "chromium_vfs");
@@ -94,9 +100,7 @@ bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&)
 
 bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName)
 {
-    // return true if and only if the error code returned by
-    // ChromiumBridge::deleteDatabase() is 0
-    return (!ChromiumBridge::databaseDeleteFile(fileName));
+    return (ChromiumBridge::databaseDeleteFile(fileName) == SQLITE_OK);
 }
 
 long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName)