Bug 1230549 - Storage should pass more eslint rules. r=yoric
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 04 Dec 2015 17:00:03 +0100
changeset 297308 dc9d0cfb61293c6e70c67a396e5528cdf8f4645d
parent 297307 0914d89dc7b94e42da4a75e7036032e0e4cbb791
child 297309 22d7d0b39c38a48fbb86c5c961404ae75403e4d4
push id8824
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:18:56 +0000
treeherdermozilla-aurora@e2031358e2a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyoric
bugs1230549
milestone45.0a1
Bug 1230549 - Storage should pass more eslint rules. r=yoric
.eslintignore
storage/test/unit/head_storage.js
storage/test/unit/test_bug-365166.js
storage/test/unit/test_bug-393952.js
storage/test/unit/test_bug-429521.js
storage/test/unit/test_bug-444233.js
storage/test/unit/test_chunk_growth.js
storage/test/unit/test_connection_executeAsync.js
storage/test/unit/test_connection_executeSimpleSQLAsync.js
storage/test/unit/test_js_helpers.js
storage/test/unit/test_levenshtein.js
storage/test/unit/test_like.js
storage/test/unit/test_like_escape.js
storage/test/unit/test_locale_collation.js
storage/test/unit/test_sqlite_secure_delete.js
storage/test/unit/test_statement_executeAsync.js
storage/test/unit/test_statement_wrapper_automatically.js
storage/test/unit/test_storage_aggregates.js
storage/test/unit/test_storage_connection.js
storage/test/unit/test_storage_function.js
storage/test/unit/test_storage_progresshandler.js
storage/test/unit/test_storage_service.js
storage/test/unit/test_storage_service_unshared.js
storage/test/unit/test_storage_statement.js
storage/test/unit/test_storage_value_array.js
storage/test/unit/test_telemetry_vfs.js
storage/test/unit/test_unicode.js
storage/test/unit/test_vacuum.js
storage/test/unit/vacuumParticipant.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -37,17 +37,16 @@ nsprpub/**
 other-licenses/**
 parser/**
 probes/**
 python/**
 rdf/**
 security/**
 services/**
 startupcache/**
-storage/**
 testing/**
 tools/**
 uriloader/**
 view/**
 webapprt/**
 widget/**
 xpcom/**
 xpfe/**
--- a/storage/test/unit/head_storage.js
+++ b/storage/test/unit/head_storage.js
@@ -11,16 +11,18 @@ Cu.import("resource://gre/modules/XPCOMU
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
     "resource://gre/modules/Promise.jsm");
 
 
 do_get_profile();
 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties);
 
+var gDBConn = null;
+
 function getTestDB()
 {
   var db = dirSvc.get("ProfD", Ci.nsIFile);
   db.append("test_storage.sqlite");
   return db;
 }
 
 /**
@@ -48,54 +50,52 @@ function cleanup()
   // we need to null out the database variable to get a new connection the next
   // time getOpenedDatabase is called
   gDBConn = null;
 
   // removing test db
   print("*** Storage Tests: Trying to remove file!");
   var dbFile = getTestDB();
   if (dbFile.exists())
-    try { dbFile.remove(false); } catch(e) { /* stupid windows box */ }
+    try { dbFile.remove(false); } catch (e) { /* stupid windows box */ }
 }
 
 /**
  * Use asyncClose to cleanup a connection.  Synchronous by means of internally
  * spinning an event loop.
  */
 function asyncCleanup()
 {
   let closed = false;
 
   // close the connection
   print("*** Storage Tests: Trying to asyncClose!");
-  getOpenedDatabase().asyncClose(function() { closed = true; });
+  getOpenedDatabase().asyncClose(function () { closed = true; });
 
   let curThread = Components.classes["@mozilla.org/thread-manager;1"]
                             .getService().currentThread;
   while (!closed)
     curThread.processNextEvent(true);
 
   // we need to null out the database variable to get a new connection the next
   // time getOpenedDatabase is called
   gDBConn = null;
 
   // removing test db
   print("*** Storage Tests: Trying to remove file!");
   var dbFile = getTestDB();
   if (dbFile.exists())
-    try { dbFile.remove(false); } catch(e) { /* stupid windows box */ }
+    try { dbFile.remove(false); } catch (e) { /* stupid windows box */ }
 }
 
 function getService()
 {
   return Cc["@mozilla.org/storage/service;1"].getService(Ci.mozIStorageService);
 }
 
-var gDBConn = null;
-
 /**
  * Get a connection to the test database.  Creates and caches the connection
  * if necessary, otherwise reuses the existing cached connection. This
  * connection shares its cache.
  *
  * @returns the mozIStorageConnection for the file.
  */
 function getOpenedDatabase()
