Bug 580019: Fix functiontimer crash when opening db with NULL filename

This commit is contained in:
Steve Fink 2010-08-02 14:29:59 -07:00
Родитель 8b99c0fa86
Коммит fa2771061e
3 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -380,6 +380,8 @@ NS_IMETHODIMP
Service::OpenDatabase(nsIFile *aDatabaseFile,
mozIStorageConnection **_connection)
{
NS_ENSURE_ARG(aDatabaseFile);
#ifdef NS_FUNCTION_TIMER
nsCString leafname;
(void)aDatabaseFile->GetNativeLeafName(leafname);

Просмотреть файл

@ -18,6 +18,7 @@ function new_file(name)
var file = dirSvc.get("ProfD", Ci.nsIFile);
file.append(name + ".sqlite");
do_check_false(file.exists());
return file;
}
function run_test()

Просмотреть файл

@ -52,6 +52,18 @@ function test_openSpecialDatabase_invalid_arg()
}
}
function test_openDatabase_null_file()
{
try {
getService().openDatabase(null);
do_throw("We should not get here!");
} catch (e) {
print(e);
print("e.result is " + e.result);
do_check_eq(Cr.NS_ERROR_INVALID_ARG, e.result);
}
}
function test_openDatabase_file_DNE()
{
// the file should be created after calling
@ -118,7 +130,8 @@ function test_backup_new_folder()
var tests = [
test_openSpecialDatabase_invalid_arg,
test_openDatabase_file_DNE,
test_openDatabase_null_file,
test_openDatabase_file_DNE,
test_openDatabase_file_exists,
test_corrupt_db_throws_with_openDatabase,
test_backup_not_new_filename,