diff --git a/storage/test/unit/head_storage.js b/storage/test/unit/head_storage.js index 44106149bf1..a60fe47b65e 100644 --- a/storage/test/unit/head_storage.js +++ b/storage/test/unit/head_storage.js @@ -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. diff --git a/storage/test/unit/test_connection_executeAsync.js b/storage/test/unit/test_connection_executeAsync.js index 2111362ce19..f104e943aee 100644 --- a/storage/test/unit/test_connection_executeAsync.js +++ b/storage/test/unit/test_connection_executeAsync.js @@ -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() diff --git a/storage/test/unit/test_js_helpers.js b/storage/test/unit/test_js_helpers.js index 4354db0f1b5..185240c6a23 100644 --- a/storage/test/unit/test_js_helpers.js +++ b/storage/test/unit/test_js_helpers.js @@ -123,5 +123,5 @@ function run_test() ); // Run the tests. - tests.forEach(function(test) test()); + tests.forEach(test => test()); } diff --git a/storage/test/unit/test_locale_collation.js b/storage/test/unit/test_locale_collation.js index 1bf92b68901..f862193df26 100644 --- a/storage/test/unit/test_locale_collation.js +++ b/storage/test/unit/test_locale_collation.js @@ -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") }, ]; diff --git a/storage/test/unit/test_statement_executeAsync.js b/storage/test/unit/test_statement_executeAsync.js index 43347f241dd..9e12d3fe31f 100644 --- a/storage/test/unit/test_statement_executeAsync.js +++ b/storage/test/unit/test_statement_executeAsync.js @@ -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(); diff --git a/storage/test/unit/test_storage_connection.js b/storage/test/unit/test_storage_connection.js index be1cacfb90f..825a26bbe30 100644 --- a/storage/test/unit/test_storage_connection.js +++ b/storage/test/unit/test_storage_connection.js @@ -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 = [ diff --git a/storage/test/unit/vacuumParticipant.js b/storage/test/unit/vacuumParticipant.js index 9f8d0bb3a75..85ff1bdcdd2 100644 --- a/storage/test/unit/vacuumParticipant.js +++ b/storage/test/unit/vacuumParticipant.js @@ -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()