@@ -164,17 +164,17 @@ function createAsyncStatement(aSQL)
  *        The function to invoke and expect an XPCOM-style error from.
  */
 function expectError(aErrorCode, aFunction)
 {
   let exceptionCaught = false;
   try {
     aFunction();
   }
-  catch(e) {
+  catch (e) {
     if (e.result != aErrorCode) {
       do_throw("Got an exception, but the result code was not the expected " +
                "one.  Expected " + aErrorCode + ", got " + e.result);
     }
     exceptionCaught = true;
   }
   if (!exceptionCaught)
     do_throw(aFunction + " should have thrown an exception but did not!");
@@ -203,27 +203,27 @@ function verifyQuery(aSQLString, aBind, 
                "there are only " + aResults.length + "!");
     for (let iCol = 0; iCol < nCols; iCol++) {
       let expectedVal = aResults[iCol];
       let valType = stmt.getTypeOfIndex(iCol);
       if (expectedVal === null) {
         do_check_eq(stmt.VALUE_TYPE_NULL, valType);
         do_check_true(stmt.getIsNull(iCol));
       }
-      else if (typeof(expectedVal) == "number") {
+      else if (typeof expectedVal == "number") {
         if (Math.floor(expectedVal) == expectedVal) {
           do_check_eq(stmt.VALUE_TYPE_INTEGER, valType);
           do_check_eq(expectedVal, stmt.getInt32(iCol));
         }
         else {
           do_check_eq(stmt.VALUE_TYPE_FLOAT, valType);
           do_check_eq(expectedVal, stmt.getDouble(iCol));
         }
       }
-      else if (typeof(expectedVal) == "string") {
+      else if (typeof expectedVal == "string") {
         do_check_eq(stmt.VALUE_TYPE_TEXT, valType);
         do_check_eq(expectedVal, stmt.getUTF8String(iCol));
       }
       else { // blob
         do_check_eq(stmt.VALUE_TYPE_BLOB, valType);
         let count = { value: 0 }, blob = { value: null };
         stmt.getBlob(iCol, count, blob);
         do_check_eq(count.value, expectedVal.length);
--- a/storage/test/unit/test_bug-365166.js
+++ b/storage/test/unit/test_bug-365166.js
@@ -1,27 +1,24 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/licenses/publicdomain/  */ 
-
 // Testcase for bug 365166 - crash [@ strlen] calling
 // mozIStorageStatement::getColumnName of a statement created with
 // "PRAGMA user_version" or "PRAGMA schema_version"
 function run_test() {
   test('user');
   test('schema');
 
   function test(param)
   {
     var colName = param + "_version";
     var sql = "PRAGMA " + colName;
 
     var file = getTestDB();
     var storageService = Components.classes["@mozilla.org/storage/service;1"].
                          getService(Components.interfaces.mozIStorageService);
-    var conn = storageService.openDatabase(file); 
+    var conn = storageService.openDatabase(file);
     var statement = conn.createStatement(sql);
     try {
       // This shouldn't crash:
       do_check_eq(statement.getColumnName(0), colName);
     } finally {
       statement.reset();
       statement.finalize();
     }
--- a/storage/test/unit/test_bug-393952.js
+++ b/storage/test/unit/test_bug-393952.js
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Testcase for bug 393952:  crash when I try to VACUUM and one of the tables
-// has a UNIQUE text column.   StorageUnicodeFunctions::likeFunction() 
+// has a UNIQUE text column.   StorageUnicodeFunctions::likeFunction()
 // needs to handle null aArgv[0] and aArgv[1]
 
 function setup()
 {
   getOpenedDatabase().createTable("t1", "x TEXT UNIQUE");
 
   var stmt = createStatement("INSERT INTO t1 (x) VALUES ('a')");
   stmt.execute();
@@ -27,12 +27,12 @@ function test_vacuum()
 var tests = [test_vacuum];
 
 function run_test()
 {
   setup();
 
   for (var i = 0; i < tests.length; i++)
     tests[i]();
-    
+
   cleanup();
 }
 
--- a/storage/test/unit/test_bug-429521.js
+++ b/storage/test/unit/test_bug-429521.js
@@ -1,49 +1,46 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-function setup() 
-{
-    getOpenedDatabase().createTable("t1", "x TEXT");
+function setup() {
+  getOpenedDatabase().createTable("t1", "x TEXT");
 
-    var stmt = createStatement("INSERT INTO t1 (x) VALUES ('/mozilla.org/20070129_1/Europe/Berlin')");
-    stmt.execute();
-    stmt.finalize();
+  var stmt = createStatement("INSERT INTO t1 (x) VALUES ('/mozilla.org/20070129_1/Europe/Berlin')");
+  stmt.execute();
+  stmt.finalize();
 }
 
-function test_bug429521() 
-{
-    var stmt = createStatement(
-        "SELECT DISTINCT(zone) FROM ("+
-            "SELECT x AS zone FROM t1 WHERE x LIKE '/mozilla.org%'" +
-        ");");
+function test_bug429521() {
+  var stmt = createStatement(
+    "SELECT DISTINCT(zone) FROM (" +
+        "SELECT x AS zone FROM t1 WHERE x LIKE '/mozilla.org%'" +
+    ");");
 
-    print("*** test_bug429521: started");
+  print("*** test_bug429521: started");
 
-    try {
-        while (stmt.executeStep()) {
-            print("*** test_bug429521: step() Read wrapper.row.zone");
+  try {
+    while (stmt.executeStep()) {
+      print("*** test_bug429521: step() Read wrapper.row.zone");
 
-            // BUG: the print commands after the following statement
-            // are never executed. Script stops immediately.
-            var tzId = stmt.row.zone;
+      // BUG: the print commands after the following statement
+      // are never executed. Script stops immediately.
+      var tzId = stmt.row.zone;
 
-            print("*** test_bug429521: step() Read wrapper.row.zone finished");
-        }
-    } catch (e) {
-        print("*** test_bug429521: " + e);
+      print("*** test_bug429521: step() Read wrapper.row.zone finished");
     }
+  } catch (e) {
+    print("*** test_bug429521: " + e);
+  }
 
-    print("*** test_bug429521: finished");
+  print("*** test_bug429521: finished");
 
-    stmt.finalize();
+  stmt.finalize();
 }
 
-function run_test()
-{
+function run_test() {
   setup();
 
   test_bug429521();
-    
+
   cleanup();
 }
--- a/storage/test/unit/test_bug-444233.js
+++ b/storage/test/unit/test_bug-444233.js
@@ -1,51 +1,51 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function setup() {
-    // Create the table
-    getOpenedDatabase().createTable("test_bug444233",
-                                    "id INTEGER PRIMARY KEY, value TEXT");
+  // Create the table
+  getOpenedDatabase().createTable("test_bug444233",
+                                  "id INTEGER PRIMARY KEY, value TEXT");
 
-    // Insert dummy data, using wrapper methods
-    var stmt = createStatement("INSERT INTO test_bug444233 (value) VALUES (:value)");
-    stmt.params.value = "value1"
-    stmt.execute();
-    stmt.finalize();
-    
-    stmt = createStatement("INSERT INTO test_bug444233 (value) VALUES (:value)");
-    stmt.params.value = "value2"
-    stmt.execute();
-    stmt.finalize();
+  // Insert dummy data, using wrapper methods
+  var stmt = createStatement("INSERT INTO test_bug444233 (value) VALUES (:value)");
+  stmt.params.value = "value1";
+  stmt.execute();
+  stmt.finalize();
+
+  stmt = createStatement("INSERT INTO test_bug444233 (value) VALUES (:value)");
+  stmt.params.value = "value2";
+  stmt.execute();
+  stmt.finalize();
 }
 
 function test_bug444233() {
-    print("*** test_bug444233: started");
-    
-    // Check that there are 2 results
-    var stmt = createStatement("SELECT COUNT(*) AS number FROM test_bug444233");
-    do_check_true(stmt.executeStep());
-    do_check_eq(2, stmt.row.number);
-    stmt.reset();
-    stmt.finalize();
+  print("*** test_bug444233: started");
+
+  // Check that there are 2 results
+  var stmt = createStatement("SELECT COUNT(*) AS number FROM test_bug444233");
+  do_check_true(stmt.executeStep());
+  do_check_eq(2, stmt.row.number);
+  stmt.reset();
+  stmt.finalize();
+
+  print("*** test_bug444233: doing delete");
 
-    print("*** test_bug444233: doing delete");
-    
-    // Now try to delete using IN
-    // Cheating since we know ids are 1,2
-    try {
-        var ids = [1, 2];
-        stmt = createStatement("DELETE FROM test_bug444233 WHERE id IN (:ids)");
-        stmt.params.ids = ids;
-    } catch (e) {
-        print("*** test_bug444233: successfully caught exception");
-    }
-    stmt.finalize();
+  // Now try to delete using IN
+  // Cheating since we know ids are 1,2
+  try {
+    var ids = [1, 2];
+    stmt = createStatement("DELETE FROM test_bug444233 WHERE id IN (:ids)");
+    stmt.params.ids = ids;
+  } catch (e) {
+    print("*** test_bug444233: successfully caught exception");
+  }
+  stmt.finalize();
 }
 
 function run_test() {
-    setup();
-    test_bug444233();
-    cleanup();
+  setup();
+  test_bug444233();
+  cleanup();
 }
 
--- a/storage/test/unit/test_chunk_growth.js
+++ b/storage/test/unit/test_chunk_growth.js
@@ -1,24 +1,24 @@
 // This file tests SQLITE_FCNTL_CHUNK_SIZE behaves as expected
 
 function run_sql(d, sql) {
-  var stmt = d.createStatement(sql)
-  stmt.execute()
+  var stmt = d.createStatement(sql);
+  stmt.execute();
   stmt.finalize();
 }
 
 function new_file(name) {
   var file = dirSvc.get("ProfD", Ci.nsIFile);
   file.append(name);
   return file;
 }
 
 function get_size(name) {
-  return new_file(name).fileSize
+  return new_file(name).fileSize;
 }
 
 function run_test() {
   const filename = "chunked.sqlite";
   const CHUNK_SIZE = 512 * 1024;
   var d = getDatabase(new_file(filename));
   try {
     d.setGrowthIncrement(CHUNK_SIZE, "");
@@ -31,22 +31,22 @@ function run_test() {
   }
   run_sql(d, "CREATE TABLE bloat(data varchar)");
 
   var orig_size = get_size(filename);
   /* Dump in at least 32K worth of data.
    * While writing ensure that the file size growth in chunksize set above.
    */
   const str1024 = new Array(1024).join("T");
-  for(var i = 0; i < 32; i++) {
+  for (var i = 0; i < 32; i++) {
     run_sql(d, "INSERT INTO bloat VALUES('" + str1024 + "')");
-    var size = get_size(filename)
+    var size = get_size(filename);
     // Must not grow in small increments.
     do_check_true(size == orig_size || size >= CHUNK_SIZE);
   }
   /* In addition to growing in chunk-size increments, the db
    * should shrink in chunk-size increments too.
    */
-  run_sql(d, "DELETE FROM bloat")
-  run_sql(d, "VACUUM")
-  do_check_true(get_size(filename) >= CHUNK_SIZE)
+  run_sql(d, "DELETE FROM bloat");
+  run_sql(d, "VACUUM");
+  do_check_true(get_size(filename) >= CHUNK_SIZE);
 }
 
--- a/storage/test/unit/test_connection_executeAsync.js
+++ b/storage/test/unit/test_connection_executeAsync.js
@@ -36,29 +36,27 @@ add_test(function test_create_and_add() 
     "INSERT INTO test (string, number, nuller, blober) VALUES (?, ?, ?, ?)"
   );
   stmts[1].bindByIndex(0, TEXT);
   stmts[1].bindByIndex(1, REAL);
   stmts[1].bindByIndex(2, null);
   stmts[1].bindBlobByIndex(3, BLOB, BLOB.length);
 
   getOpenedDatabase().executeAsync(stmts, stmts.length, {
-    handleResult: function(aResultSet)
-    {
-      dump("handleResult("+aResultSet+")\n");
+    handleResult: function (aResultSet) {
+      dump("handleResult(" + aResultSet + ")\n");
       do_throw("unexpected results obtained!");
     },
-    handleError: function(aError)
+    handleError: function (aError)
     {
-      dump("handleError("+aError.result+")\n");
+      dump("handleError(" + aError.result + ")\n");
       do_throw("unexpected error!");
     },
-    handleCompletion: function(aReason)
-    {
-      dump("handleCompletion("+aReason+")\n");
+    handleCompletion: function (aReason) {
+      dump("handleCompletion(" + aReason + ")\n");
       do_check_eq(Ci.mozIStorageStatementCallback.REASON_FINISHED, aReason);
 
       // Check that the result is in the table
       let stmt = getOpenedDatabase().createStatement(
         "SELECT string, number, nuller, blober FROM test WHERE id = ?"
       );
       stmt.bindByIndex(0, INTEGER);
       try {
@@ -138,28 +136,25 @@ add_test(function test_multiple_bindings
     currentRows = countStmt.row.count;
   }
   finally {
     countStmt.reset();
   }
 
   // Execute asynchronously.
   getOpenedDatabase().executeAsync(stmts, stmts.length, {
-    handleResult: function(aResultSet)
-    {
+    handleResult: function (aResultSet) {
       do_throw("Unexpected call to handleResult!");
     },
-    handleError: function(aError)
-    {
+    handleError: function (aError) {
       print("Error code " + aError.result + " with message '" +
             aError.message + "' returned.");
       do_throw("Unexpected error!");
     },
-    handleCompletion: function(aReason)
-    {
+    handleCompletion: function (aReason) {
       print("handleCompletion(" + aReason +
             ") for test_multiple_bindings_on_statements");
       do_check_eq(Ci.mozIStorageStatementCallback.REASON_FINISHED, aReason);
 
       // Check to make sure we added all of our rows.
       try {
         do_check_true(countStmt.executeStep());
         do_check_eq(currentRows + (ITERATIONS * AMOUNT_TO_ADD),
@@ -175,36 +170,32 @@ add_test(function test_multiple_bindings
   });
   stmts.forEach(stmt => stmt.finalize());
 });
 
 add_test(function test_asyncClose_does_not_complete_before_statements() {
   let stmt = createStatement("SELECT * FROM sqlite_master");
   let executed = false;
   stmt.executeAsync({
-    handleResult: function(aResultSet)
-    {
-    },
-    handleError: function(aError)
-    {
+    handleResult(aResultSet) {},
+    handleError(aError) {
       print("Error code " + aError.result + " with message '" +
             aError.message + "' returned.");
       do_throw("Unexpected error!");
     },
-    handleCompletion: function(aReason)
-    {
+    handleCompletion(aReason) {
       print("handleCompletion(" + aReason +
             ") for test_asyncClose_does_not_complete_before_statements");
       do_check_eq(Ci.mozIStorageStatementCallback.REASON_FINISHED, aReason);
       executed = true;
     }
   });
   stmt.finalize();
 
-  getOpenedDatabase().asyncClose(function() {
+  getOpenedDatabase().asyncClose(function () {
     // Ensure that the statement executed to completion.
     do_check_true(executed);
 
     // Reset gDBConn so that later tests will get a new connection object.
     gDBConn = null;
     run_next_test();
   });
 });
@@ -233,13 +224,12 @@ add_test(function test_double_asyncClose
     }
   }
 
   // Reset gDBConn so that later tests will get a new connection object.
   gDBConn = null;
   run_next_test();
 });
 
-function run_test()
-{
+function run_test() {
   cleanup();
   run_next_test();
 }
--- a/storage/test/unit/test_connection_executeSimpleSQLAsync.js
+++ b/storage/test/unit/test_connection_executeSimpleSQLAsync.js
@@ -8,52 +8,52 @@
  */
 
 const INTEGER = 1;
 const TEXT = "this is test text";
 const REAL = 3.23;
 
 function asyncClose(db) {
   let deferred = Promise.defer();
-  db.asyncClose(function(status) {
+  db.asyncClose(function (status) {
     if (Components.isSuccessCode(status)) {
       deferred.resolve();
     } else {
       deferred.reject(status);
     }
   });
   return deferred.promise;
 }
 
 function openAsyncDatabase(file) {
   let deferred = Promise.defer();
-  getService().openAsyncDatabase(file, null, function(status, db) {
+  getService().openAsyncDatabase(file, null, function (status, db) {
     if (Components.isSuccessCode(status)) {
       deferred.resolve(db.QueryInterface(Ci.mozIStorageAsyncConnection));
     } else {
       deferred.reject(status);
     }
   });
   return deferred.promise;
 }
 
 function executeSimpleSQLAsync(db, query, onResult) {
   let deferred = Promise.defer();
   db.executeSimpleSQLAsync(query, {
-    handleError: function(error) {
+    handleError(error) {
       deferred.reject(error);
     },
-    handleResult: function(result) {
+    handleResult(result) {
       if (onResult) {
         onResult(result);
       } else {
         do_throw("No results were expected");
       }
     },
-    handleCompletion: function(result) {
+    handleCompletion(result) {
       deferred.resolve(result);
     }
   });
   return deferred.promise;
 }
 
 add_task(function* test_create_and_add() {
   let adb = yield openAsyncDatabase(getTestDB());
@@ -68,46 +68,46 @@ add_task(function* test_create_and_add()
     "VALUES (" + INTEGER + ", \"" + TEXT + "\", " + REAL + ")");
 
   do_check_eq(Ci.mozIStorageStatementCallback.REASON_FINISHED, completion);
 
   let result = null;
 
   completion = yield executeSimpleSQLAsync(adb,
     "SELECT string, number FROM test WHERE id = 1",
-    function(aResultSet) {
+    function (aResultSet) {
       result = aResultSet.getNextRow();
       do_check_eq(2, result.numEntries);
       do_check_eq(TEXT, result.getString(0));
       do_check_eq(REAL, result.getDouble(1));
     }
   );
 
   do_check_eq(Ci.mozIStorageStatementCallback.REASON_FINISHED, completion);
   do_check_neq(result, null);
   result = null;
 
   yield executeSimpleSQLAsync(adb, "SELECT COUNT(0) FROM test",
-    function(aResultSet) {
+    function (aResultSet) {
       result = aResultSet.getNextRow();
       do_check_eq(1, result.getInt32(0));
     });
 
   do_check_neq(result, null);
 
   yield asyncClose(adb);
 });
 
 
 add_task(function* test_asyncClose_does_not_complete_before_statement() {
   let adb = yield openAsyncDatabase(getTestDB());
   let executed = false;
 
   let reason = yield executeSimpleSQLAsync(adb, "SELECT * FROM test",
-    function(aResultSet) {
+    function (aResultSet) {
       let result = aResultSet.getNextRow();
 
       do_check_neq(result, null);
       do_check_eq(3, result.numEntries);
       do_check_eq(INTEGER, result.getInt32(0));
       do_check_eq(TEXT, result.getString(1));
       do_check_eq(REAL, result.getDouble(2));
       executed = true;
--- a/storage/test/unit/test_js_helpers.js
+++ b/storage/test/unit/test_js_helpers.js
@@ -18,17 +18,17 @@ function test_params_enumerate()
     "SELECT * FROM test WHERE id IN (:a, :b, :c)"
   );
 
   // Make sure they are right.
   let expected = ["a", "b", "c"];
   let index = 0;
   for (let name in stmt.params) {
     if (name == "QueryInterface")
-        continue;
+      continue;
     do_check_eq(name, expected[index++]);
   }
 }
 
 function test_params_prototype()
 {
   let stmt = createStatement(
     "SELECT * FROM sqlite_master"
--- a/storage/test/unit/test_levenshtein.js
+++ b/storage/test/unit/test_levenshtein.js
@@ -25,18 +25,17 @@ function createUtf16Database()
 function check_levenshtein(db, s, t, expectedDistance)
 {
   var stmt = db.createStatement("SELECT levenshteinDistance(:s, :t) AS result");
   stmt.params.s = s;
   stmt.params.t = t;
   try {
     do_check_true(stmt.executeStep());
     do_check_eq(expectedDistance, stmt.row.result);
-  } 
-  finally {
+  } finally {
     stmt.reset();
     stmt.finalize();
   }
 }
 
 function testLevenshtein(db)
 {
   // Basic tests.
@@ -51,17 +50,17 @@ function testLevenshtein(db)
   check_levenshtein(db, "kitten", "sitting", 3);
   check_levenshtein(db, "Saturday", "Sunday", 3);
   check_levenshtein(db, "YHCQPGK", "LAHYQQKPGKA", 6);
 
   // Test SQL NULL handling.
   check_levenshtein(db, "foo", null, null);
   check_levenshtein(db, null, "bar", null);
   check_levenshtein(db, null, null, null);
-  
+
   // The levenshteinDistance function allocates temporary memory on the stack
   // if it can.  Test some strings long enough to force a heap allocation.
   var dots1000 = Array(1001).join(".");
   var dashes1000 = Array(1001).join("-");
   check_levenshtein(db, dots1000, dashes1000, 1000);
 }
 
 function run_test()
--- a/storage/test/unit/test_like.js
+++ b/storage/test/unit/test_like.js
@@ -88,31 +88,31 @@ function test_like_2()
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_false(stmt.executeStep());
   stmt.reset();
   stmt.finalize();
 }
-    
+
 function test_like_3()
 {
   var stmt = createStatement("SELECT x FROM t1 WHERE x LIKE ?;");
   stmt.bindByIndex(0, 'aBc');
   var solutions = ["abc", "ABC"];
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_false(stmt.executeStep());
   stmt.reset();
   stmt.finalize();
 }
-   
+
 function test_like_4()
 {
   var stmt = createStatement("SELECT x FROM t1 WHERE x LIKE ?;");
   stmt.bindByIndex(0, 'abc%');
   var solutions = ["abc", "abcd", "ABC", "ABC abc xyz"];
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
@@ -148,17 +148,17 @@ function test_like_6()
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_false(stmt.executeStep());
   stmt.reset();
   stmt.finalize();
 }
-    
+
 function test_like_7()
 {
   var stmt = createStatement("SELECT x FROM t1 WHERE x LIKE ?;");
   stmt.bindByIndex(0, 'a_c%');
   var solutions = ["abc", "abcd", "ABC", "ABC abc xyz"];
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
@@ -180,22 +180,23 @@ function test_like_8()
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_true(stmt.executeStep());
   do_check_true(solutions.indexOf(stmt.getString(0)) != -1);
   do_check_false(stmt.executeStep());
   stmt.reset();
   stmt.finalize();
 }
-    
-var tests = [test_count, test_like_1, test_like_2, test_like_3, test_like_4, 
+
+var tests = [test_count, test_like_1, test_like_2, test_like_3, test_like_4,
              test_like_5, test_like_6, test_like_7, test_like_8];
 
 function run_test()
 {
   setup();
 
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
 
--- a/storage/test/unit/test_like_escape.js
+++ b/storage/test/unit/test_like_escape.js
@@ -1,38 +1,38 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const LATIN1_AE = "\xc6";
-const LATIN1_ae = "\xe6"; 
+const LATIN1_ae = "\xe6";
 
 function setup()
 {
   getOpenedDatabase().createTable("t1", "x TEXT");
 
   var stmt = createStatement("INSERT INTO t1 (x) VALUES ('foo/bar_baz%20cheese')");
   stmt.execute();
   stmt.finalize();
 
   stmt = createStatement("INSERT INTO t1 (x) VALUES (?1)");
   // insert LATIN_ae, but search on LATIN_AE
   stmt.bindByIndex(0, "foo%20" + LATIN1_ae + "/_bar");
   stmt.execute();
   stmt.finalize();
 }
-    
+
 function test_escape_for_like_ascii()
 {
   var stmt = createStatement("SELECT x FROM t1 WHERE x LIKE ?1 ESCAPE '/'");
   var paramForLike = stmt.escapeStringForLIKE("oo/bar_baz%20chees", '/');
   // verify that we escaped / _ and %
   do_check_eq(paramForLike, "oo//bar/_baz/%20chees");
   // prepend and append with % for "contains"
-  stmt.bindByIndex(0, "%" + paramForLike + "%"); 
+  stmt.bindByIndex(0, "%" + paramForLike + "%");
   stmt.executeStep();
   do_check_eq("foo/bar_baz%20cheese", stmt.getString(0));
   stmt.finalize();
 }
 
 function test_escape_for_like_non_ascii()
 {
   var stmt = createStatement("SELECT x FROM t1 WHERE x LIKE ?1 ESCAPE '/'");
@@ -47,13 +47,14 @@ function test_escape_for_like_non_ascii(
 }
 
 var tests = [test_escape_for_like_ascii, test_escape_for_like_non_ascii];
 
 function run_test()
 {
   setup();
 
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
--- a/storage/test/unit/test_locale_collation.js
+++ b/storage/test/unit/test_locale_collation.js
@@ -135,31 +135,31 @@ function initTableWithStrings(aStrings, 
  *         strength is computed from this value.
  * @return A function to use as a sorting callback.
  */
 function localeCompare(aCollation)
 {
   var strength;
 
   switch (aCollation) {
-  case "locale":
-    strength = Ci.nsICollation.kCollationCaseInSensitive;
-    break;
-  case "locale_case_sensitive":
-    strength = Ci.nsICollation.kCollationAccentInsenstive;
-    break;
-  case "locale_accent_sensitive":
-    strength = Ci.nsICollation.kCollationCaseInsensitiveAscii;
-    break;
-  case "locale_case_accent_sensitive":
-    strength = Ci.nsICollation.kCollationCaseSensitive;
-    break;
-  default:
-    do_throw("Error in test: unknown collation '" + aCollation + "'");
-    break;
+    case "locale":
+      strength = Ci.nsICollation.kCollationCaseInSensitive;
+      break;
+    case "locale_case_sensitive":
+      strength = Ci.nsICollation.kCollationAccentInsenstive;
+      break;
+    case "locale_accent_sensitive":
+      strength = Ci.nsICollation.kCollationCaseInsensitiveAscii;
+      break;
+    case "locale_case_accent_sensitive":
+      strength = Ci.nsICollation.kCollationCaseSensitive;
+      break;
+    default:
+      do_throw("Error in test: unknown collation '" + aCollation + "'");
+      break;
   }
   return function (aStr1, aStr2) {
     return gLocaleCollation.compareString(strength, aStr1, aStr2);
   };
 }
 
 /**
  * Reads in the test data from the file DATA_BASENAME and returns it as an array
@@ -175,18 +175,19 @@ function readTestData()
 
   let istream = Cc["@mozilla.org/network/file-input-stream;1"].
                 createInstance(Ci.nsIFileInputStream);
   istream.init(file, -1, -1, 0);
   istream.QueryInterface(Components.interfaces.nsILineInputStream);
 
   let line = {};
   let lines = [];
-  while (istream.readLine(line))
-    lines.push(line.value); 
+  while (istream.readLine(line)) {
+    lines.push(line.value);
+  }
   istream.close();
 
   return lines;
 }
 
 /**
  * Gets the results from the given database using the given collation and
  * ensures that they match gStrings sorted by the same collation.
--- a/storage/test/unit/test_sqlite_secure_delete.js
+++ b/storage/test/unit/test_sqlite_secure_delete.js
@@ -29,18 +29,17 @@ function getFileContents(aFile)
                 createInstance(Ci.nsIBinaryInputStream);
   bstream.setInputStream(fstream);
   return bstream.readBytes(bstream.available());
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Tests
 
-function test_delete_removes_data()
-{
+add_test(function test_delete_removes_data() {
   const TEST_STRING = "SomeRandomStringToFind";
 
   let file = getTestDB();
   let db = getService().openDatabase(file);
 
   // Create the table and insert the data.
   db.createTable("test", "data TEXT");
   let stmt = db.createStatement("INSERT INTO test VALUES(:data)");
@@ -69,22 +68,15 @@ function test_delete_removes_data()
   }
   db.close();
 
   // Check the file to see if the string can be found.
   contents = getFileContents(file);
   do_check_eq(-1, contents.indexOf(TEST_STRING));
 
   run_next_test();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//// Test Runner
-
-[
-  test_delete_removes_data,
- ].forEach(add_test);
+});
 
 function run_test()
 {
   cleanup();
   run_next_test();
 }
--- a/storage/test/unit/test_statement_executeAsync.js
+++ b/storage/test/unit/test_statement_executeAsync.js
@@ -48,25 +48,25 @@ function execAsync(aStmt, aOptions, aRes
   if (aOptions == null)
     aOptions = {};
 
   let resultsExpected;
   let resultsChecker;
   if (aResults == null) {
     resultsExpected = 0;
   }
-  else if (typeof(aResults) == "number") {
+  else if (typeof aResults == "number") {
     resultsExpected = aResults;
   }
-  else if (typeof(aResults) == "function") {
+  else if (typeof aResults == "function") {
     resultsChecker = aResults;
   }
   else { // array
     resultsExpected = aResults.length;
-    resultsChecker = function(aResultNum, aTup, aCaller) {
+    resultsChecker = function (aResultNum, aTup, aCaller) {
       aResults[aResultNum](aTup, aCaller);
     };
   }
   let resultsSeen = 0;
 
   let errorCodeExpected = false;
   let reasonExpected = Ci.mozIStorageStatementCallback.REASON_FINISHED;
   let altReasonExpected = null;
@@ -78,36 +78,36 @@ function execAsync(aStmt, aOptions, aRes
   let errorCodeSeen = false;
 
   if ("cancel" in aOptions && aOptions.cancel)
     altReasonExpected = Ci.mozIStorageStatementCallback.REASON_CANCELED;
 
   let completed = false;
 
   let listener = {
-    handleResult: function(aResultSet)
+    handleResult(aResultSet)
     {
       let row, resultsSeenThisCall = 0;
       while ((row = aResultSet.getNextRow()) != null) {
         if (resultsChecker)
           resultsChecker(resultsSeen, row, caller);
         resultsSeen++;
         resultsSeenThisCall++;
       }
 
       if (!resultsSeenThisCall)
         do_throw("handleResult invoked with 0 result rows!");
     },
-    handleError: function(aError)
+    handleError(aError)
     {
       if (errorCodeSeen != false)
         do_throw("handleError called when we already had an error!");
       errorCodeSeen = aError.result;
     },
-    handleCompletion: function(aReason)
+    handleCompletion(aReason)
     {
       if (completed) // paranoia check
         do_throw("Received a second handleCompletion notification!", caller);
 
       if (resultsSeen != resultsExpected)
         do_throw("Expected " + resultsExpected + " rows of results but " +
                  "got " + resultsSeen + " rows!", caller);
 
@@ -221,18 +221,17 @@ function test_add_data()
 
 function test_get_data()
 {
   var stmt = makeTestStatement(
     "SELECT string, number, nuller, blober, id FROM test WHERE id = ?"
   );
   stmt.bindByIndex(0, INTEGER);
   execAsync(stmt, {}, [
-    function(tuple)
-    {
+    function (tuple) {
       do_check_neq(null, tuple);
 
       // Check that it's what we expect
       do_check_false(tuple.getIsNull(0));
       do_check_eq(tuple.getResultByName("string"), tuple.getResultByIndex(0));
       do_check_eq(TEXT, tuple.getResultByName("string"));
       do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_TEXT,
                   tuple.getTypeOfIndex(0));
@@ -249,25 +248,25 @@ function test_get_data()
       do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_NULL,
                   tuple.getTypeOfIndex(2));
 
       do_check_false(tuple.getIsNull(3));
       var blobByName = tuple.getResultByName("blober");
       do_check_eq(BLOB.length, blobByName.length);
       var blobByIndex = tuple.getResultByIndex(3);
       do_check_eq(BLOB.length, blobByIndex.length);
-      for (var i = 0; i < BLOB.length; i++) {
+      for (let i = 0; i < BLOB.length; i++) {
         do_check_eq(BLOB[i], blobByName[i]);
         do_check_eq(BLOB[i], blobByIndex[i]);
       }
       var count = { value: 0 };
       var blob = { value: null };
       tuple.getBlob(3, count, blob);
       do_check_eq(BLOB.length, count.value);
-      for (var i = 0; i < BLOB.length; i++)
+      for (let i = 0; i < BLOB.length; i++)
         do_check_eq(BLOB[i], blob.value[i]);
       do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_BLOB,
                   tuple.getTypeOfIndex(3));
 
       do_check_false(tuple.getIsNull(4));
       do_check_eq(tuple.getResultByName("id"), tuple.getResultByIndex(4));
       do_check_eq(INTEGER, tuple.getResultByName("id"));
       do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_INTEGER,
@@ -278,17 +277,17 @@ function test_get_data()
 }
 
 function test_tuple_out_of_bounds()
 {
   var stmt = makeTestStatement(
     "SELECT string FROM test"
   );
   execAsync(stmt, {}, [
-    function(tuple) {
+    function (tuple) {
       do_check_neq(null, tuple);
 
       // Check all out of bounds - should throw
       var methods = [
         "getTypeOfIndex",
         "getInt32",
         "getInt64",
         "getDouble",
@@ -362,29 +361,23 @@ function test_no_listener_works_on_error
 
 function test_partial_listener_works()
 {
   var stmt = makeTestStatement(
     "DELETE FROM test WHERE id = ?"
   );
   stmt.bindByIndex(0, 0);
   stmt.executeAsync({
-    handleResult: function(aResultSet)
-    {
-    }
+    handleResult(aResultSet) {}
   });
   stmt.executeAsync({
-    handleError: function(aError)
-    {
-    }
+    handleError(aError) {}
   });
   stmt.executeAsync({
-    handleCompletion: function(aReason)
-    {
-    }
+    handleCompletion(aReason) {}
   });
   stmt.finalize();
 
   // Run the next test.
   run_next_test();
 }
 
 /**
@@ -462,18 +455,19 @@ function test_finalized_statement_does_n
 {
   var stmt = makeTestStatement(
     "SELECT * FROM TEST"
   );
   stmt.finalize();
   // we are concerned about a crash here; an error is fine.
   try {
     stmt.executeAsync();
+  } catch (ex) {
+    // Do nothing.
   }
-  catch (ex) {}
 
   // Run the next test.
   run_next_test();
 }
 
 /**
  * Bind by mozIStorageBindingParams on the mozIStorageBaseStatement by index.
  */
@@ -900,24 +894,23 @@ var testPass = TEST_PASS_SYNC;
 /**
  * Create a statement of the type under test per testPass.
  *
  * @param aSQL
  *        The SQL string from which to build a statement.
  * @return a statement of the type under test per testPass.
  */
 function makeTestStatement(aSQL) {
-  if (testPass == TEST_PASS_SYNC)
+  if (testPass == TEST_PASS_SYNC) {
     return getOpenedDatabase().createStatement(aSQL);
-  else
-    return getOpenedDatabase().createAsyncStatement(aSQL);
+  }
+  return getOpenedDatabase().createAsyncStatement(aSQL);
 }
 
-var tests =
-[
+var tests = [
   test_illegal_sql_async_deferred,
   test_create_table,
   test_add_data,
   test_get_data,
   test_tuple_out_of_bounds,
   test_no_listener_works_on_success,
   test_no_listener_works_on_results,
   test_no_listener_works_on_error,
--- a/storage/test/unit/test_statement_wrapper_automatically.js
+++ b/storage/test/unit/test_statement_wrapper_automatically.js
@@ -124,22 +124,19 @@ function insertAndCheckMultipleParams(aV
  * A convenience function that prints out a description of aVal using
  * aVal.toString and aVal.toSource.  Output is useful when the test fails.
  *
  * @param aVal
  *        a value inserted or to be inserted into our test table
  */
 function printValDesc(aVal)
 {
-  try
-  {
+  try {
     var toSource = aVal.toSource();
-  }
-  catch (exc)
-  {
+  } catch (ex) {
     toSource = "";
   }
   print("Testing value: toString=" + aVal +
         (toSource ? " toSource=" + toSource : ""));
 }
 
 function run_test()
 {
@@ -158,13 +155,13 @@ function run_test()
   ];
 
   vals.forEach(function (val)
   {
     printValDesc(val);
     print("Single parameter");
     insertAndCheckSingleParam(val);
     print("Multiple parameters");
-    insertAndCheckMultipleParams(val)
+    insertAndCheckMultipleParams(val);
   });
 
   cleanup();
 }
--- a/storage/test/unit/test_storage_aggregates.js
+++ b/storage/test/unit/test_storage_aggregates.js
@@ -6,39 +6,39 @@
 
 var testNums = [1, 2, 3, 4];
 
 function setup()
 {
   getOpenedDatabase().createTable("function_tests", "id INTEGER PRIMARY KEY");
 
   var stmt = createStatement("INSERT INTO function_tests (id) VALUES(?1)");
-  for(var i = 0; i < testNums.length; ++i) {
+  for (let i = 0; i < testNums.length; ++i) {
     stmt.bindByIndex(0, testNums[i]);
     stmt.execute();
   }
   stmt.reset();
   stmt.finalize();
 }
 
 var testSquareAndSumFunction = {
   calls: 0,
   _sas: 0,
 
-  reset: function() {
+  reset() {
     this.calls = 0;
-    this._sas  = 0;
+    this._sas = 0;
   },
 
-  onStep: function(val) {
+  onStep(val) {
     ++this.calls;
     this._sas += val.getInt32(0) * val.getInt32(0);
   },
 
-  onFinal: function() {
+  onFinal() {
     var retval = this._sas;
     this._sas = 0; // Prepare for next group
     return retval;
   }
 };
 
 function test_aggregate_registration()
 {
@@ -74,26 +74,28 @@ function test_aggregate_no_aliases()
   } catch (e) {
     do_check_eq(Cr.NS_ERROR_FAILURE, e.result);
   }
 }
 
 function test_aggregate_call()
 {
   var stmt = createStatement("SELECT test_sas_aggr(id) FROM function_tests");
-  while(stmt.executeStep());
+  while (stmt.executeStep()) {
+    // Do nothing.
+  }
   do_check_eq(testNums.length, testSquareAndSumFunction.calls);
   testSquareAndSumFunction.reset();
   stmt.finalize();
 }
 
 function test_aggregate_result()
 {
   var sas = 0;
-  for(var i = 0; i < testNums.length; ++i) {
+  for (var i = 0; i < testNums.length; ++i) {
     sas += testNums[i] * testNums[i];
   }
   var stmt = createStatement("SELECT test_sas_aggr(id) FROM function_tests");
   stmt.executeStep();
   do_check_eq(sas, stmt.getInt32(0));
   testSquareAndSumFunction.reset();
   stmt.finalize();
 }
--- a/storage/test/unit/test_storage_connection.js
+++ b/storage/test/unit/test_storage_connection.js
@@ -4,29 +4,29 @@
 
 // This file tests the functions of mozIStorageConnection
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Test Functions
 
 function asyncClone(db, readOnly) {
   let deferred = Promise.defer();
-  db.asyncClone(readOnly, function(status, db2) {
+  db.asyncClone(readOnly, function (status, db2) {
     if (Components.isSuccessCode(status)) {
       deferred.resolve(db2);
     } else {
       deferred.reject(status);
     }
   });
   return deferred.promise;
 }
 
 function asyncClose(db) {
   let deferred = Promise.defer();
-  db.asyncClose(function(status) {
+  db.asyncClose(function (status) {
     if (Components.isSuccessCode(status)) {
       deferred.resolve();
     } else {
       deferred.reject(status);
     }
   });
   return deferred.promise;
 }
@@ -36,38 +36,38 @@ function openAsyncDatabase(file, options
   let properties;
   if (options) {
     properties = Cc["@mozilla.org/hash-property-bag;1"].
         createInstance(Ci.nsIWritablePropertyBag);
     for (let k in options) {
       properties.setProperty(k, options[k]);
     }
   }
-  getService().openAsyncDatabase(file, properties, function(status, db) {
+  getService().openAsyncDatabase(file, properties, function (status, db) {
     if (Components.isSuccessCode(status)) {
       deferred.resolve(db.QueryInterface(Ci.mozIStorageAsyncConnection));
     } else {
       deferred.reject(status);
     }
   });
   return deferred.promise;
 }
 
 function executeAsync(statement, onResult) {
   let deferred = Promise.defer();
   statement.executeAsync({
-    handleError: function(error) {
+    handleError: function (error) {
       deferred.reject(error);
     },
-    handleResult: function(result) {
+    handleResult: function (result) {
       if (onResult) {
         onResult(result);
       }
     },
-    handleCompletion: function(result) {
+    handleCompletion: function (result) {
       deferred.resolve(result);
     }
   });
   return deferred.promise;
 }
 
 add_task(function* test_connectionReady_open() {
   // there doesn't seem to be a way for the connection to not be ready (unless
@@ -158,17 +158,21 @@ add_task(function* test_attach_createTab
   }
 
   do_check_false(msc.indexExists("sample.test_ind"));
   msc.executeSimpleSQL("CREATE INDEX sample.test_ind ON test (name)");
   do_check_true(msc.indexExists("sample.test_ind"));
 
   msc.executeSimpleSQL("DETACH DATABASE sample");
   msc2.close();
-  try { file.remove(false); } catch(e) { }
+  try {
+    file.remove(false);
+  } catch (e) {
+    // Do nothing.
+  }
 });
 
 add_task(function* test_lastInsertRowID() {
   var msc = getOpenedDatabase();
   msc.executeSimpleSQL("INSERT INTO test (name) VALUES ('foo')");
   do_check_eq(1, msc.lastInsertRowID);
 });
 
@@ -232,28 +236,32 @@ add_task(function* test_set_schemaVersio
 
 add_task(function* test_set_schemaVersion_negative() {
   var msc = getOpenedDatabase();
   const version = -1;
   msc.schemaVersion = version;
   do_check_eq(version, msc.schemaVersion);
 });
 
-add_task(function* test_createTable(){
+add_task(function* test_createTable() {
   var temp = getTestDB().parent;
   temp.append("test_db_table");
   try {
     var con = getService().openDatabase(temp);
-    con.createTable("a","");
+    con.createTable("a", "");
   } catch (e) {
-    if (temp.exists()) try {
-      temp.remove(false);
-    } catch (e2) {}
-    do_check_true(e.result==Cr.NS_ERROR_NOT_INITIALIZED ||
-                  e.result==Cr.NS_ERROR_FAILURE);
+    if (temp.exists()) {
+      try {
+        temp.remove(false);
+      } catch (e2) {
+        // Do nothing.
+      }
+    }
+    do_check_true(e.result == Cr.NS_ERROR_NOT_INITIALIZED ||
+                  e.result == Cr.NS_ERROR_FAILURE);
   } finally {
     if (con) {
       con.close();
     }
   }
 });
 
 add_task(function* test_defaultSynchronousAtNormal() {
@@ -270,18 +278,17 @@ add_task(function* test_defaultSynchrono
 });
 
 // must be ran before executeAsync tests
 add_task(function* test_close_does_not_spin_event_loop() {
   // We want to make sure that the event loop on the calling thread does not
   // spin when close is called.
   let event = {
     ran: false,
-    run: function()
-    {
+    run() {
       this.ran = true;
     },
   };
 
   // Post the event before we call close, so it would run if the event loop was
   // spun during close.
   let thread = Cc["@mozilla.org/thread-manager;1"].
                getService(Ci.nsIThreadManager).
@@ -351,17 +358,17 @@ add_task(function* test_close_fails_with
     db.close();
     do_throw("should have thrown");
   }
   catch (e) {
     do_check_eq(e.result, Cr.NS_ERROR_UNEXPECTED);
   }
   finally {
     // Clean up after ourselves.
-    db.asyncClose(function() {
+    db.asyncClose(function () {
       // Reset gDBConn so that later tests will get a new connection object.
       gDBConn = null;
       deferred.resolve();
     });
   }
   yield deferred.promise;
 });
 
@@ -408,23 +415,22 @@ function* standardAsyncTest(promisedDB, 
   stmt.params.name = name;
   let result = yield executeAsync(stmt);
   do_print("Request complete");
   stmt.finalize();
   do_check_true(Components.isSuccessCode(result));
   do_print("Extracting data");
   stmt = adb.createAsyncStatement("SELECT * FROM test");
   let found = false;
-  yield executeAsync(stmt, function(result) {
+  yield executeAsync(stmt, function (results) {
     do_print("Data has been extracted");
-
-    for (let row = result.getNextRow(); row != null; row = result.getNextRow()) {
+    for (let row = results.getNextRow(); row != null; row = results.getNextRow()) {
       if (row.getResultByName("name") == name) {
         found = true;
-      break;
+        break;
       }
     }
   });
   do_check_true(found);
   stmt.finalize();
   yield asyncClose(adb);
 
   do_print("Standard async test " + name + " complete");
@@ -479,23 +485,22 @@ add_task(function* test_async_open_with_
   stmt.params.name = "clockworker";
   let result = yield executeAsync(stmt);
   do_print("Request complete");
   stmt.finalize();
   do_check_true(Components.isSuccessCode(result));
   do_print("Extracting data");
   stmt = adb.createAsyncStatement("SELECT * FROM test");
   let found = false;
-  yield executeAsync(stmt, function(result) {
+  yield executeAsync(stmt, function (results) {
     do_print("Data has been extracted");
-
-    for (let row = result.getNextRow(); row != null; row = result.getNextRow()) {
+    for (let row = results.getNextRow(); row != null; row = results.getNextRow()) {
       if (row.getResultByName("name") == "clockworker") {
         found = true;
-      break;
+        break;
       }
     }
   });
   do_check_true(found);
   stmt.finalize();
   yield asyncClose(adb);
 });
 
@@ -532,23 +537,22 @@ add_task(function* test_clone_no_optiona
   stmt.params.name = "yoric";
   let result = yield executeAsync(stmt);
   do_print("Request complete");
   stmt.finalize();
   do_check_true(Components.isSuccessCode(result));
   do_print("Extracting data from clone db");
   stmt = adb2.createAsyncStatement("SELECT * FROM test");
   let found = false;
-  yield executeAsync(stmt, function(result) {
+  yield executeAsync(stmt, function (results) {
     do_print("Data has been extracted");
-
-    for (let row = result.getNextRow(); row != null; row = result.getNextRow()) {
+    for (let row = results.getNextRow(); row != null; row = results.getNextRow()) {
       if (row.getResultByName("name") == "yoric") {
         found = true;
-      break;
+        break;
       }
     }
   });
   do_check_true(found);
   stmt.finalize();
   do_print("Closing databases");
   yield asyncClose(adb2);
   do_print("First db closed");
@@ -601,17 +605,17 @@ add_task(function* test_clone_shared_rea
   db2.close();
 });
 
 add_task(function* test_close_clone_fails() {
   let calls = [
     "openDatabase",
     "openUnsharedDatabase",
   ];
-  calls.forEach(function(methodName) {
+  calls.forEach(function (methodName) {
     let db = getService()[methodName](getTestDB());
     db.close();
     expectError(Cr.NS_ERROR_NOT_INITIALIZED, () => db.clone());
   });
 });
 
 add_task(function* test_memory_clone_fails() {
   let db = getService().openSpecialDatabase("memory");
@@ -624,19 +628,19 @@ add_task(function* test_clone_copies_fun
   let calls = [
     "openDatabase",
     "openUnsharedDatabase",
   ];
   let functionMethods = [
     "createFunction",
     "createAggregateFunction",
   ];
-  calls.forEach(function(methodName) {
-    [true, false].forEach(function(readOnly) {
-      functionMethods.forEach(function(functionMethod) {
+  calls.forEach(function (methodName) {
+    [true, false].forEach(function (readOnly) {
+      functionMethods.forEach(function (functionMethod) {
         let db1 = getService()[methodName](getTestDB());
         // Create a function for db1.
         db1[functionMethod](FUNC_NAME, 1, {
           onFunctionCall: () => 0,
           onStep: () => 0,
           onFinal: () => 0,
         });
 
@@ -653,36 +657,36 @@ add_task(function* test_clone_copies_fun
 });
 
 add_task(function* test_clone_copies_overridden_functions() {
   const FUNC_NAME = "lower";
   function test_func() {
     this.called = false;
   }
   test_func.prototype = {
-    onFunctionCall: function() {
+    onFunctionCall() {
       this.called = true;
     },
-    onStep: function() {
+    onStep() {
       this.called = true;
     },
     onFinal: () => 0,
   };
 
   let calls = [
     "openDatabase",
     "openUnsharedDatabase",
   ];
   let functionMethods = [
     "createFunction",
     "createAggregateFunction",
   ];
-  calls.forEach(function(methodName) {
-    [true, false].forEach(function(readOnly) {
-      functionMethods.forEach(function(functionMethod) {
+  calls.forEach(function (methodName) {
+    [true, false].forEach(function (readOnly) {
+      functionMethods.forEach(function (functionMethod) {
         let db1 = getService()[methodName](getTestDB());
         // Create a function for db1.
         let func = new test_func();
         db1[functionMethod](FUNC_NAME, 1, func);
         do_check_false(func.called);
 
         // Clone it, and make sure the function gets called.
         let db2 = db1.clone(readOnly);
--- a/storage/test/unit/test_storage_function.js
+++ b/storage/test/unit/test_storage_function.js
@@ -6,28 +6,28 @@
 
 var testNums = [1, 2, 3, 4];
 
 function setup()
 {
   getOpenedDatabase().createTable("function_tests", "id INTEGER PRIMARY KEY");
 
   var stmt = createStatement("INSERT INTO function_tests (id) VALUES(?1)");
-  for(var i = 0; i < testNums.length; ++i) {
+  for (let i = 0; i < testNums.length; ++i) {
     stmt.bindByIndex(0, testNums[i]);
     stmt.execute();
   }
   stmt.reset();
   stmt.finalize();
 }
 
 var testSquareFunction = {
   calls: 0,
 
-  onFunctionCall: function(val) {
+  onFunctionCall(val) {
     ++this.calls;
     return val.getInt32(0) * val.getInt32(0);
   }
 };
 
 function test_function_registration()
 {
   var msc = getOpenedDatabase();
@@ -57,27 +57,29 @@ function test_function_aliases()
 {
   var msc = getOpenedDatabase();
   msc.createFunction("test_square2", 1, testSquareFunction);
 }
 
 function test_function_call()
 {
   var stmt = createStatement("SELECT test_square(id) FROM function_tests");
-  while(stmt.executeStep());
+  while (stmt.executeStep()) {
+    // Do nothing.
+  }
   do_check_eq(testNums.length, testSquareFunction.calls);
   testSquareFunction.calls = 0;
   stmt.finalize();
 }
 
 function test_function_result()
 {
   var stmt = createStatement("SELECT test_square(42) FROM function_tests");
   stmt.executeStep();
-  do_check_eq(42*42, stmt.getInt32(0));
+  do_check_eq(42 * 42, stmt.getInt32(0));
   testSquareFunction.calls = 0;
   stmt.finalize();
 }
 
 var tests = [test_function_registration, test_function_no_double_registration,
              test_function_removal, test_function_aliases, test_function_call,
              test_function_result];
 
--- a/storage/test/unit/test_storage_progresshandler.js
+++ b/storage/test/unit/test_storage_progresshandler.js
@@ -6,31 +6,31 @@
 
 function setup()
 {
   var msc = getOpenedDatabase();
   msc.createTable("handler_tests", "id INTEGER PRIMARY KEY, num INTEGER");
   msc.beginTransaction();
 
   var stmt = createStatement("INSERT INTO handler_tests (id, num) VALUES(?1, ?2)");
-  for(var i = 0; i < 100; ++i) {
+  for (let i = 0; i < 100; ++i) {
     stmt.bindByIndex(0, i);
-    stmt.bindByIndex(1, Math.floor(Math.random()*1000));
+    stmt.bindByIndex(1, Math.floor(Math.random() * 1000));
     stmt.execute();
   }
   stmt.reset();
   msc.commitTransaction();
   stmt.finalize();
 }
 
 var testProgressHandler = {
   calls: 0,
   abort: false,
 
-  onProgress: function(comm) {
+  onProgress(comm) {
     ++this.calls;
     return this.abort;
   }
 };
 
 function test_handler_registration()
 {
   var msc = getOpenedDatabase();
@@ -54,33 +54,37 @@ function test_handler_removal()
 
 function test_handler_call()
 {
   var msc = getOpenedDatabase();
   msc.setProgressHandler(50, testProgressHandler);
   // Some long-executing request
   var stmt = createStatement(
     "SELECT SUM(t1.num * t2.num) FROM handler_tests AS t1, handler_tests AS t2");
-  while(stmt.executeStep());
+  while (stmt.executeStep()) {
+    // Do nothing.
+  }
   do_check_true(testProgressHandler.calls > 0);
   stmt.finalize();
 }
 
 function test_handler_abort()
 {
   var msc = getOpenedDatabase();
   testProgressHandler.abort = true;
   msc.setProgressHandler(50, testProgressHandler);
   // Some long-executing request
   var stmt = createStatement(
     "SELECT SUM(t1.num * t2.num) FROM handler_tests AS t1, handler_tests AS t2");
 
   const SQLITE_INTERRUPT = 9;
   try {
-    while(stmt.executeStep());
+    while (stmt.executeStep()) {
+      // Do nothing.
+    }
     do_throw("We shouldn't get here!");
   } catch (e) {
     do_check_eq(Cr.NS_ERROR_ABORT, e.result);
     do_check_eq(SQLITE_INTERRUPT, msc.lastError);
   }
   try {
     stmt.finalize();
     do_throw("We shouldn't get here!");
--- a/storage/test/unit/test_storage_service.js
+++ b/storage/test/unit/test_storage_service.js
@@ -92,27 +92,27 @@ function test_backup_not_new_filename()
 
   backup.remove(false);
 }
 
 function test_backup_new_filename()
 {
   var backup = getService().backupDatabaseFile(getTestDB(), BACKUP_FILE_NAME);
   do_check_eq(BACKUP_FILE_NAME, backup.leafName);
-  
+
   backup.remove(false);
 }
 
 function test_backup_new_folder()
 {
   var parentDir = getTestDB().parent;
   parentDir.append("test_storage_temp");
   if (parentDir.exists())
     parentDir.remove(true);
-  parentDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
+  parentDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
   do_check_true(parentDir.exists());
 
   var backup = getService().backupDatabaseFile(getTestDB(), BACKUP_FILE_NAME,
                                                parentDir);
   do_check_eq(BACKUP_FILE_NAME, backup.leafName);
   do_check_true(parentDir.equals(backup.parent));
 
   parentDir.remove(true);
@@ -128,14 +128,15 @@ var tests = [
   test_fake_db_throws_with_openDatabase,
   test_backup_not_new_filename,
   test_backup_new_filename,
   test_backup_new_folder,
 ];
 
 function run_test()
 {
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
 
--- a/storage/test/unit/test_storage_service_unshared.js
+++ b/storage/test/unit/test_storage_service_unshared.js
@@ -24,12 +24,12 @@ function test_openUnsharedDatabase_file_
 
 var tests = [test_openUnsharedDatabase_file_DNE,
              test_openUnsharedDatabase_file_exists];
 
 function run_test()
 {
   for (var i = 0; i < tests.length; i++)
     tests[i]();
-    
+
   cleanup();
 }
 
--- a/storage/test/unit/test_storage_statement.js
+++ b/storage/test/unit/test_storage_statement.js
@@ -81,17 +81,17 @@ function test_getColumnIndex_different_c
   var stmt = createStatement("SELECT name, id FROM test");
   try {
     do_check_eq(0, stmt.getColumnIndex("NaMe"));
     do_throw("should not get here");
   } catch (e) {
     do_check_eq(Cr.NS_ERROR_INVALID_ARG, e.result);
   }
   try {
-  do_check_eq(1, stmt.getColumnIndex("Id"));
+    do_check_eq(1, stmt.getColumnIndex("Id"));
     do_throw("should not get here");
   } catch (e) {
     do_check_eq(Cr.NS_ERROR_INVALID_ARG, e.result);
   }
   stmt.reset();
   stmt.finalize();
 }
 
@@ -174,14 +174,15 @@ var tests = [test_parameterCount_none, t
              test_getColumnDecltype,
              test_failed_execute,
 ];
 
 function run_test()
 {
   setup();
 
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
 
--- a/storage/test/unit/test_storage_value_array.js
+++ b/storage/test/unit/test_storage_value_array.js
@@ -3,39 +3,39 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // This file tests the functions of mozIStorageValueArray
 
 function setup()
 {
   getOpenedDatabase().createTable("test", "id INTEGER PRIMARY KEY, name TEXT," +
                                           "number REAL, nuller NULL, blobber BLOB");
-  
+
   var stmt = createStatement("INSERT INTO test (name, number, blobber) " +
                              "VALUES (?1, ?2, ?3)");
   stmt.bindByIndex(0, "foo");
   stmt.bindByIndex(1, 2.34);
   stmt.bindBlobByIndex(2, [], 0);
   stmt.execute();
-  
+
   stmt.bindByIndex(0, "");
   stmt.bindByIndex(1, 1.23);
   stmt.bindBlobByIndex(2, [1, 2], 2);
   stmt.execute();
 
   stmt.reset();
   stmt.finalize();
 }
 
 function test_getIsNull_for_null()
 {
   var stmt = createStatement("SELECT nuller, blobber FROM test WHERE id = ?1");
   stmt.bindByIndex(0, 1);
   do_check_true(stmt.executeStep());
-  
+
   do_check_true(stmt.getIsNull(0)); // null field
   do_check_true(stmt.getIsNull(1)); // data is null if size is 0
   stmt.reset();
   stmt.finalize();
 }
 
 function test_getIsNull_for_non_null()
 {
@@ -197,14 +197,15 @@ var tests = [test_getIsNull_for_null, te
              test_value_type_float, test_value_type_text, test_value_type_blob,
              test_numEntries_one, test_numEntries_all, test_getInt,
              test_getDouble, test_getUTF8String, test_getString, test_getBlob];
 
 function run_test()
 {
   setup();
 
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
 
--- a/storage/test/unit/test_telemetry_vfs.js
+++ b/storage/test/unit/test_telemetry_vfs.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // Make sure that there are telemetry entries created by sqlite io
 
 function run_sql(d, sql) {
-  var stmt = d.createStatement(sql)
-  stmt.execute()
+  var stmt = d.createStatement(sql);
+  stmt.execute();
   stmt.finalize();
 }
 
 function new_file(name)
 {
   var file = dirSvc.get("ProfD", Ci.nsIFile);
   file.append(name);
   return file;
@@ -19,12 +19,12 @@ function new_file(name)
 function run_test()
 {
   const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
   let read_hgram = Telemetry.getHistogramById("MOZ_SQLITE_OTHER_READ_B");
   let old_sum = read_hgram.snapshot().sum;
   const file = new_file("telemetry.sqlite");
   var d = getDatabase(file);
   run_sql(d, "CREATE TABLE bloat(data varchar)");
-  run_sql(d, "DROP TABLE bloat")
-  do_check_true(read_hgram.snapshot().sum > old_sum)
+  run_sql(d, "DROP TABLE bloat");
+  do_check_true(read_hgram.snapshot().sum > old_sum);
 }
 
--- a/storage/test/unit/test_unicode.js
+++ b/storage/test/unit/test_unicode.js
@@ -90,14 +90,15 @@ function test_like_search_same()
 var tests = [test_upper_ascii, test_upper_non_ascii, test_lower_ascii,
              test_lower_non_ascii, test_like_search_different,
              test_like_search_same];
 
 function run_test()
 {
   setup();
 
-  for (var i = 0; i < tests.length; i++)
+  for (var i = 0; i < tests.length; i++) {
     tests[i]();
-    
+  }
+
   cleanup();
 }
 
--- a/storage/test/unit/test_vacuum.js
+++ b/storage/test/unit/test_vacuum.js
@@ -82,254 +82,254 @@ function run_test()
     stmt.finalize();
   }
 
   load_test_vacuum_component();
 
   run_next_test();
 }
 
+const TESTS = [
+
+  function test_common_vacuum()
+  {
+    print("\n*** Test that a VACUUM correctly happens and all notifications are fired.");
+    // Wait for VACUUM begin.
+    let beginVacuumReceived = false;
+    Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
+      Services.obs.removeObserver(onVacuum, aTopic);
+      beginVacuumReceived = true;
+    }, "test-begin-vacuum", false);
+
+    // Wait for heavy IO notifications.
+    let heavyIOTaskBeginReceived = false;
+    let heavyIOTaskEndReceived = false;
+    Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
+      if (heavyIOTaskBeginReceived && heavyIOTaskEndReceived) {
+        Services.obs.removeObserver(onVacuum, aTopic);
+      }
+
+      if (aData == "vacuum-begin") {
+        heavyIOTaskBeginReceived = true;
+      }
+      else if (aData == "vacuum-end") {
+        heavyIOTaskEndReceived = true;
+      }
+    }, "heavy-io-task", false);
+
+    // Wait for VACUUM end.
+    Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
+      Services.obs.removeObserver(onVacuum, aTopic);
+      print("Check we received onBeginVacuum");
+      do_check_true(beginVacuumReceived);
+      print("Check we received heavy-io-task notifications");
+      do_check_true(heavyIOTaskBeginReceived);
+      do_check_true(heavyIOTaskEndReceived);
+      print("Received onEndVacuum");
+      run_next_test();
+    }, "test-end-vacuum", false);
+
+    synthesize_idle_daily();
+  },
+
+  function test_skipped_if_recent_vacuum()
+  {
+    print("\n*** Test that a VACUUM is skipped if it was run recently.");
+    Services.prefs.setIntPref("storage.vacuum.last.testVacuum.sqlite",
+                              parseInt(Date.now() / 1000));
+
+    // Wait for VACUUM begin.
+    let vacuumObserver = {
+      gotNotification: false,
+      observe: function VO_observe(aSubject, aTopic, aData) {
+        this.gotNotification = true;
+      },
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+    };
+    Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
+
+    // Check after a couple seconds that no VACUUM has been run.
+    do_timeout(2000, function () {
+      print("Check VACUUM did not run.");
+      do_check_false(vacuumObserver.gotNotification);
+      Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
+      run_next_test();
+    });
+
+    synthesize_idle_daily();
+  },
+
+  function test_page_size_change()
+  {
+    print("\n*** Test that a VACUUM changes page_size");
+
+    // We did setup the database with a small page size, the previous vacuum
+    // should have updated it.
+    print("Check that page size was updated.");
+    let conn = getDatabase(new_db_file("testVacuum"));
+    let stmt = conn.createStatement("PRAGMA page_size");
+    try {
+      while (stmt.executeStep()) {
+        do_check_eq(stmt.row.page_size, conn.defaultPageSize);
+      }
+    }
+    finally {
+      stmt.finalize();
+    }
+
+    run_next_test();
+  },
+
+  function test_skipped_optout_vacuum()
+  {
+    print("\n*** Test that a VACUUM is skipped if the participant wants to opt-out.");
+    Services.obs.notifyObservers(null, "test-options", "opt-out");
+
+    // Wait for VACUUM begin.
+    let vacuumObserver = {
+      gotNotification: false,
+      observe: function VO_observe(aSubject, aTopic, aData) {
+        this.gotNotification = true;
+      },
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+    };
+    Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
+
+    // Check after a couple seconds that no VACUUM has been run.
+    do_timeout(2000, function () {
+      print("Check VACUUM did not run.");
+      do_check_false(vacuumObserver.gotNotification);
+      Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
+      run_next_test();
+    });
+
+    synthesize_idle_daily();
+  },
+
+  /* Changing page size on WAL is not supported till Bug 634374 is properly fixed.
+  function test_page_size_change_with_wal()
+  {
+    print("\n*** Test that a VACUUM changes page_size with WAL mode");
+    Services.obs.notifyObservers(null, "test-options", "wal");
+
+    // Set a small page size.
+    let conn = getDatabase(new_db_file("testVacuum2"));
+    conn.executeSimpleSQL("PRAGMA page_size = 1024");
+    let stmt = conn.createStatement("PRAGMA page_size");
+    try {
+      while (stmt.executeStep()) {
+        do_check_eq(stmt.row.page_size, 1024);
+      }
+    }
+    finally {
+      stmt.finalize();
+    }
+
+    // Use WAL journal mode.
+    conn.executeSimpleSQL("PRAGMA journal_mode = WAL");
+    stmt = conn.createStatement("PRAGMA journal_mode");
+    try {
+      while (stmt.executeStep()) {
+        do_check_eq(stmt.row.journal_mode, "wal");
+      }
+    }
+    finally {
+      stmt.finalize();
+    }
+
+    // Wait for VACUUM end.
+    let vacuumObserver = {
+      observe: function VO_observe(aSubject, aTopic, aData) {
+        Services.obs.removeObserver(this, aTopic);
+        print("Check page size has been updated.");
+        let stmt = conn.createStatement("PRAGMA page_size");
+        try {
+          while (stmt.executeStep()) {
+            do_check_eq(stmt.row.page_size, Ci.mozIStorageConnection.DEFAULT_PAGE_SIZE);
+          }
+        }
+        finally {
+          stmt.finalize();
+        }
+
+        print("Check journal mode has been restored.");
+        stmt = conn.createStatement("PRAGMA journal_mode");
+        try {
+          while (stmt.executeStep()) {
+            do_check_eq(stmt.row.journal_mode, "wal");
+          }
+        }
+        finally {
+          stmt.finalize();
+        }
+
+        run_next_test();
+      },
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+    }
+    Services.obs.addObserver(vacuumObserver, "test-end-vacuum", false);
+
+    synthesize_idle_daily();
+  },
+  */
+
+  function test_memory_database_crash()
+  {
+    print("\n*** Test that we don't crash trying to vacuum a memory database");
+    Services.obs.notifyObservers(null, "test-options", "memory");
+
+    // Wait for VACUUM begin.
+    let vacuumObserver = {
+      gotNotification: false,
+      observe: function VO_observe(aSubject, aTopic, aData) {
+        this.gotNotification = true;
+      },
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+    };
+    Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
+
+    // Check after a couple seconds that no VACUUM has been run.
+    do_timeout(2000, function () {
+      print("Check VACUUM did not run.");
+      do_check_false(vacuumObserver.gotNotification);
+      Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
+      run_next_test();
+    });
+
+    synthesize_idle_daily();
+  },
+
+  /* Changing page size on WAL is not supported till Bug 634374 is properly fixed.
+  function test_wal_restore_fail()
+  {
+    print("\n*** Test that a failing WAL restoration notifies failure");
+    Services.obs.notifyObservers(null, "test-options", "wal-fail");
+
+    // Wait for VACUUM end.
+    let vacuumObserver = {
+      observe: function VO_observe(aSubject, aTopic, aData) {
+        Services.obs.removeObserver(vacuumObserver, "test-end-vacuum");
+        print("Check WAL restoration failed.");
+        do_check_false(aData);
+        run_next_test();
+      },
+      QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+    }
+    Services.obs.addObserver(vacuumObserver, "test-end-vacuum", false);
+
+    synthesize_idle_daily();
+  },
+  */
+];
+
 function run_next_test()
 {
   if (TESTS.length == 0) {
     Services.obs.notifyObservers(null, "test-options", "dispose");
     do_test_finished();
   }
   else {
     // Set last VACUUM to a date in the past.
     Services.prefs.setIntPref("storage.vacuum.last.testVacuum.sqlite",
                               parseInt(Date.now() / 1000 - 31 * 86400));
     do_execute_soon(TESTS.shift());
   }
 }
-
-const TESTS = [
-
-function test_common_vacuum()
-{
-  print("\n*** Test that a VACUUM correctly happens and all notifications are fired.");
-  // Wait for VACUUM begin.
-  let beginVacuumReceived = false;
-  Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
-    Services.obs.removeObserver(onVacuum, aTopic);
-    beginVacuumReceived = true;
-  }, "test-begin-vacuum", false);
-
-  // Wait for heavy IO notifications.
-  let heavyIOTaskBeginReceived = false;
-  let heavyIOTaskEndReceived = false;
-  Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
-    if (heavyIOTaskBeginReceived && heavyIOTaskEndReceived) {
-      Services.obs.removeObserver(onVacuum, aTopic);
-    }
-
-    if (aData == "vacuum-begin") {
-      heavyIOTaskBeginReceived = true;
-    }
-    else if (aData == "vacuum-end") {
-      heavyIOTaskEndReceived = true;
-    }
-  }, "heavy-io-task", false);
-
-  // Wait for VACUUM end.
-  Services.obs.addObserver(function onVacuum(aSubject, aTopic, aData) {
-    Services.obs.removeObserver(onVacuum, aTopic);
-    print("Check we received onBeginVacuum");
-    do_check_true(beginVacuumReceived);
-    print("Check we received heavy-io-task notifications");
-    do_check_true(heavyIOTaskBeginReceived);
-    do_check_true(heavyIOTaskEndReceived);
-    print("Received onEndVacuum");
-    run_next_test();
-  }, "test-end-vacuum", false);
-
-  synthesize_idle_daily();
-},
-
-function test_skipped_if_recent_vacuum()
-{
-  print("\n*** Test that a VACUUM is skipped if it was run recently.");
-  Services.prefs.setIntPref("storage.vacuum.last.testVacuum.sqlite",
-                            parseInt(Date.now() / 1000));
-
-  // Wait for VACUUM begin.
-  let vacuumObserver = {
-    gotNotification: false,
-    observe: function VO_observe(aSubject, aTopic, aData) {
-      this.gotNotification = true;
-    },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-  }
-  Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
-
-  // Check after a couple seconds that no VACUUM has been run.
-  do_timeout(2000, function () {
-    print("Check VACUUM did not run.");
-    do_check_false(vacuumObserver.gotNotification);
-    Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
-    run_next_test();
-  });
-
-  synthesize_idle_daily();
-},
-
-function test_page_size_change()
-{
-  print("\n*** Test that a VACUUM changes page_size");
-
-  // We did setup the database with a small page size, the previous vacuum
-  // should have updated it.
-  print("Check that page size was updated.");
-  let conn = getDatabase(new_db_file("testVacuum"));
-  let stmt = conn.createStatement("PRAGMA page_size");
-  try {
-    while (stmt.executeStep()) {
-      do_check_eq(stmt.row.page_size,  conn.defaultPageSize);
-    }
-  }
-  finally {
-    stmt.finalize();
-  }
-
-  run_next_test();
-},
-
-function test_skipped_optout_vacuum()
-{
-  print("\n*** Test that a VACUUM is skipped if the participant wants to opt-out.");
-  Services.obs.notifyObservers(null, "test-options", "opt-out");
-
-  // Wait for VACUUM begin.
-  let vacuumObserver = {
-    gotNotification: false,
-    observe: function VO_observe(aSubject, aTopic, aData) {
-      this.gotNotification = true;
-    },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-  }
-  Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
-
-  // Check after a couple seconds that no VACUUM has been run.
-  do_timeout(2000, function () {
-    print("Check VACUUM did not run.");
-    do_check_false(vacuumObserver.gotNotification);
-    Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
-    run_next_test();
-  });
-
-  synthesize_idle_daily();
-},
-
-/* Changing page size on WAL is not supported till Bug 634374 is properly fixed.
-function test_page_size_change_with_wal()
-{
-  print("\n*** Test that a VACUUM changes page_size with WAL mode");
-  Services.obs.notifyObservers(null, "test-options", "wal");
-
-  // Set a small page size.
-  let conn = getDatabase(new_db_file("testVacuum2"));
-  conn.executeSimpleSQL("PRAGMA page_size = 1024");
-  let stmt = conn.createStatement("PRAGMA page_size");
-  try {
-    while (stmt.executeStep()) {
-      do_check_eq(stmt.row.page_size, 1024);
-    }
-  }
-  finally {
-    stmt.finalize();
-  }
-
-  // Use WAL journal mode.
-  conn.executeSimpleSQL("PRAGMA journal_mode = WAL");
-  stmt = conn.createStatement("PRAGMA journal_mode");
-  try {
-    while (stmt.executeStep()) {
-      do_check_eq(stmt.row.journal_mode, "wal");
-    }
-  }
-  finally {
-    stmt.finalize();
-  }
-
-  // Wait for VACUUM end.
-  let vacuumObserver = {
-    observe: function VO_observe(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(this, aTopic);
-      print("Check page size has been updated.");
-      let stmt = conn.createStatement("PRAGMA page_size");
-      try {
-        while (stmt.executeStep()) {
-          do_check_eq(stmt.row.page_size, Ci.mozIStorageConnection.DEFAULT_PAGE_SIZE);
-        }
-      }
-      finally {
-        stmt.finalize();
-      }
-
-      print("Check journal mode has been restored.");
-      stmt = conn.createStatement("PRAGMA journal_mode");
-      try {
-        while (stmt.executeStep()) {
-          do_check_eq(stmt.row.journal_mode, "wal");
-        }
-      }
-      finally {
-        stmt.finalize();
-      }
-
-      run_next_test();
-    },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-  }
-  Services.obs.addObserver(vacuumObserver, "test-end-vacuum", false);
-
-  synthesize_idle_daily();
-},
-*/
-
-function test_memory_database_crash()
-{
-  print("\n*** Test that we don't crash trying to vacuum a memory database");
-  Services.obs.notifyObservers(null, "test-options", "memory");
-
-  // Wait for VACUUM begin.
-  let vacuumObserver = {
-    gotNotification: false,
-    observe: function VO_observe(aSubject, aTopic, aData) {
-      this.gotNotification = true;
-    },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-  }
-  Services.obs.addObserver(vacuumObserver, "test-begin-vacuum", false);
-
-  // Check after a couple seconds that no VACUUM has been run.
-  do_timeout(2000, function () {
-    print("Check VACUUM did not run.");
-    do_check_false(vacuumObserver.gotNotification);
-    Services.obs.removeObserver(vacuumObserver, "test-begin-vacuum");
-    run_next_test();
-  });
-
-  synthesize_idle_daily();
-},
-
-/* Changing page size on WAL is not supported till Bug 634374 is properly fixed.
-function test_wal_restore_fail()
-{
-  print("\n*** Test that a failing WAL restoration notifies failure");
-  Services.obs.notifyObservers(null, "test-options", "wal-fail");
-
-  // Wait for VACUUM end.
-  let vacuumObserver = {
-    observe: function VO_observe(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(vacuumObserver, "test-end-vacuum");
-      print("Check WAL restoration failed.");
-      do_check_false(aData);
-      run_next_test();
-    },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-  }
-  Services.obs.addObserver(vacuumObserver, "test-end-vacuum", false);
-
-  synthesize_idle_daily();
-},
-*/
-];
--- a/storage/test/unit/vacuumParticipant.js
+++ b/storage/test/unit/vacuumParticipant.js
@@ -71,51 +71,55 @@ vacuumParticipant.prototype =
   observe: function TVP_observe(aSubject, aTopic, aData)
   {
     if (aData == "opt-out") {
       this._grant = false;
     }
     else if (aData == "wal") {
       try {
         this._dbConn.close();
+      } catch (e) {
+        // Do nothing.
       }
-      catch(e) {}
       this._dbConn = getDatabase(new_db_file("testVacuum2"));
     }
     else if (aData == "wal-fail") {
       try {
         this._dbConn.close();
+      } catch (e) {
+        // Do nothing.
       }
-      catch(e) {}
       this._dbConn = getDatabase(new_db_file("testVacuum3"));
       // Use WAL journal mode.
       this._dbConn.executeSimpleSQL("PRAGMA journal_mode = WAL");
       // Create a not finalized statement.
       this._stmt = this._dbConn.createStatement("SELECT :test");
       this._stmt.params.test = 1;
       this._stmt.executeStep();
     }
     else if (aData == "memory") {
       try {
         this._dbConn.asyncClose();
+      } catch (e) {
+        // Do nothing.
       }
-      catch(e) {}
       this._dbConn = Cc["@mozilla.org/storage/service;1"].
                      getService(Ci.mozIStorageService).
                      openSpecialDatabase("memory");
     }
     else if (aData == "dispose") {
       Services.obs.removeObserver(this, "test-options");
       try {
         this._dbConn.asyncClose();
+      } catch (e) {
+        // Do nothing.
       }
-      catch(e) {}
     }
   },
 
   QueryInterface: XPCOMUtils.generateQI([
-    Ci.mozIStorageVacuumParticipant
-  , Ci.nsIObserver
+    Ci.mozIStorageVacuumParticipant,
+    Ci.nsIObserver,
   ])
 };
 
 var gComponentsArray = [vacuumParticipant];
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory(gComponentsArray);