Bug 1207499 - Part 9: Remove use of expression closure from storage/. r=mak

This commit is contained in:
Tooru Fujisawa 2015-09-23 18:42:19 +09:00
parent 6ed8e81abc
commit 7dab92c177
7 changed files with 39 additions and 34 deletions

View File

@ -156,7 +156,7 @@ function createAsyncStatement(aSQL)
* can be used to do this concisely.
*
* Example:
* expectError(Cr.NS_ERROR_INVALID_ARG, function() explodingFunction());
* expectError(Cr.NS_ERROR_INVALID_ARG, () => explodingFunction());
*
* @param aErrorCode
* The error code to expect from invocation of aFunction.

View File

@ -175,7 +175,7 @@ function test_multiple_bindings_on_statements()
run_next_test();
}
});
stmts.forEach(function(stmt) stmt.finalize());
stmts.forEach(stmt => stmt.finalize());
}
function test_asyncClose_does_not_complete_before_statements()

View File

@ -123,5 +123,5 @@ function run_test()
);
// Run the tests.
tests.forEach(function(test) test());
tests.forEach(test => test());
}

View File

@ -156,8 +156,9 @@ function localeCompare(aCollation)
do_throw("Error in test: unknown collation '" + aCollation + "'");
break;
}
return function (aStr1, aStr2)
gLocaleCollation.compareString(strength, aStr1, aStr2);
return function (aStr1, aStr2) {
return gLocaleCollation.compareString(strength, aStr1, aStr2);
};
}
/**
@ -255,42 +256,42 @@ function setup()
var gTests = [
{
desc: "Case and accent sensitive UTF-8",
run: function () runUtf8Test("locale_case_accent_sensitive")
run: () => runUtf8Test("locale_case_accent_sensitive")
},
{
desc: "Case sensitive, accent insensitive UTF-8",
run: function () runUtf8Test("locale_case_sensitive")
run: () => runUtf8Test("locale_case_sensitive")
},
{
desc: "Case insensitive, accent sensitive UTF-8",
run: function () runUtf8Test("locale_accent_sensitive")
run: () => runUtf8Test("locale_accent_sensitive")
},
{
desc: "Case and accent insensitive UTF-8",
run: function () runUtf8Test("locale")
run: () => runUtf8Test("locale")
},
{
desc: "Case and accent sensitive UTF-16",
run: function () runUtf16Test("locale_case_accent_sensitive")
run: () => runUtf16Test("locale_case_accent_sensitive")
},
{
desc: "Case sensitive, accent insensitive UTF-16",
run: function () runUtf16Test("locale_case_sensitive")
run: () => runUtf16Test("locale_case_sensitive")
},
{
desc: "Case insensitive, accent sensitive UTF-16",
run: function () runUtf16Test("locale_accent_sensitive")
run: () => runUtf16Test("locale_accent_sensitive")
},
{
desc: "Case and accent insensitive UTF-16",
run: function () runUtf16Test("locale")
run: () => runUtf16Test("locale")
},
];

View File

@ -416,7 +416,7 @@ function test_double_cancellation()
let pendingStatement = execAsync(stmt, {cancel: true});
// And cancel again - expect an exception
expectError(Cr.NS_ERROR_UNEXPECTED,
function() pendingStatement.cancel());
() => pendingStatement.cancel());
stmt.finalize();
run_next_test();
@ -628,10 +628,10 @@ function test_bind_out_of_bounds_sync_immediate()
// Check variant binding.
expectError(Cr.NS_ERROR_INVALID_ARG,
function() bp.bindByIndex(1, INTEGER));
() => bp.bindByIndex(1, INTEGER));
// Check blob binding.
expectError(Cr.NS_ERROR_INVALID_ARG,
function() bp.bindBlobByIndex(1, BLOB, BLOB.length));
() => bp.bindBlobByIndex(1, BLOB, BLOB.length));
stmt.finalize();
run_next_test();
@ -675,10 +675,10 @@ function test_bind_no_such_name_sync_immediate()
// Check variant binding.
expectError(Cr.NS_ERROR_INVALID_ARG,
function() bp.bindByName("doesnotexist", INTEGER));
() => bp.bindByName("doesnotexist", INTEGER));
// Check blob binding.
expectError(Cr.NS_ERROR_INVALID_ARG,
function() bp.bindBlobByName("doesnotexist", BLOB, BLOB.length));
() => bp.bindBlobByName("doesnotexist", BLOB, BLOB.length));
stmt.finalize();
run_next_test();
@ -751,7 +751,7 @@ function test_bind_params_already_locked()
// We should get an error after we call addParams and try to bind again.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() bp.bindByName("int", INTEGER));
() => bp.bindByName("int", INTEGER));
stmt.finalize();
run_next_test();
@ -774,7 +774,7 @@ function test_bind_params_array_already_locked()
// We should get an error after we have bound the array to the statement.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() array.addParams(bp2));
() => array.addParams(bp2));
stmt.finalize();
run_next_test();
@ -796,7 +796,7 @@ function test_no_binding_params_from_locked_array()
// We should not be able to get a new BindingParams object after we have bound
// to the statement.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() array.newBindingParams());
() => array.newBindingParams());
stmt.finalize();
run_next_test();
@ -816,7 +816,7 @@ function test_not_right_owning_array()
// We should not be able to add bp to array2 since it was created from array1.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() array2.addParams(bp));
() => array2.addParams(bp));
stmt.finalize();
run_next_test();
@ -841,7 +841,7 @@ function test_not_right_owning_statement()
// We should not be able to bind array1 since it was created from stmt1.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() stmt2.bindParameters(array1));
() => stmt2.bindParameters(array1));
stmt1.finalize();
stmt2.finalize();
@ -860,7 +860,7 @@ function test_bind_empty_array()
// We should not be able to bind this array to the statement because it is
// empty.
expectError(Cr.NS_ERROR_UNEXPECTED,
function() stmt.bindParameters(paramsArray));
() => stmt.bindParameters(paramsArray));
stmt.finalize();
run_next_test();

View File

@ -589,7 +589,7 @@ add_task(function test_clone_readonly()
// A write statement should fail here.
let stmt = db2.createStatement("INSERT INTO test (name) VALUES (:name)");
stmt.params.name = "reed";
expectError(Cr.NS_ERROR_FILE_READ_ONLY, function() stmt.execute());
expectError(Cr.NS_ERROR_FILE_READ_ONLY, () => stmt.execute());
stmt.finalize();
// And a read statement should succeed.
@ -614,7 +614,7 @@ add_task(function test_clone_shared_readonly()
// for. Our IDL comments will have to be updated when this starts to
// work again.
stmt.execute();
// expectError(Components.results.NS_ERROR_FILE_READ_ONLY, function() stmt.execute());
// expectError(Components.results.NS_ERROR_FILE_READ_ONLY, () => stmt.execute());
stmt.finalize();
// And a read statement should succeed.
@ -635,7 +635,7 @@ add_task(function test_close_clone_fails()
calls.forEach(function(methodName) {
let db = getService()[methodName](getTestDB());
db.close();
expectError(Cr.NS_ERROR_NOT_INITIALIZED, function() db.clone());
expectError(Cr.NS_ERROR_NOT_INITIALIZED, () => db.clone());
});
});
@ -643,7 +643,7 @@ add_task(function test_memory_clone_fails()
{
let db = getService().openSpecialDatabase("memory");
db.close();
expectError(Cr.NS_ERROR_NOT_INITIALIZED, function() db.clone());
expectError(Cr.NS_ERROR_NOT_INITIALIZED, () => db.clone());
});
add_task(function test_clone_copies_functions()
@ -663,9 +663,9 @@ add_task(function test_clone_copies_functions()
let db1 = getService()[methodName](getTestDB());
// Create a function for db1.
db1[functionMethod](FUNC_NAME, 1, {
onFunctionCall: function() 0,
onStep: function() 0,
onFinal: function() 0,
onFunctionCall: () => 0,
onStep: () => 0,
onFinal: () => 0,
});
// Clone it, and make sure the function exists still.
@ -693,7 +693,7 @@ add_task(function test_clone_copies_overridden_functions()
onStep: function() {
this.called = true;
},
onFinal: function() 0,
onFinal: () => 0,
};
let calls = [

View File

@ -43,8 +43,12 @@ vacuumParticipant.prototype =
classID: Components.ID("{52aa0b22-b82f-4e38-992a-c3675a3355d2}"),
contractID: "@unit.test.com/test-vacuum-participant;1",
get expectedDatabasePageSize() this._dbConn.defaultPageSize,
get databaseConnection() this._dbConn,
get expectedDatabasePageSize() {
return this._dbConn.defaultPageSize;
},
get databaseConnection() {
return this._dbConn;
},
_grant: true,
onBeginVacuum: function TVP_onBeginVacuum()