Bug 1251916 - Use standard JavaScript features in toolkit/components/passwordmgr to pass eslint checks: replace legacy generators with ES6 generators. r=MattN
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 28 Feb 2016 14:11:17 -0800
changeset 322126 eca3aa5d534c693e362d6d5f8940f2b8030ca620
parent 322125 1249401fb8b0431d56ef9c96d017b13e777f3089
child 322127 c9d21264b345528d66b677427c578bb19759b418
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1251916
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1251916 - Use standard JavaScript features in toolkit/components/passwordmgr to pass eslint checks: replace legacy generators with ES6 generators. r=MattN MozReview-Commit-ID: KxMSovx0mfl
toolkit/components/passwordmgr/LoginStore.jsm
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/storage-json.js
toolkit/components/passwordmgr/test/LoginTestUtils.jsm
toolkit/components/passwordmgr/test/unit/head.js
toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
toolkit/components/passwordmgr/test/unit/test_storage.js
toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
--- a/toolkit/components/passwordmgr/LoginStore.jsm
+++ b/toolkit/components/passwordmgr/LoginStore.jsm
@@ -155,17 +155,17 @@ LoginStore.prototype = {
    * Loads persistent data from the file to memory.
    *
    * @return {Promise}
    * @resolves When the operation finished successfully.
    * @rejects JavaScript exception.
    */
   load: function ()
   {
-    return Task.spawn(function () {
+    return Task.spawn(function* () {
       try {
         let bytes = yield OS.File.read(this.path);
 
         // If synchronous loading happened in the meantime, exit now.
         if (this.dataReady) {
           return;
         }
 
@@ -297,16 +297,16 @@ LoginStore.prototype = {
    * If an error occurs, the previous file is not deleted.
    *
    * @return {Promise}
    * @resolves When the operation finished successfully.
    * @rejects JavaScript exception.
    */
   save: function ()
   {
-    return Task.spawn(function () {
+    return Task.spawn(function* () {
       // Create or overwrite the file.
       let bytes = gTextEncoder.encode(JSON.stringify(this.data));
       yield OS.File.writeAtomic(this.path, bytes,
                                 { tmpPath: this.path + ".tmp" });
     }.bind(this));
   },
 };
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -159,17 +159,17 @@ LoginManager.prototype = {
           log("Oops! Pref not handled, change ignored.");
         }
       } else if (topic == "xpcom-shutdown") {
         delete this._pwmgr.__formFillService;
         delete this._pwmgr._storage;
         delete this._pwmgr._prefBranch;
         this._pwmgr = null;
       } else if (topic == "passwordmgr-storage-replace") {
-        Task.spawn(function () {
+        Task.spawn(function* () {
           yield this._pwmgr._storage.terminate();
           this._pwmgr._initStorage();
           yield this._pwmgr.initializationPromise;
           Services.obs.notifyObservers(null,
                        "passwordmgr-storage-replace-complete", null);
         }.bind(this));
       } else if (topic == "gather-telemetry") {
         // When testing, the "data" parameter is a string containing the
--- a/toolkit/components/passwordmgr/storage-json.js
+++ b/toolkit/components/passwordmgr/storage-json.js
@@ -47,17 +47,17 @@ this.LoginManagerStorage_json.prototype 
       // See bug 717490 comment 17.
       this._crypto;
 
       // Set the reference to LoginStore synchronously.
       let jsonPath = OS.Path.join(OS.Constants.Path.profileDir,
                                   "logins.json");
       this._store = new LoginStore(jsonPath);
 
-      return Task.spawn(function () {
+      return Task.spawn(function* () {
         // Load the data asynchronously.
         this.log("Opening database at", this._store.path);
         yield this._store.load();
 
         // The import from previous versions operates the first time
         // that this built-in storage back-end is used.  This may be
         // later than expected, in case add-ons have registered an
         // alternate storage that disabled the default one.
--- a/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
+++ b/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
@@ -31,17 +31,17 @@ this.LoginTestUtils = {
   set Assert(assert) {
     Assert = assert;
   },
 
   /**
    * Forces the storage module to save all data, and the Login Manager service
    * to replace the storage module with a newly initialized instance.
    */
-  reloadData() {
+  * reloadData() {
     Services.obs.notifyObservers(null, "passwordmgr-storage-replace", null);
     yield TestUtils.topicObserved("passwordmgr-storage-replace-complete");
   },
 
   /**
    * Erases all the data stored by the Login Manager service.
    */
   clearData() {
--- a/toolkit/components/passwordmgr/test/unit/head.js
+++ b/toolkit/components/passwordmgr/test/unit/head.js
@@ -160,17 +160,17 @@ const MockDocument = {
       value: document,
     });
   },
 
 };
 
 //// Initialization functions common to all tests
 
-add_task(function test_common_initialize()
+add_task(function* test_common_initialize()
 {
   // Before initializing the service for the first time, we should copy the key
   // file required to decrypt the logins contained in the SQLite databases used
   // by migration tests.  This file is not required for the other tests.
   yield OS.File.copy(do_get_file("data/key3.db").path,
                      OS.Path.join(OS.Constants.Path.profileDir, "key3.db"));
 
   // Ensure that the service and the storage module are initialized.
--- a/toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
+++ b/toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
@@ -140,18 +140,18 @@ add_task(function test_rememberSignons()
   Services.logins.setLoginSavingEnabled(hostname2, true);
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(),
                                           []);
 });
 
 /**
  * Tests storing disabled hosts containing non-ASCII characters.
  */
-add_task(function test_storage_setLoginSavingEnabled_nonascii()
+add_task(function* test_storage_setLoginSavingEnabled_nonascii()
 {
   let hostname = "http://" + String.fromCharCode(355) + ".example.com";
   Services.logins.setLoginSavingEnabled(hostname, false);
 
-  yield LoginTestUtils.reloadData();
+  yield* LoginTestUtils.reloadData();
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(),
                                           [hostname]);
   LoginTestUtils.clearData();
 });
--- a/toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
@@ -270,17 +270,17 @@ add_task(function test_searchLogins_meta
   foundLogin = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
   assertMetaInfoEqual(foundLogin, gLoginMetaInfo3);
 });
 
 /**
  * Tests that the default nsILoginManagerStorage module attached to the Login
  * Manager service is able to save and reload nsILoginMetaInfo properties.
  */
-add_task(function test_storage_metainfo()
+add_task(function* test_storage_metainfo()
 {
-  yield LoginTestUtils.reloadData();
+  yield* LoginTestUtils.reloadData();
   LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
 
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo1), gLoginMetaInfo1);
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo2), gLoginMetaInfo2);
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo3), gLoginMetaInfo3);
 });
--- a/toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
+++ b/toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
@@ -31,17 +31,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "nsIUUIDGenerator");
 
 /**
  * Creates empty login data tables in the given SQLite connection, resembling
  * the most recent schema version (excluding indices).
  */
 function promiseCreateDatabaseSchema(aConnection)
 {
-  return Task.spawn(function () {
+  return Task.spawn(function* () {
     yield aConnection.setSchemaVersion(5);
     yield aConnection.execute("CREATE TABLE moz_logins (" +
                               "id                  INTEGER PRIMARY KEY," +
                               "hostname            TEXT NOT NULL,"       +
                               "httpRealm           TEXT,"                +
                               "formSubmitURL       TEXT,"                +
                               "usernameField       TEXT NOT NULL,"       +
                               "passwordField       TEXT NOT NULL,"       +
@@ -108,17 +108,17 @@ function promiseInsertDisabledHost(aConn
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Tests
 
 /**
  * Imports login data from a SQLite file constructed using the test data.
  */
-add_task(function test_import()
+add_task(function* test_import()
 {
   let store = new LoginStore(getTempFile("test-import.json").path);
   let loginsSqlite = getTempFile("test-logins.sqlite").path;
 
   // Prepare the logins to be imported, including the nsILoginMetaInfo data.
   let loginList = TestData.loginList();
   for (let loginInfo of loginList) {
     loginInfo.QueryInterface(Ci.nsILoginMetaInfo);
@@ -172,17 +172,17 @@ add_task(function test_import()
   do_check_eq(store.data.disabledHosts.length, 2);
   do_check_true(store.data.disabledHosts.indexOf("http://www.example.com") != -1);
   do_check_true(store.data.disabledHosts.indexOf("https://www.example.org") != -1);
 });
 
 /**
  * Tests imports of NULL values due to a downgraded database.
  */
-add_task(function test_import_downgraded()
+add_task(function* test_import_downgraded()
 {
   let store = new LoginStore(getTempFile("test-import-downgraded.json").path);
   let loginsSqlite = getTempFile("test-logins-downgraded.sqlite").path;
   let loginList = TestData.loginList();
 
   // Create and populate the SQLite database first.
   let connection = yield Sqlite.openConnection({ path: loginsSqlite });
   try {
@@ -210,33 +210,33 @@ add_task(function test_import_downgraded
   do_check_eq(loginItem.timeLastUsed, creationTime);
   do_check_eq(loginItem.timePasswordChanged, creationTime);
   do_check_eq(loginItem.timesUsed, 1);
 });
 
 /**
  * Verifies that importing from a SQLite file with database version 2 fails.
  */
-add_task(function test_import_v2()
+add_task(function* test_import_v2()
 {
   let store = new LoginStore(getTempFile("test-import-v2.json").path);
   let loginsSqlite = do_get_file("data/signons-v2.sqlite").path;
 
   // The "load" method must be called before importing data.
   yield store.load();
   try {
     yield new LoginImport(store, loginsSqlite).import();
     do_throw("The operation should have failed.");
   } catch (ex) { }
 });
 
 /**
  * Imports login data from a SQLite file, with database version 3.
  */
-add_task(function test_import_v3()
+add_task(function* test_import_v3()
 {
   let store = new LoginStore(getTempFile("test-import-v3.json").path);
   let loginsSqlite = do_get_file("data/signons-v3.sqlite").path;
 
   // The "load" method must be called before importing data.
   yield store.load();
   yield new LoginImport(store, loginsSqlite).import();
 
--- a/toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
+++ b/toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
@@ -18,17 +18,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 const TEST_STORE_FILE_NAME = "test-logins.json";
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Tests
 
 /**
  * Saves login data to a file, then reloads it.
  */
-add_task(function test_save_reload()
+add_task(function* test_save_reload()
 {
   let storeForSave = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   // The "load" method must be called before preparing the data to be saved.
   yield storeForSave.load();
 
   let rawLoginData = {
     id:                  storeForSave.data.nextId++,
@@ -69,34 +69,34 @@ add_task(function test_save_reload()
   do_check_matches(storeForLoad.data.logins[0], rawLoginData);
   do_check_eq(storeForLoad.data.disabledHosts.length, 1);
   do_check_eq(storeForLoad.data.disabledHosts[0], "http://www.example.org");
 });
 
 /**
  * Checks that loading from a missing file results in empty arrays.
  */
-add_task(function test_load_empty()
+add_task(function* test_load_empty()
 {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   do_check_false(yield OS.File.exists(store.path));
 
   yield store.load();
 
   do_check_false(yield OS.File.exists(store.path));
 
   do_check_eq(store.data.logins.length, 0);
   do_check_eq(store.data.disabledHosts.length, 0);
 });
 
 /**
  * Checks that saving empty data still overwrites any existing file.
  */
-add_task(function test_save_empty()
+add_task(function* test_save_empty()
 {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   yield store.load();
 
   let createdFile = yield OS.File.open(store.path, { create: true });
   yield createdFile.close();
 
@@ -104,17 +104,17 @@ add_task(function test_save_empty()
 
   do_check_true(yield OS.File.exists(store.path));
 });
 
 /**
  * Loads data from a string in a predefined format.  The purpose of this test is
  * to verify that the JSON format used in previous versions can be loaded.
  */
-add_task(function test_load_string_predefined()
+add_task(function* test_load_string_predefined()
 {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{" +
                 "\"id\":1," +
                 "\"hostname\":\"http://www.example.com\"," +
                 "\"httpRealm\":null," +
                 "\"formSubmitURL\":\"http://www.example.com/submit-url\"," +
@@ -156,17 +156,17 @@ add_task(function test_load_string_prede
 
   do_check_eq(store.data.disabledHosts.length, 1);
   do_check_eq(store.data.disabledHosts[0], "http://www.example.org");
 });
 
 /**
  * Loads login data from a malformed JSON string.
  */
-add_task(function test_load_string_malformed()
+add_task(function* test_load_string_malformed()
 {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{\"hostname\":\"http://www.example.com\"," +
                 "\"id\":1,";
 
   yield OS.File.writeAtomic(store.path, new TextEncoder().encode(string),
                             { tmpPath: store.path + ".tmp" });
@@ -181,17 +181,17 @@ add_task(function test_load_string_malfo
   do_check_eq(store.data.logins.length, 0);
   do_check_eq(store.data.disabledHosts.length, 0);
 });
 
 /**
  * Loads login data from a malformed JSON string, using the synchronous
  * initialization path.
  */
-add_task(function test_load_string_malformed_sync()
+add_task(function* test_load_string_malformed_sync()
 {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{\"hostname\":\"http://www.example.com\"," +
                 "\"id\":1,";
 
   yield OS.File.writeAtomic(store.path, new TextEncoder().encode(string),
                             { tmpPath: store.path + ".tmp" });
--- a/toolkit/components/passwordmgr/test/unit/test_storage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage.js
@@ -9,96 +9,96 @@
  * even when they include special characters.
  */
 
 "use strict";
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Globals
 
-function reloadAndCheckLogins(aExpectedLogins)
+function* reloadAndCheckLoginsGen(aExpectedLogins)
 {
   yield LoginTestUtils.reloadData();
   LoginTestUtils.checkLogins(aExpectedLogins);
   LoginTestUtils.clearData();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Tests
 
 /**
  * Tests addLogin with valid non-ASCII characters.
  */
-add_task(function test_storage_addLogin_nonascii()
+add_task(function* test_storage_addLogin_nonascii()
 {
   let hostname = "http://" + String.fromCharCode(355) + ".example.com";
 
   // Store the strings "user" and "pass" using similarly looking glyphs.
   let loginInfo = TestData.formLogin({
     hostname: hostname,
     formSubmitURL: hostname,
     username: String.fromCharCode(533, 537, 7570, 345),
     password: String.fromCharCode(421, 259, 349, 537),
     usernameField: "field_" + String.fromCharCode(533, 537, 7570, 345),
     passwordField: "field_" + String.fromCharCode(421, 259, 349, 537),
   });
   Services.logins.addLogin(loginInfo);
-  yield reloadAndCheckLogins([loginInfo]);
+  yield* reloadAndCheckLoginsGen([loginInfo]);
 
   // Store the string "test" using similarly looking glyphs.
   loginInfo = TestData.authLogin({
     httpRealm: String.fromCharCode(355, 277, 349, 357),
   });
   Services.logins.addLogin(loginInfo);
-  yield reloadAndCheckLogins([loginInfo]);
+  yield* reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with newline characters in the username and password.
  */
-add_task(function test_storage_addLogin_newlines()
+add_task(function* test_storage_addLogin_newlines()
 {
   let loginInfo = TestData.formLogin({
     username: "user\r\nname",
     password: "password\r\n",
   });
   Services.logins.addLogin(loginInfo);
-  yield reloadAndCheckLogins([loginInfo]);
+  yield* reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with a single dot in fields where it is allowed.
  *
  * These tests exist to verify the legacy "signons.txt" storage format.
  */
-add_task(function test_storage_addLogin_dot()
+add_task(function* test_storage_addLogin_dot()
 {
   let loginInfo = TestData.formLogin({ hostname: ".", passwordField: "." });
   Services.logins.addLogin(loginInfo);
-  yield reloadAndCheckLogins([loginInfo]);
+  yield* reloadAndCheckLoginsGen([loginInfo]);
 
   loginInfo = TestData.authLogin({ httpRealm: "." });
   Services.logins.addLogin(loginInfo);
-  yield reloadAndCheckLogins([loginInfo]);
+  yield* reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with parentheses in hostnames.
  *
  * These tests exist to verify the legacy "signons.txt" storage format.
  */
-add_task(function test_storage_addLogin_parentheses()
+add_task(function* test_storage_addLogin_parentheses()
 {
   let loginList = [
     TestData.authLogin({ httpRealm: "(realm" }),
     TestData.authLogin({ httpRealm: "realm)" }),
     TestData.authLogin({ httpRealm: "(realm)" }),
     TestData.authLogin({ httpRealm: ")realm(" }),
     TestData.authLogin({ hostname: "http://parens(.example.com" }),
     TestData.authLogin({ hostname: "http://parens).example.com" }),
     TestData.authLogin({ hostname: "http://parens(example).example.com" }),
     TestData.authLogin({ hostname: "http://parens)example(.example.com" }),
   ];
   for (let loginInfo of loginList) {
     Services.logins.addLogin(loginInfo);
   }
-  yield reloadAndCheckLogins(loginList);
+  yield* reloadAndCheckLoginsGen(loginList);
 });
--- a/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
@@ -6,71 +6,71 @@
 
 const ENCTYPE_BASE64 = 0;
 const ENCTYPE_SDR = 1;
 
 // Current schema version used by storage-mozStorage.js. This will need to be
 // kept in sync with the version there (or else the tests fail).
 const CURRENT_SCHEMA = 5;
 
-function copyFile(aLeafName)
+function* copyFile(aLeafName)
 {
   yield OS.File.copy(OS.Path.join(do_get_file("data").path, aLeafName),
                      OS.Path.join(OS.Constants.Path.profileDir, aLeafName));
-};
+}
 
 function openDB(aLeafName)
 {
   var dbFile = new FileUtils.File(OS.Constants.Path.profileDir);
   dbFile.append(aLeafName);
 
   return Services.storage.openDatabase(dbFile);
-};
+}
 
 function deleteFile(pathname, filename)
 {
   var file = new FileUtils.File(pathname);
   file.append(filename);
 
   // Suppress failures, this happens in the mozstorage tests on Windows
   // because the module may still be holding onto the DB. (We don't
   // have a way to explicitly shutdown/GC the module).
   try {
     if (file.exists())
       file.remove(false);
   } catch (e) {}
-};
+}
 
 function reloadStorage(aInputPathName, aInputFileName)
 {
   var inputFile = null;
   if (aInputFileName) {
-      var inputFile  = Cc["@mozilla.org/file/local;1"].
+      inputFile  = Cc["@mozilla.org/file/local;1"].
                        createInstance(Ci.nsILocalFile);
       inputFile.initWithPath(aInputPathName);
       inputFile.append(aInputFileName);
   }
 
   let storage = Cc["@mozilla.org/login-manager/storage/mozStorage;1"]
                   .createInstance(Ci.nsILoginManagerStorage);
   storage.QueryInterface(Ci.nsIInterfaceRequestor)
          .getInterface(Ci.nsIVariant)
          .initWithFile(inputFile);
 
   return storage;
-};
+}
 
 function checkStorageData(storage, ref_disabledHosts, ref_logins)
 {
   LoginTestUtils.assertLoginListsEqual(storage.getAllLogins(), ref_logins);
   LoginTestUtils.assertDisabledHostsEqual(storage.getAllDisabledHosts(),
                                           ref_disabledHosts);
-};
+}
 
-add_task(function test_execute()
+add_task(function* test_execute()
 {
 
 const OUTDIR = OS.Constants.Path.profileDir;
 
 try {
 
 var isGUID = /^\{[0-9a-f\d]{8}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{12}\}$/;
 function getGUIDforID(conn, id) {
@@ -117,17 +117,17 @@ var testuser5 = new nsLoginInfo;
 testuser5.init("http://test.gov", "http://test.gov", null,
                "testuser2", "testpass1", "u5", "p5");
 
 
 /* ========== 1 ========== */
 testnum++;
 testdesc = "Test downgrade from v999 storage"
 
-yield copyFile("signons-v999.sqlite");
+yield* copyFile("signons-v999.sqlite");
 // Verify the schema version in the test file.
 dbConnection = openDB("signons-v999.sqlite");
 do_check_eq(999, dbConnection.schemaVersion);
 dbConnection.close();
 
 storage = reloadStorage(OUTDIR, "signons-v999.sqlite");
 checkStorageData(storage, ["https://disabled.net"], [testuser1]);
 
@@ -142,33 +142,33 @@ deleteFile(OUTDIR, "signons-v999.sqlite"
 testnum++;
 testdesc = "Test downgrade from incompat v999 storage"
 // This file has a testuser999/testpass999, but is missing an expected column
 
 var origFile = OS.Path.join(OUTDIR, "signons-v999-2.sqlite");
 var failFile = OS.Path.join(OUTDIR, "signons-v999-2.sqlite.corrupt");
 
 // Make sure we always start clean in a clean state.
-yield copyFile("signons-v999-2.sqlite");
+yield* copyFile("signons-v999-2.sqlite");
 yield OS.File.remove(failFile);
 
 Assert.throws(() => reloadStorage(OUTDIR, "signons-v999-2.sqlite"),
               /Initialization failed/);
 
 // Check to ensure the DB file was renamed to .corrupt.
 do_check_false(yield OS.File.exists(origFile));
 do_check_true(yield OS.File.exists(failFile));
 
 yield OS.File.remove(failFile);
 
 /* ========== 3 ========== */
 testnum++;
 testdesc = "Test upgrade from v1->v2 storage"
 
-yield copyFile("signons-v1.sqlite");
+yield* copyFile("signons-v1.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v1.sqlite");
 do_check_eq(1, dbConnection.schemaVersion);
 dbConnection.close();
 
 storage = reloadStorage(OUTDIR, "signons-v1.sqlite");
 checkStorageData(storage, ["https://disabled.net"], [testuser1, testuser2]);
 
@@ -185,17 +185,17 @@ deleteFile(OUTDIR, "signons-v1.sqlite");
 
 /* ========== 4 ========== */
 testnum++;
 testdesc = "Test upgrade v2->v1 storage";
 // This is the case where a v2 DB has been accessed with v1 code, and now we
 // are upgrading it again. Any logins added by the v1 code must be properly
 // upgraded.
 
-yield copyFile("signons-v1v2.sqlite");
+yield* copyFile("signons-v1v2.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v1v2.sqlite");
 do_check_eq(1, dbConnection.schemaVersion);
 dbConnection.close();
 
 storage = reloadStorage(OUTDIR, "signons-v1v2.sqlite");
 checkStorageData(storage, ["https://disabled.net"], [testuser1, testuser2, testuser3]);
 
@@ -217,17 +217,17 @@ do_check_true(isGUID.test(guid));
 dbConnection.close();
 
 deleteFile(OUTDIR, "signons-v1v2.sqlite");
 
 /* ========== 5 ========== */
 testnum++;
 testdesc = "Test upgrade from v2->v3 storage"
 
-yield copyFile("signons-v2.sqlite");
+yield* copyFile("signons-v2.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v2.sqlite");
 do_check_eq(2, dbConnection.schemaVersion);
 
 storage = reloadStorage(OUTDIR, "signons-v2.sqlite");
 
 // Check to see that we added the correct encType to the logins.
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
@@ -245,17 +245,17 @@ deleteFile(OUTDIR, "signons-v2.sqlite");
 
 /* ========== 6 ========== */
 testnum++;
 testdesc = "Test upgrade v3->v2 storage";
 // This is the case where a v3 DB has been accessed with v2 code, and now we
 // are upgrading it again. Any logins added by the v2 code must be properly
 // upgraded.
 
-yield copyFile("signons-v2v3.sqlite");
+yield* copyFile("signons-v2v3.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v2v3.sqlite");
 do_check_eq(2, dbConnection.schemaVersion);
 encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64, null];
 for (let i = 0; i < encTypes.length; i++)
     do_check_eq(encTypes[i], getEncTypeForID(dbConnection, i + 1));
 
 // Reload storage, check that the new login now has encType=1, others untouched
@@ -277,17 +277,17 @@ dbConnection.close();
 
 deleteFile(OUTDIR, "signons-v2v3.sqlite");
 
 
 /* ========== 7 ========== */
 testnum++;
 testdesc = "Test upgrade from v3->v4 storage"
 
-yield copyFile("signons-v3.sqlite");
+yield* copyFile("signons-v3.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v3.sqlite");
 do_check_eq(3, dbConnection.schemaVersion);
 
 storage = reloadStorage(OUTDIR, "signons-v3.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 
 // Check that timestamps and counts were initialized correctly
@@ -301,28 +301,28 @@ for (var i = 0; i < 2; i++) {
     LoginTestUtils.assertTimeIsAboutNow(logins[i].timeLastUsed);
     LoginTestUtils.assertTimeIsAboutNow(logins[i].timePasswordChanged);
 }
 
 /* ========== 8 ========== */
 testnum++;
 testdesc = "Test upgrade from v3->v4->v3 storage"
 
-yield copyFile("signons-v3v4.sqlite");
+yield* copyFile("signons-v3v4.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v3v4.sqlite");
 do_check_eq(3, dbConnection.schemaVersion);
 
 storage = reloadStorage(OUTDIR, "signons-v3v4.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 
 // testuser1 already has timestamps, testuser2 does not.
 checkStorageData(storage, [], [testuser1, testuser2]);
 
-var logins = storage.getAllLogins();
+logins = storage.getAllLogins();
 
 var t1, t2;
 if (logins[0].username == "testuser1") {
     t1 = logins[0];
     t2 = logins[1];
 } else {
     t1 = logins[1];
     t2 = logins[0];
@@ -341,17 +341,17 @@ LoginTestUtils.assertTimeIsAboutNow(t2.t
 LoginTestUtils.assertTimeIsAboutNow(t2.timeLastUsed);
 LoginTestUtils.assertTimeIsAboutNow(t2.timePasswordChanged);
 
 
 /* ========== 9 ========== */
 testnum++;
 testdesc = "Test upgrade from v4 storage"
 
-yield copyFile("signons-v4.sqlite");
+yield* copyFile("signons-v4.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v4.sqlite");
 do_check_eq(4, dbConnection.schemaVersion);
 do_check_false(dbConnection.tableExists("moz_deleted_logins"));
 
 storage = reloadStorage(OUTDIR, "signons-v4.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 do_check_true(dbConnection.tableExists("moz_deleted_logins"));