Bug 422687 encfs makes Firefox crash at start [@ libsqlite3.so@0x30fad][@ sqlite3_exec] r=sdwilsh a=beltzner
authortimeless@mozdev.org
Mon, 17 Mar 2008 14:01:16 -0700
changeset 13194 4270e71d78afdf7b5149ace633f1d99740667a00
parent 13193 87d9c4e9f7ff0a84c60518de1329da7c0e5e060b
child 13195 04cf6e7e41dbca7924ecc14f3f91731aaacd56a7
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherderautoland@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssdwilsh, beltzner
bugs422687
milestone1.9b5pre
Bug 422687 encfs makes Firefox crash at start [@ libsqlite3.so@0x30fad][@ sqlite3_exec] r=sdwilsh a=beltzner
storage/src/mozStorageConnection.cpp
storage/test/unit/test_storage_connection.js
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -444,16 +444,17 @@ mozStorageConnection::RollbackTransactio
  ** Table creation
  **/
 
 NS_IMETHODIMP
 mozStorageConnection::CreateTable(/*const nsID& aID,*/
                                   const char *aTableName,
                                   const char *aTableSchema)
 {
+    if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
     int srv;
     char *buf;
 
     buf = PR_smprintf("CREATE TABLE %s (%s)", aTableName, aTableSchema);
     if (!buf)
         return NS_ERROR_OUT_OF_MEMORY;
 
     srv = sqlite3_exec (mDBConn, buf,
--- a/storage/test/unit/test_storage_connection.js
+++ b/storage/test/unit/test_storage_connection.js
@@ -217,29 +217,53 @@ function test_backup_new_folder()
 
   var backup = msc.backupDB(BACKUP_FILE_NAME, parentDir);
   do_check_eq(BACKUP_FILE_NAME, backup.leafName);
   do_check_true(parentDir.equals(backup.parent));
 
   parentDir.remove(true);
 }
 
-var tests = [test_connectionReady_open, test_connectionReady_closed,
-             test_databaseFile,
-             test_tableExists_not_created, test_indexExists_not_created,
-             test_createTable_not_created, test_indexExists_created,
-             test_createTable_already_created, test_lastInsertRowID,
-             test_transactionInProgress_no, test_transactionInProgress_yes,
-             test_commitTransaction_no_transaction,
-             test_rollbackTransaction_no_transaction,
-             test_get_schemaVersion_not_set, test_set_schemaVersion,
-             test_set_schemaVersion_same, test_set_schemaVersion_negative,
-             test_backup_not_new_filename, test_backup_new_filename,
-             test_backup_new_folder];
+function test_createTable(){
+  var temp = getTestDB().parent;
+  temp.append("test_db_table");
+  try {
+    var con = getService().openDatabase(temp);
+    con.createTable("a","");
+  } catch (e) {
+    if (temp.exists()) try {
+      temp.remove(false);
+    } catch (e2) {}
+    do_check_eq(e.result, Cr.NS_ERROR_NOT_INITIALIZED);
+  }
+}
+
+var tests = [
+  test_connectionReady_open,
+  test_connectionReady_closed,
+  test_databaseFile,
+  test_tableExists_not_created,
+  test_indexExists_not_created,
+  test_createTable_not_created,
+  test_indexExists_created,
+  test_createTable_already_created,
+  test_lastInsertRowID,
+  test_transactionInProgress_no,
+  test_transactionInProgress_yes,
+  test_commitTransaction_no_transaction,
+  test_rollbackTransaction_no_transaction,
+  test_get_schemaVersion_not_set,
+  test_set_schemaVersion,
+  test_set_schemaVersion_same,
+  test_set_schemaVersion_negative,
+  test_backup_not_new_filename,
+  test_backup_new_filename,
+  test_backup_new_folder,
+  test_createTable,
+];
 
 function run_test()
 {
   for (var i = 0; i < tests.length; i++)
     tests[i]();
     
   cleanup();
 }
-