зеркало из https://github.com/mozilla/pjs.git
Bug 668906 - Do not call openUnsharedDatabase with a null file (r=sdwilsh)
--HG-- extra : rebase_source : fbd0febc77e9972d10409ce09c73759f7d156ad1
This commit is contained in:
Родитель
fd0a8b3217
Коммит
65b7f76b14
|
@ -477,6 +477,8 @@ NS_IMETHODIMP
|
||||||
Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
|
Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
|
||||||
mozIStorageConnection **_connection)
|
mozIStorageConnection **_connection)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(aDatabaseFile);
|
||||||
|
|
||||||
#ifdef NS_FUNCTION_TIMER
|
#ifdef NS_FUNCTION_TIMER
|
||||||
nsCString leafname;
|
nsCString leafname;
|
||||||
(void)aDatabaseFile->GetNativeLeafName(leafname);
|
(void)aDatabaseFile->GetNativeLeafName(leafname);
|
||||||
|
|
|
@ -64,6 +64,18 @@ function test_openDatabase_null_file()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_openUnsharedDatabase_null_file()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
getService().openUnsharedDatabase(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()
|
function test_openDatabase_file_DNE()
|
||||||
{
|
{
|
||||||
// the file should be created after calling
|
// the file should be created after calling
|
||||||
|
@ -131,6 +143,7 @@ function test_backup_new_folder()
|
||||||
var tests = [
|
var tests = [
|
||||||
test_openSpecialDatabase_invalid_arg,
|
test_openSpecialDatabase_invalid_arg,
|
||||||
test_openDatabase_null_file,
|
test_openDatabase_null_file,
|
||||||
|
test_openUnsharedDatabase_null_file,
|
||||||
test_openDatabase_file_DNE,
|
test_openDatabase_file_DNE,
|
||||||
test_openDatabase_file_exists,
|
test_openDatabase_file_exists,
|
||||||
test_corrupt_db_throws_with_openDatabase,
|
test_corrupt_db_throws_with_openDatabase,
|
||||||
|
|
|
@ -17,7 +17,8 @@ function run_test() {
|
||||||
|
|
||||||
let file = do_get_file("default.sqlite");
|
let file = do_get_file("default.sqlite");
|
||||||
file.copyToFollowingLinks(gProfD, "places.sqlite");
|
file.copyToFollowingLinks(gProfD, "places.sqlite");
|
||||||
file = gProfD.clone().append("places.sqlite");
|
file = gProfD.clone();
|
||||||
|
file.append("places.sqlite");
|
||||||
|
|
||||||
// Create some unique stuff to check later.
|
// Create some unique stuff to check later.
|
||||||
let db = Services.storage.openUnsharedDatabase(file);
|
let db = Services.storage.openUnsharedDatabase(file);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче