Bug 1333044 - Fix no-shadow issues in services/. r?markh draft
authorMark Banner <standard8@mozilla.com>
Mon, 23 Jan 2017 14:07:55 +0000
changeset 467900 a9379944828b3eabea31ec9d8813d012af1f7e0c
parent 467899 4ef47582341ade7ee1c9081e7692d267e53ffabc
child 467901 0c60b48eabb4ee92693a6aeec89e93e0df78ccd4
push id43297
push userbmo:standard8@mozilla.com
push dateMon, 30 Jan 2017 09:37:19 +0000
reviewersmarkh
bugs1333044
milestone54.0a1
Bug 1333044 - Fix no-shadow issues in services/. r?markh MozReview-Commit-ID: KqYfpjdR7QS
services/common/tests/unit/test_hawkclient.js
services/common/tests/unit/test_restrequest.js
services/common/tests/unit/test_storage_server.js
services/fxaccounts/tests/xpcshell/test_accounts.js
services/fxaccounts/tests/xpcshell/test_profile_client.js
services/fxaccounts/tests/xpcshell/test_push_service.js
services/sync/tests/unit/head_helpers.js
services/sync/tests/unit/head_http_server.js
services/sync/tests/unit/test_addons_store.js
services/sync/tests/unit/test_bookmark_order.js
services/sync/tests/unit/test_bookmark_smart_bookmarks.js
services/sync/tests/unit/test_bookmark_tracker.js
services/sync/tests/unit/test_browserid_identity.js
services/sync/tests/unit/test_history_engine.js
services/sync/tests/unit/test_httpd_sync_server.js
services/sync/tests/unit/test_resource.js
services/sync/tests/unit/test_resource_async.js
services/sync/tests/unit/test_syncengine.js
services/sync/tests/unit/test_syncengine_sync.js
services/sync/tests/unit/test_telemetry.js
services/sync/tests/unit/test_utils_notify.js
--- a/services/common/tests/unit/test_hawkclient.js
+++ b/services/common/tests/unit/test_hawkclient.js
@@ -217,17 +217,16 @@ add_task(function* test_offset_in_hawk_h
     "/first": function(request, response) {
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(message, message.length);
     },
 
     "/second": function(request, response) {
       // We see a better date now in the ts component of the header
       let delta = getTimestampDelta(request.getHeader("Authorization"));
-      let message = "Delta: " + delta;
 
       // We're now within HAWK's one-minute window.
       // I hope this isn't a recipe for intermittent oranges ...
       if (delta < MINUTE_MS) {
         response.setStatusLine(request.httpVersion, 200, "OK");
       } else {
         response.setStatusLine(request.httpVersion, 400, "Delta: " + delta);
       }
@@ -495,9 +494,8 @@ function deferredStop(server) {
   server.stop(deferred.resolve);
   return deferred.promise;
 }
 
 function run_test() {
   initTestLogging("Trace");
   run_next_test();
 }
-
--- a/services/common/tests/unit/test_restrequest.js
+++ b/services/common/tests/unit/test_restrequest.js
@@ -202,18 +202,18 @@ add_test(function test_get_utf8() {
     do_check_eq(request1.response.status, 200);
     do_check_eq(request1.response.body, response);
     do_check_eq(request1.response.headers["content-type"],
                 contentType + charsetSuffix);
 
     // Check that we default to UTF-8 if Content-Type doesn't have a charset.
     charset = false;
     let request2 = new RESTRequest(server.baseURI + "/resource");
-    request2.get(function(error) {
-      do_check_null(error);
+    request2.get(function(error2) {
+      do_check_null(error2);
 
       do_check_eq(request2.response.status, 200);
       do_check_eq(request2.response.body, response);
       do_check_eq(request2.response.headers["content-type"], contentType);
       do_check_eq(request2.response.charset, "utf-8");
 
       server.stop(run_next_test);
     });
@@ -286,18 +286,18 @@ add_test(function test_charsets() {
     do_check_eq(request1.response.headers["content-type"],
                 contentType + charsetSuffix);
     do_check_eq(request1.response.charset, "us-ascii");
 
     // Check that hint is used if Content-Type doesn't have a charset.
     charset = false;
     let request2 = new RESTRequest(server.baseURI + "/resource");
     request2.charset = "us-ascii";
-    request2.get(function(error) {
-      do_check_null(error);
+    request2.get(function(error2) {
+      do_check_null(error2);
 
       do_check_eq(request2.response.status, 200);
       do_check_eq(request2.response.body, response);
       do_check_eq(request2.response.headers["content-type"], contentType);
       do_check_eq(request2.response.charset, "us-ascii");
 
       server.stop(run_next_test);
     });
@@ -865,9 +865,8 @@ add_test(function test_not_sending_cooki
   let res = new RESTRequest(server.baseURI + "/test");
   res.get(function(error) {
     do_check_null(error);
     do_check_true(this.response.success);
     do_check_eq("COOKIE!", this.response.body);
     server.stop(run_next_test);
   });
 });
-
--- a/services/common/tests/unit/test_storage_server.js
+++ b/services/common/tests/unit/test_storage_server.js
@@ -592,17 +592,17 @@ add_test(function test_x_num_records() {
              bars: {foo: "baz"}}
   });
   server.startSynchronous();
   let bso = localRequest(server, "/2.0/123/storage/crypto/foos");
   bso.get(function(err) {
     // BSO fetches don't have one.
     do_check_false("x-num-records" in this.response.headers);
     let col = localRequest(server, "/2.0/123/storage/crypto");
-    col.get(function(err) {
+    col.get(function(err2) {
       // Collection fetches do.
       do_check_eq(this.response.headers["x-num-records"], "2");
       server.stop(run_next_test);
     });
   });
 });
 
 add_test(function test_put_delete_put() {
--- a/services/fxaccounts/tests/xpcshell/test_accounts.js
+++ b/services/fxaccounts/tests/xpcshell/test_accounts.js
@@ -517,33 +517,33 @@ add_test(function test_polling_timeout()
 add_test(function test_getKeys() {
   let fxa = new MockFxAccounts();
   let user = getTestUser("eusebius");
 
   // Once email has been verified, we will be able to get keys
   user.verified = true;
 
   fxa.setSignedInUser(user).then(() => {
-    fxa.getSignedInUser().then((user) => {
+    fxa.getSignedInUser().then((user2) => {
       // Before getKeys, we have no keys
-      do_check_eq(!!user.kA, false);
-      do_check_eq(!!user.kB, false);
+      do_check_eq(!!user2.kA, false);
+      do_check_eq(!!user2.kB, false);
       // And we still have a key-fetch token and unwrapBKey to use
-      do_check_eq(!!user.keyFetchToken, true);
-      do_check_eq(!!user.unwrapBKey, true);
+      do_check_eq(!!user2.keyFetchToken, true);
+      do_check_eq(!!user2.unwrapBKey, true);
 
       fxa.internal.getKeys().then(() => {
-        fxa.getSignedInUser().then((user) => {
+        fxa.getSignedInUser().then((user3) => {
           // Now we should have keys
-          do_check_eq(fxa.internal.isUserEmailVerified(user), true);
-          do_check_eq(!!user.verified, true);
-          do_check_eq(user.kA, expandHex("11"));
-          do_check_eq(user.kB, expandHex("66"));
-          do_check_eq(user.keyFetchToken, undefined);
-          do_check_eq(user.unwrapBKey, undefined);
+          do_check_eq(fxa.internal.isUserEmailVerified(user3), true);
+          do_check_eq(!!user3.verified, true);
+          do_check_eq(user3.kA, expandHex("11"));
+          do_check_eq(user3.kB, expandHex("66"));
+          do_check_eq(user3.keyFetchToken, undefined);
+          do_check_eq(user3.unwrapBKey, undefined);
           run_next_test();
         });
       });
     });
   });
 });
 
 add_task(function* test_getKeys_nonexistent_account() {
@@ -614,23 +614,23 @@ add_task(function* test_getKeys_invalid_
 //  fetchAndUnwrapKeys with no keyFetchToken should trigger signOut
 add_test(function test_fetchAndUnwrapKeys_no_token() {
   let fxa = new MockFxAccounts();
   let user = getTestUser("lettuce.protheroe");
   delete user.keyFetchToken
 
   makeObserver(ONLOGOUT_NOTIFICATION, function() {
     log.debug("test_fetchAndUnwrapKeys_no_token observed logout");
-    fxa.internal.getUserAccountData().then(user => {
+    fxa.internal.getUserAccountData().then(user2 => {
       run_next_test();
     });
   });
 
   fxa.setSignedInUser(user).then(
-    user => {
+    user2 => {
       return fxa.internal.fetchAndUnwrapKeys();
     }
   ).then(
     null,
     error => {
       log.info("setSignedInUser correctly rejected");
     }
   )
@@ -855,18 +855,18 @@ add_test(function test_accountStatus() {
       fxa.setSignedInUser(alice).then(
         () => {
           fxa.accountStatus().then(
             (result) => {
                // FxAccounts.accountStatus() should match Client.accountStatus()
                do_check_true(result);
                fxa.internal.fxAccountsClient._deletedOnServer = true;
                fxa.accountStatus().then(
-                 (result) => {
-                   do_check_false(result);
+                 (result2) => {
+                   do_check_false(result2);
                    fxa.internal.fxAccountsClient._deletedOnServer = false;
                    fxa.signOut().then(run_next_test);
                  }
                );
             }
           )
         }
       );
--- a/services/fxaccounts/tests/xpcshell/test_profile_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_profile_client.js
@@ -13,18 +13,23 @@ const STATUS_SUCCESS = 200;
  * @param {String} response
  *        Mocked raw response from the server
  * @returns {Function}
  */
 let mockResponse = function(response) {
   let Request = function(requestUri) {
     // Store the request uri so tests can inspect it
     Request._requestUri = requestUri;
+    Request.ifNoneMatchSet = false;
     return {
-      setHeader() {},
+      setHeader(header, value) {
+        if (header == "If-None-Match" && value == "bogusETag") {
+          Request.ifNoneMatchSet = true;
+        }
+      },
       get() {
         this.response = response;
         this.onComplete();
       }
     };
   };
 
   return Request;
@@ -88,47 +93,25 @@ add_test(function setsIfNoneMatchETagHea
   let client = new FxAccountsProfileClient(PROFILE_OPTIONS);
   let response = {
     success: true,
     status: STATUS_SUCCESS,
     headers: {},
     body: "{\"email\":\"someone@restmail.net\",\"uid\":\"0d5c1a89b8c54580b8e3e8adadae864a\"}",
   };
 
-  let ifNoneMatchSet = false;
-
-  let mockResponse = function(response) {
-    let Request = function(requestUri) {
-      // Store the request uri so tests can inspect it
-      Request._requestUri = requestUri;
-      return {
-        setHeader(header, value) {
-          if (header == "If-None-Match" && value == "bogusETag") {
-            ifNoneMatchSet = true;
-          }
-        },
-        get() {
-          this.response = response;
-          this.onComplete();
-        }
-      };
-    };
-
-    return Request;
-  };
-
   let req = new mockResponse(response);
   client._Request = req;
   client.fetchProfile("bogusETag")
     .then(
       function(result) {
         do_check_eq(client._Request._requestUri, "http://127.0.0.1:1111/v1/profile");
         do_check_eq(result.body.email, "someone@restmail.net");
         do_check_eq(result.body.uid, "0d5c1a89b8c54580b8e3e8adadae864a");
-        do_check_true(ifNoneMatchSet);
+        do_check_true(req.ifNoneMatchSet);
         run_next_test();
       }
     );
 });
 
 add_test(function parseErrorResponse() {
   let client = new FxAccountsProfileClient(PROFILE_OPTIONS);
   let response = {
@@ -177,31 +160,31 @@ add_test(function serverErrorResponse() 
 // Test that we get a token, then if we get a 401 we revoke it, get a new one
 // and retry.
 add_test(function server401ResponseThenSuccess() {
   // The last token we handed out.
   let lastToken = -1;
   // The number of times our removeCachedOAuthToken function was called.
   let numTokensRemoved = 0;
 
-  let mockFxa = {
+  let mockFxaWithRemove = {
     getOAuthToken(options) {
       do_check_eq(options.scope, "profile");
       return "" + ++lastToken; // tokens are strings.
     },
     removeCachedOAuthToken(options) {
       // This test never has more than 1 token alive at once, so the token
       // being revoked must always be the last token we handed out.
       do_check_eq(parseInt(options.token), lastToken);
       ++numTokensRemoved;
     }
   }
   let profileOptions = {
     serverURL: "http://127.0.0.1:1111/v1",
-    fxa: mockFxa,
+    fxa: mockFxaWithRemove,
   };
   let client = new FxAccountsProfileClient(profileOptions);
 
   // 2 responses - first one implying the token has expired, second works.
   let responses = [
     {
       status: 401,
       body: "{ \"code\": 401, \"errno\": 100, \"error\": \"Token expired\", \"message\": \"That token is too old\", \"reason\": \"Because security\" }",
@@ -251,31 +234,31 @@ add_test(function server401ResponseThenS
 // Test that we get a token, then if we get a 401 we revoke it, get a new one
 // and retry - but we *still* get a 401 on the retry, so the caller sees that.
 add_test(function server401ResponsePersists() {
   // The last token we handed out.
   let lastToken = -1;
   // The number of times our removeCachedOAuthToken function was called.
   let numTokensRemoved = 0;
 
-  let mockFxa = {
+  let mockFxaWithRemove = {
     getOAuthToken(options) {
       do_check_eq(options.scope, "profile");
       return "" + ++lastToken; // tokens are strings.
     },
     removeCachedOAuthToken(options) {
       // This test never has more than 1 token alive at once, so the token
       // being revoked must always be the last token we handed out.
       do_check_eq(parseInt(options.token), lastToken);
       ++numTokensRemoved;
     }
   }
   let profileOptions = {
     serverURL: "http://127.0.0.1:1111/v1",
-    fxa: mockFxa,
+    fxa: mockFxaWithRemove,
   };
   let client = new FxAccountsProfileClient(profileOptions);
 
   let response = {
       status: 401,
       body: "{ \"code\": 401, \"errno\": 100, \"error\": \"It's not your token, it's you!\", \"message\": \"I don't like you\", \"reason\": \"Because security\" }",
   };
 
--- a/services/fxaccounts/tests/xpcshell/test_push_service.js
+++ b/services/fxaccounts/tests/xpcshell/test_push_service.js
@@ -5,19 +5,19 @@
 
 // Tests for the FxA push service.
 
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/FxAccountsCommon.js");
 Cu.import("resource://gre/modules/Log.jsm");
 
-let scope = {};
-Services.scriptloader.loadSubScript("resource://gre/components/FxAccountsPush.js", scope);
-const FxAccountsPushService = scope.FxAccountsPushService;
+let importScope = {};
+Services.scriptloader.loadSubScript("resource://gre/components/FxAccountsPush.js", importScope);
+const FxAccountsPushService = importScope.FxAccountsPushService;
 
 XPCOMUtils.defineLazyServiceGetter(this, "pushService",
   "@mozilla.org/push/Service;1", "nsIPushService");
 
 initTestLogging("Trace");
 log.level = Log.Level.Trace;
 
 const MOCK_ENDPOINT = "http://mochi.test:8888";
--- a/services/sync/tests/unit/head_helpers.js
+++ b/services/sync/tests/unit/head_helpers.js
@@ -189,19 +189,19 @@ function mockShouldSkipWindow(win) {
 
 function mockGetTabState(tab) {
   return tab;
 }
 
 function mockGetWindowEnumerator(url, numWindows, numTabs, indexes, moreURLs) {
   let elements = [];
 
-  function url2entry(url) {
+  function url2entry(urlToConvert) {
     return {
-      url: ((typeof url == "function") ? url() : url),
+      url: ((typeof urlToConvert == "function") ? urlToConvert() : urlToConvert),
       title: "title"
     };
   }
 
   for (let w = 0; w < numWindows; ++w) {
     let tabs = [];
     let win = {
       closed: false,
--- a/services/sync/tests/unit/head_http_server.js
+++ b/services/sync/tests/unit/head_http_server.js
@@ -869,18 +869,18 @@ SyncServer.prototype = {
 
     if (!this.userExists(username)) {
       this._log.debug("SyncServer: Unknown user.");
       throw HTTP_401;
     }
 
     // Hand off to the appropriate handler for this path component.
     if (first in this.toplevelHandlers) {
-      let handler = this.toplevelHandlers[first];
-      return handler.call(this, handler, req, resp, version, username, rest);
+      let newHandler = this.toplevelHandlers[first];
+      return newHandler.call(this, newHandler, req, resp, version, username, rest);
     }
     this._log.debug("SyncServer: Unknown top-level " + first);
     throw HTTP_404;
   },
 
   /**
    * Compute the object that is returned for an info/collections request.
    */
@@ -922,17 +922,17 @@ SyncServer.prototype = {
       let match = this.storageRE.exec(rest);
       if (!match) {
         this._log.warn("SyncServer: Unknown storage operation " + rest);
         throw HTTP_404;
       }
       let [, collection, wboID] = match;
       let coll = this.getCollection(username, collection);
       switch (req.method) {
-        case "GET":
+        case "GET": {
           if (!coll) {
             if (wboID) {
               respond(404, "Not found", "Not found");
               return undefined;
             }
             // *cries inside*: Bug 687299.
             respond(200, "OK", "[]");
             return undefined;
@@ -941,19 +941,19 @@ SyncServer.prototype = {
             return coll.collectionHandler(req, resp);
           }
           let wbo = coll.wbo(wboID);
           if (!wbo) {
             respond(404, "Not found", "Not found");
             return undefined;
           }
           return wbo.handler()(req, resp);
-
+        }
         // TODO: implement handling of X-If-Unmodified-Since for write verbs.
-        case "DELETE":
+        case "DELETE": {
           if (!coll) {
             respond(200, "OK", "{}");
             return undefined;
           }
           if (wboID) {
             let wbo = coll.wbo(wboID);
             if (wbo) {
               wbo.delete();
@@ -987,16 +987,17 @@ SyncServer.prototype = {
           }
 
           // Notify of item deletion.
           let deleted = resp.deleted || [];
           for (let i = 0; i < deleted.length; ++i) {
             this.callback.onItemDeleted(username, collection, deleted[i]);
           }
           return undefined;
+        }
         case "POST":
         case "PUT":
           if (!coll) {
             coll = this.createCollection(username, collection);
           }
           if (wboID) {
             let wbo = coll.wbo(wboID);
             if (!wbo) {
--- a/services/sync/tests/unit/test_addons_store.js
+++ b/services/sync/tests/unit/test_addons_store.js
@@ -293,46 +293,46 @@ add_test(function test_addon_syncability
   run_next_test();
 });
 
 add_test(function test_ignore_hotfixes() {
   _("Ensure that hotfix extensions are ignored.");
 
   // A hotfix extension is one that has the id the same as the
   // extensions.hotfix.id pref.
-  let prefs = new Preferences("extensions.");
+  let extensionPrefs = new Preferences("extensions.");
 
   let addon = installAddon("test_bootstrap1_1");
   do_check_true(store.isAddonSyncable(addon));
 
   let dummy = {};
   const KEYS = ["id", "syncGUID", "type", "scope", "foreignInstall", "isSyncable"];
   for (let k of KEYS) {
     dummy[k] = addon[k];
   }
 
   // Basic sanity check.
   do_check_true(store.isAddonSyncable(dummy));
 
-  prefs.set("hotfix.id", dummy.id);
+  extensionPrefs.set("hotfix.id", dummy.id);
   do_check_false(store.isAddonSyncable(dummy));
 
   // Verify that int values don't throw off checking.
   let prefSvc = Cc["@mozilla.org/preferences-service;1"]
                 .getService(Ci.nsIPrefService)
                 .getBranch("extensions.");
   // Need to delete pref before changing type.
   prefSvc.deleteBranch("hotfix.id");
   prefSvc.setIntPref("hotfix.id", 0xdeadbeef);
 
   do_check_true(store.isAddonSyncable(dummy));
 
   uninstallAddon(addon);
 
-  prefs.reset("hotfix.id");
+  extensionPrefs.reset("hotfix.id");
 
   run_next_test();
 });
 
 
 add_test(function test_get_all_ids() {
   _("Ensures that getAllIDs() returns an appropriate set.");
 
@@ -531,9 +531,8 @@ add_test(function test_wipe_and_install(
   server.stop(run_next_test);
 });
 
 add_test(function cleanup() {
   // There's an xpcom-shutdown hook for this, but let's give this a shot.
   reconciler.stopListening();
   run_next_test();
 });
-
--- a/services/sync/tests/unit/test_bookmark_order.js
+++ b/services/sync/tests/unit/test_bookmark_order.js
@@ -53,32 +53,32 @@ add_task(async function test_bookmark_or
     guid: PlacesUtils.bookmarks.unfiledGuid,
     index: 3,
   }, {
     guid: PlacesUtils.bookmarks.mobileGuid,
     index: 4,
   }], "clean slate");
 
   function bookmark(name, parent) {
-    let bookmark = new Bookmark("http://weave.server/my-bookmark");
-    bookmark.id = name;
-    bookmark.title = name;
-    bookmark.bmkUri = "http://uri/";
-    bookmark.parentid = parent || "unfiled";
-    bookmark.tags = [];
-    return bookmark;
+    let bm = new Bookmark("http://weave.server/my-bookmark");
+    bm.id = name;
+    bm.title = name;
+    bm.bmkUri = "http://uri/";
+    bm.parentid = parent || "unfiled";
+    bm.tags = [];
+    return bm;
   }
 
   function folder(name, parent, children) {
-    let folder = new BookmarkFolder("http://weave.server/my-bookmark-folder");
-    folder.id = name;
-    folder.title = name;
-    folder.parentid = parent || "unfiled";
-    folder.children = children;
-    return folder;
+    let bmFolder = new BookmarkFolder("http://weave.server/my-bookmark-folder");
+    bmFolder.id = name;
+    bmFolder.title = name;
+    bmFolder.parentid = parent || "unfiled";
+    bmFolder.children = children;
+    return bmFolder;
   }
 
   function apply(record) {
     store._childrenToOrder = {};
     store.applyIncoming(record);
     store._orderChildren();
     delete store._childrenToOrder;
   }
--- a/services/sync/tests/unit/test_bookmark_smart_bookmarks.js
+++ b/services/sync/tests/unit/test_bookmark_smart_bookmarks.js
@@ -42,20 +42,20 @@ function clearBookmarks() {
   _("Cleaning up existing items.");
   PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.bookmarks.bookmarksMenuFolder);
   PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.bookmarks.tagsFolder);
   PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.bookmarks.toolbarFolder);
   PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.bookmarks.unfiledBookmarksFolder);
   startCount = smartBookmarkCount();
 }
 
-function serverForFoo(engine) {
+function serverForFoo(engineData) {
   return serverForUsers({"foo": "password"}, {
-    meta: {global: {engines: {bookmarks: {version: engine.version,
-                                          syncID: engine.syncID}}}},
+    meta: {global: {engines: {bookmarks: {version: engineData.version,
+                                          syncID: engineData.syncID}}}},
     bookmarks: {}
   });
 }
 
 // Verify that Places smart bookmarks have their annotation uploaded and
 // handled locally.
 add_task(async function test_annotation_uploaded() {
   let server = serverForFoo(engine);
--- a/services/sync/tests/unit/test_bookmark_tracker.js
+++ b/services/sync/tests/unit/test_bookmark_tracker.js
@@ -952,17 +952,17 @@ add_task(async function test_onFaviconCh
     let iconURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" +
       "AAAA6fptVAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==";
 
     PlacesUtils.favicons.replaceFaviconDataFromDataURL(iconURI, iconURL, 0,
       Services.scriptSecurityManager.getSystemPrincipal());
 
     await new Promise(resolve => {
       PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, iconURI, true,
-        PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (iconURI, dataLen, data, mimeType) => {
+        PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (uri, dataLen, data, mimeType) => {
           resolve();
         },
         Services.scriptSecurityManager.getSystemPrincipal());
     });
     await verifyTrackedItems([]);
     do_check_eq(tracker.score, 0);
   } finally {
     _("Clean up.");
--- a/services/sync/tests/unit/test_browserid_identity.js
+++ b/services/sync/tests/unit/test_browserid_identity.js
@@ -17,19 +17,19 @@ Cu.import("resource://services-sync/serv
 Cu.import("resource://services-sync/status.js");
 Cu.import("resource://services-sync/constants.js");
 Cu.import("resource://services-common/tokenserverclient.js");
 
 const SECOND_MS = 1000;
 const MINUTE_MS = SECOND_MS * 60;
 const HOUR_MS = MINUTE_MS * 60;
 
-var identityConfig = makeIdentityConfig();
-var browseridManager = new BrowserIDManager();
-configureFxAccountIdentity(browseridManager, identityConfig);
+var globalIdentityConfig = makeIdentityConfig();
+var globalBrowseridManager = new BrowserIDManager();
+configureFxAccountIdentity(globalBrowseridManager, globalIdentityConfig);
 
 /**
  * Mock client clock and skew vs server in FxAccounts signed-in user module and
  * API client.  browserid_identity.js queries these values to construct HAWK
  * headers.  We will use this to test clock skew compensation in these headers
  * below.
  */
 var MockFxAccountsClient = function() {
@@ -66,28 +66,28 @@ function run_test() {
   initTestLogging("Trace");
   Log.repository.getLogger("Sync.Identity").level = Log.Level.Trace;
   Log.repository.getLogger("Sync.BrowserIDManager").level = Log.Level.Trace;
   run_next_test();
 }
 
 add_test(function test_initial_state() {
     _("Verify initial state");
-    do_check_false(!!browseridManager._token);
-    do_check_false(browseridManager.hasValidToken());
+    do_check_false(!!globalBrowseridManager._token);
+    do_check_false(globalBrowseridManager.hasValidToken());
     run_next_test();
   }
 );
 
 add_task(async function test_initialializeWithCurrentIdentity() {
     _("Verify start after initializeWithCurrentIdentity");
-    browseridManager.initializeWithCurrentIdentity();
-    await browseridManager.whenReadyToAuthenticate.promise;
-    do_check_true(!!browseridManager._token);
-    do_check_true(browseridManager.hasValidToken());
+    globalBrowseridManager.initializeWithCurrentIdentity();
+    await globalBrowseridManager.whenReadyToAuthenticate.promise;
+    do_check_true(!!globalBrowseridManager._token);
+    do_check_true(globalBrowseridManager.hasValidToken());
   }
 );
 
 add_task(async function test_initialializeWithAuthErrorAndDeletedAccount() {
     _("Verify sync unpair after initializeWithCurrentIdentity with auth error + account deleted");
 
     var identityConfig = makeIdentityConfig();
     var browseridManager = new BrowserIDManager();
@@ -98,35 +98,35 @@ add_task(async function test_initialiali
     delete fxaInternal._getAssertion;
 
     configureFxAccountIdentity(browseridManager, identityConfig, fxaInternal);
     browseridManager._fxaService.internal.initialize();
 
     let signCertificateCalled = false;
     let accountStatusCalled = false;
 
-    let MockFxAccountsClient = function() {
+    let AuthErrorMockFxAClient = function() {
       FxAccountsClient.apply(this);
     };
-    MockFxAccountsClient.prototype = {
+    AuthErrorMockFxAClient.prototype = {
       __proto__: FxAccountsClient.prototype,
       signCertificate() {
         signCertificateCalled = true;
         return Promise.reject({
           code: 401,
           errno: ERRNO_INVALID_AUTH_TOKEN,
         });
       },
       accountStatus() {
         accountStatusCalled = true;
         return Promise.resolve(false);
       }
     };
 
-    let mockFxAClient = new MockFxAccountsClient();
+    let mockFxAClient = new AuthErrorMockFxAClient();
     browseridManager._fxaService.internal._fxAccountsClient = mockFxAClient;
 
     await browseridManager.initializeWithCurrentIdentity();
     await Assert.rejects(browseridManager.whenReadyToAuthenticate.promise,
                      "should reject due to an auth error");
 
     do_check_true(signCertificateCalled);
     do_check_true(accountStatusCalled);
@@ -135,54 +135,54 @@ add_task(async function test_initialiali
 });
 
 add_task(async function test_initialializeWithNoKeys() {
     _("Verify start after initializeWithCurrentIdentity without kA, kB or keyFetchToken");
     let identityConfig = makeIdentityConfig();
     delete identityConfig.fxaccount.user.kA;
     delete identityConfig.fxaccount.user.kB;
     // there's no keyFetchToken by default, so the initialize should fail.
-    configureFxAccountIdentity(browseridManager, identityConfig);
+    configureFxAccountIdentity(globalBrowseridManager, identityConfig);
 
-    await browseridManager.initializeWithCurrentIdentity();
-    await browseridManager.whenReadyToAuthenticate.promise;
+    await globalBrowseridManager.initializeWithCurrentIdentity();
+    await globalBrowseridManager.whenReadyToAuthenticate.promise;
     do_check_eq(Status.login, LOGIN_SUCCEEDED, "login succeeded even without keys");
-    do_check_false(browseridManager._canFetchKeys(), "_canFetchKeys reflects lack of keys");
-    do_check_eq(browseridManager._token, null, "we don't have a token");
+    do_check_false(globalBrowseridManager._canFetchKeys(), "_canFetchKeys reflects lack of keys");
+    do_check_eq(globalBrowseridManager._token, null, "we don't have a token");
 });
 
 add_test(function test_getResourceAuthenticator() {
     _("BrowserIDManager supplies a Resource Authenticator callback which returns a Hawk header.");
-    configureFxAccountIdentity(browseridManager);
-    let authenticator = browseridManager.getResourceAuthenticator();
+    configureFxAccountIdentity(globalBrowseridManager);
+    let authenticator = globalBrowseridManager.getResourceAuthenticator();
     do_check_true(!!authenticator);
     let req = {uri: CommonUtils.makeURI(
       "https://example.net/somewhere/over/the/rainbow"),
                method: "GET"};
     let output = authenticator(req, "GET");
     do_check_true("headers" in output);
     do_check_true("authorization" in output.headers);
     do_check_true(output.headers.authorization.startsWith("Hawk"));
     _("Expected internal state after successful call.");
-    do_check_eq(browseridManager._token.uid, identityConfig.fxaccount.token.uid);
+    do_check_eq(globalBrowseridManager._token.uid, globalIdentityConfig.fxaccount.token.uid);
     run_next_test();
   }
 );
 
 add_test(function test_getRESTRequestAuthenticator() {
     _("BrowserIDManager supplies a REST Request Authenticator callback which sets a Hawk header on a request object.");
     let request = new SyncStorageRequest(
       "https://example.net/somewhere/over/the/rainbow");
-    let authenticator = browseridManager.getRESTRequestAuthenticator();
+    let authenticator = globalBrowseridManager.getRESTRequestAuthenticator();
     do_check_true(!!authenticator);
     let output = authenticator(request, "GET");
     do_check_eq(request.uri, output.uri);
     do_check_true(output._headers.authorization.startsWith("Hawk"));
     do_check_true(output._headers.authorization.includes("nonce"));
-    do_check_true(browseridManager.hasValidToken());
+    do_check_true(globalBrowseridManager.hasValidToken());
     run_next_test();
   }
 );
 
 add_test(function test_resourceAuthenticatorSkew() {
   _("BrowserIDManager Resource Authenticator compensates for clock skew in Hawk header.");
 
   // Clock is skewed 12 hours into the future
@@ -220,17 +220,17 @@ add_test(function test_resourceAuthentic
   // Picked up by the signed-in user module
   do_check_eq(fxa.internal.now(), now);
   do_check_eq(fxa.internal.localtimeOffsetMsec, localtimeOffsetMsec);
 
   do_check_eq(fxa.now(), now);
   do_check_eq(fxa.localtimeOffsetMsec, localtimeOffsetMsec);
 
   // Mocks within mocks...
-  configureFxAccountIdentity(browseridManager, identityConfig);
+  configureFxAccountIdentity(browseridManager, globalIdentityConfig);
 
   // Ensure the new FxAccounts mock has a signed-in user.
   fxa.internal.currentAccountState.signedInUser = browseridManager._fxaService.internal.currentAccountState.signedInUser;
 
   browseridManager._fxaService = fxa;
 
   do_check_eq(browseridManager._fxaService.internal.now(), now);
   do_check_eq(browseridManager._fxaService.internal.localtimeOffsetMsec,
@@ -273,17 +273,17 @@ add_test(function test_RESTResourceAuthe
   hawkClient._localtimeOffsetMsec = -1 * 12 * HOUR_MS;
 
   let fxaClient = new MockFxAccountsClient();
   fxaClient.hawk = hawkClient;
   let fxa = new MockFxAccounts();
   fxa.internal._now_is = now;
   fxa.internal.fxAccountsClient = fxaClient;
 
-  configureFxAccountIdentity(browseridManager, identityConfig);
+  configureFxAccountIdentity(browseridManager, globalIdentityConfig);
 
   // Ensure the new FxAccounts mock has a signed-in user.
   fxa.internal.currentAccountState.signedInUser = browseridManager._fxaService.internal.currentAccountState.signedInUser;
 
   browseridManager._fxaService = fxa;
 
   do_check_eq(browseridManager._fxaService.internal.now(), now);
 
@@ -299,52 +299,52 @@ add_test(function test_RESTResourceAuthe
   do_check_eq(getTimestamp(authHeader), now - 12 * HOUR_MS);
   do_check_true(
       (getTimestampDelta(authHeader, now) - 12 * HOUR_MS) < 2 * MINUTE_MS);
 
   run_next_test();
 });
 
 add_task(async function test_ensureLoggedIn() {
-  configureFxAccountIdentity(browseridManager);
-  await browseridManager.initializeWithCurrentIdentity();
-  await browseridManager.whenReadyToAuthenticate.promise;
+  configureFxAccountIdentity(globalBrowseridManager);
+  await globalBrowseridManager.initializeWithCurrentIdentity();
+  await globalBrowseridManager.whenReadyToAuthenticate.promise;
   Assert.equal(Status.login, LOGIN_SUCCEEDED, "original initialize worked");
-  await browseridManager.ensureLoggedIn();
+  await globalBrowseridManager.ensureLoggedIn();
   Assert.equal(Status.login, LOGIN_SUCCEEDED, "original ensureLoggedIn worked");
-  Assert.ok(browseridManager._shouldHaveSyncKeyBundle,
+  Assert.ok(globalBrowseridManager._shouldHaveSyncKeyBundle,
             "_shouldHaveSyncKeyBundle should always be true after ensureLogin completes.");
 
   // arrange for no logged in user.
-  let fxa = browseridManager._fxaService
+  let fxa = globalBrowseridManager._fxaService
   let signedInUser = fxa.internal.currentAccountState.storageManager.accountData;
   fxa.internal.currentAccountState.storageManager.accountData = null;
-  browseridManager.initializeWithCurrentIdentity();
-  Assert.ok(!browseridManager._shouldHaveSyncKeyBundle,
+  globalBrowseridManager.initializeWithCurrentIdentity();
+  Assert.ok(!globalBrowseridManager._shouldHaveSyncKeyBundle,
             "_shouldHaveSyncKeyBundle should be false so we know we are testing what we think we are.");
   Status.login = LOGIN_FAILED_NO_USERNAME;
-  await Assert.rejects(browseridManager.ensureLoggedIn(), "expecting rejection due to no user");
-  Assert.ok(browseridManager._shouldHaveSyncKeyBundle,
+  await Assert.rejects(globalBrowseridManager.ensureLoggedIn(), "expecting rejection due to no user");
+  Assert.ok(globalBrowseridManager._shouldHaveSyncKeyBundle,
             "_shouldHaveSyncKeyBundle should always be true after ensureLogin completes.");
   // Restore the logged in user to what it was.
   fxa.internal.currentAccountState.storageManager.accountData = signedInUser;
   Status.login = LOGIN_FAILED_LOGIN_REJECTED;
-  await Assert.rejects(browseridManager.ensureLoggedIn(),
+  await Assert.rejects(globalBrowseridManager.ensureLoggedIn(),
                        "LOGIN_FAILED_LOGIN_REJECTED should have caused immediate rejection");
   Assert.equal(Status.login, LOGIN_FAILED_LOGIN_REJECTED,
                "status should remain LOGIN_FAILED_LOGIN_REJECTED");
   Status.login = LOGIN_FAILED_NETWORK_ERROR;
-  await browseridManager.ensureLoggedIn();
+  await globalBrowseridManager.ensureLoggedIn();
   Assert.equal(Status.login, LOGIN_SUCCEEDED, "final ensureLoggedIn worked");
 });
 
 add_test(function test_tokenExpiration() {
     _("BrowserIDManager notices token expiration:");
     let bimExp = new BrowserIDManager();
-    configureFxAccountIdentity(bimExp, identityConfig);
+    configureFxAccountIdentity(bimExp, globalIdentityConfig);
 
     let authenticator = bimExp.getResourceAuthenticator();
     do_check_true(!!authenticator);
     let req = {uri: CommonUtils.makeURI(
       "https://example.net/somewhere/over/the/rainbow"),
                method: "GET"};
     authenticator(req, "GET");
 
@@ -442,27 +442,27 @@ add_task(async function test_refreshCert
   // `mockFxAClient.signCertificate`.
   let fxaInternal = makeFxAccountsInternalMock(identityConfig);
   delete fxaInternal._getAssertion;
   configureFxAccountIdentity(browseridManager, identityConfig, fxaInternal);
   browseridManager._fxaService.internal.initialize();
 
   let getCertCount = 0;
 
-  let MockFxAccountsClient = function() {
+  let CheckSignMockFxAClient = function() {
     FxAccountsClient.apply(this);
   };
-  MockFxAccountsClient.prototype = {
+  CheckSignMockFxAClient.prototype = {
     __proto__: FxAccountsClient.prototype,
     signCertificate() {
       ++getCertCount;
     }
   };
 
-  let mockFxAClient = new MockFxAccountsClient();
+  let mockFxAClient = new CheckSignMockFxAClient();
   browseridManager._fxaService.internal._fxAccountsClient = mockFxAClient;
 
   let didReturn401 = false;
   let didReturn200 = false;
   let mockTSC = mockTokenServer(() => {
     if (getCertCount <= 1) {
       didReturn401 = true;
       return {
@@ -737,37 +737,36 @@ add_task(async function test_getKeysMiss
 
   Assert.ok(ex.message.indexOf("missing kA or kB") >= 0);
 });
 
 add_task(async function test_signedInUserMissing() {
   _("BrowserIDManager detects getSignedInUser returning incomplete account data");
 
   let browseridManager = new BrowserIDManager();
-  makeIdentityConfig();
   // Delete stored keys and the key fetch token.
-  delete identityConfig.fxaccount.user.kA;
-  delete identityConfig.fxaccount.user.kB;
-  delete identityConfig.fxaccount.user.keyFetchToken;
+  delete globalIdentityConfig.fxaccount.user.kA;
+  delete globalIdentityConfig.fxaccount.user.kB;
+  delete globalIdentityConfig.fxaccount.user.keyFetchToken;
 
-  configureFxAccountIdentity(browseridManager, identityConfig);
+  configureFxAccountIdentity(browseridManager, globalIdentityConfig);
 
   let fxa = new FxAccounts({
     fetchAndUnwrapKeys() {
       return Promise.resolve({});
     },
     fxAccountsClient: new MockFxAccountsClient(),
     newAccountState(credentials) {
       // We only expect this to be called with null indicating the (mock)
       // storage should be read.
       if (credentials) {
         throw new Error("Not expecting to have credentials passed");
       }
       let storageManager = new MockFxaStorageManager();
-      storageManager.initialize(identityConfig.fxaccount.user);
+      storageManager.initialize(globalIdentityConfig.fxaccount.user);
       return new AccountState(storageManager);
     },
   });
 
   browseridManager._fxaService = fxa;
 
   let status = await browseridManager.unlockAndVerifyAuthState();
   Assert.equal(status, LOGIN_FAILED_LOGIN_REJECTED);
@@ -835,20 +834,20 @@ async function initializeIdentityWithHAW
       }
       let storageManager = new MockFxaStorageManager();
       storageManager.initialize(config.fxaccount.user);
       return new AccountState(storageManager);
     },
   }
   let fxa = new FxAccounts(internal);
 
-  browseridManager._fxaService = fxa;
-  browseridManager._signedInUser = null;
-  await browseridManager.initializeWithCurrentIdentity();
-  await Assert.rejects(browseridManager.whenReadyToAuthenticate.promise,
+  globalBrowseridManager._fxaService = fxa;
+  globalBrowseridManager._signedInUser = null;
+  await globalBrowseridManager.initializeWithCurrentIdentity();
+  await Assert.rejects(globalBrowseridManager.whenReadyToAuthenticate.promise,
                        "expecting rejection due to hawk error");
 }
 
 
 function getTimestamp(hawkAuthHeader) {
   return parseInt(/ts="(\d+)"/.exec(hawkAuthHeader)[1], 10) * SECOND_MS;
 }
 
--- a/services/sync/tests/unit/test_history_engine.js
+++ b/services/sync/tests/unit/test_history_engine.js
@@ -115,17 +115,17 @@ add_task(async function test_processInco
     do_check_eq(collection.get_log[1].sort, "index");
     do_check_eq(collection.get_log[1].limit, FAKE_DOWNLOAD_LIMIT);
     do_check_eq(collection.get_log[2].full, 1);
     do_check_eq(collection.get_log[3].full, 1);
     do_check_eq(collection.get_log[3].limit, MOBILE_BATCH_SIZE);
     do_check_eq(collection.get_log[4].full, undefined);
     do_check_eq(collection.get_log[4].sort, "index");
     do_check_eq(collection.get_log[4].limit, MAX_HISTORY_DOWNLOAD);
-    for (let i = 0; i <= Math.floor((234 - 50) / MOBILE_BATCH_SIZE); i++) {
+    for (i = 0; i <= Math.floor((234 - 50) / MOBILE_BATCH_SIZE); i++) {
       let j = i + 5;
       do_check_eq(collection.get_log[j].full, 1);
       do_check_eq(collection.get_log[j].limit, undefined);
       if (i < Math.floor((234 - 50) / MOBILE_BATCH_SIZE))
         do_check_eq(collection.get_log[j].ids.length, MOBILE_BATCH_SIZE);
       else
         do_check_eq(collection.get_log[j].ids.length, 234 % MOBILE_BATCH_SIZE);
     }
--- a/services/sync/tests/unit/test_httpd_sync_server.js
+++ b/services/sync/tests/unit/test_httpd_sync_server.js
@@ -109,25 +109,25 @@ add_test(function test_info_collections(
       req.get(function(err) {
         // Initial info/collections fetch is empty.
         do_check_eq(null, err);
         responseHasCorrectHeaders(this.response);
 
         do_check_eq(this.response.body, "{}");
         Utils.nextTick(function() {
           // When we PUT something to crypto/keys, "crypto" appears in the response.
-          function cb(err) {
-            do_check_eq(null, err);
+          function cb(err2) {
+            do_check_eq(null, err2);
             responseHasCorrectHeaders(this.response);
             let putResponseBody = this.response.body;
             _("PUT response body: " + JSON.stringify(putResponseBody));
 
             req = localRequest(server, "/1.1/john/info/collections");
-            req.get(function(err) {
-              do_check_eq(null, err);
+            req.get(function(err3) {
+              do_check_eq(null, err3);
               responseHasCorrectHeaders(this.response);
               let expectedColl = server.getCollection("john", "crypto");
               do_check_true(!!expectedColl);
               let modified = expectedColl.timestamp;
               do_check_true(modified > 0);
               do_check_eq(putResponseBody, modified);
               do_check_eq(JSON.parse(this.response.body).crypto, modified);
               Utils.nextTick(function() {
@@ -270,16 +270,16 @@ add_test(function test_x_weave_records()
              bars: {foo: "baz"}}
   });
   server.start(null, function() {
     let wbo = localRequest(server, "/1.1/john/storage/crypto/foos");
     wbo.get(function(err) {
       // WBO fetches don't have one.
       do_check_false("x-weave-records" in this.response.headers);
       let col = localRequest(server, "/1.1/john/storage/crypto");
-      col.get(function(err) {
+      col.get(function(err2) {
         // Collection fetches do.
         do_check_eq(this.response.headers["x-weave-records"], "2");
         server.stop(run_next_test);
       });
     });
   });
 });
--- a/services/sync/tests/unit/test_resource.js
+++ b/services/sync/tests/unit/test_resource.js
@@ -4,18 +4,16 @@
 Cu.import("resource://gre/modules/Log.jsm");
 Cu.import("resource://services-common/observers.js");
 Cu.import("resource://services-sync/resource.js");
 Cu.import("resource://services-sync/status.js");
 Cu.import("resource://services-sync/util.js");
 Cu.import("resource://services-sync/browserid_identity.js");
 Cu.import("resource://testing-common/services/sync/utils.js");
 
-var logger;
-
 var fetched = false;
 function server_open(metadata, response) {
   let body;
   if (metadata.method == "GET") {
     fetched = true;
     body = "This path exists";
     response.setStatusLine(metadata.httpVersion, 200, "OK");
   } else {
--- a/services/sync/tests/unit/test_resource_async.js
+++ b/services/sync/tests/unit/test_resource_async.js
@@ -266,37 +266,37 @@ add_test(function test_get() {
     do_check_eq(error, null);
     do_check_eq(content, "This path exists");
     do_check_eq(content.status, 200);
     do_check_true(content.success);
     // res.data has been updated with the result from the request
     do_check_eq(res.data, content);
 
     // Observe logging messages.
-    let logger = res._log;
-    let dbg    = logger.debug;
+    let resLogger = res._log;
+    let dbg    = resLogger.debug;
     let debugMessages = [];
-    logger.debug = function(msg) {
+    resLogger.debug = function(msg) {
       debugMessages.push(msg);
       dbg.call(this, msg);
     }
 
     // Since we didn't receive proper JSON data, accessing content.obj
     // will result in a SyntaxError from JSON.parse
     let didThrow = false;
     try {
       content.obj;
     } catch (ex) {
       didThrow = true;
     }
     do_check_true(didThrow);
     do_check_eq(debugMessages.length, 1);
     do_check_eq(debugMessages[0],
                 "Parse fail: Response body starts: \"\"This path exists\"\".");
-    logger.debug = dbg;
+    resLogger.debug = dbg;
 
     run_next_test();
   });
 });
 
 add_test(function test_basicauth() {
   _("Test that the BasicAuthenticator doesn't screw up header case.");
   let res1 = new AsyncResource(server.baseURI + "/foo");
--- a/services/sync/tests/unit/test_syncengine.js
+++ b/services/sync/tests/unit/test_syncengine.js
@@ -163,34 +163,34 @@ add_task(async function test_resetClient
 });
 
 add_task(async function test_wipeServer() {
   _("SyncEngine.wipeServer deletes server data and resets the client.");
   let engine = makeSteamEngine();
 
   const PAYLOAD = 42;
   let steamCollection = new ServerWBO("steam", PAYLOAD);
-  let server = httpd_setup({
+  let steamServer = httpd_setup({
     "/1.1/foo/storage/steam": steamCollection.handler()
   });
-  await SyncTestingInfrastructure(server);
+  await SyncTestingInfrastructure(steamServer);
   do_test_pending();
 
   try {
     // Some data to reset.
     engine.lastSync = 123.45;
     engine.toFetch = [Utils.makeGUID(), Utils.makeGUID(), Utils.makeGUID()];
 
     _("Wipe server data and reset client.");
     engine.wipeServer();
     do_check_eq(steamCollection.payload, undefined);
     do_check_eq(engine.lastSync, 0);
     do_check_eq(engine.toFetch.length, 0);
 
   } finally {
-    server.stop(do_test_finished);
+    steamServer.stop(do_test_finished);
     Svc.Prefs.resetBranch("");
   }
 });
 
 add_task(async function finish() {
   await promiseStopServer(server);
 });
--- a/services/sync/tests/unit/test_syncengine_sync.js
+++ b/services/sync/tests/unit/test_syncengine_sync.js
@@ -1114,18 +1114,18 @@ add_task(async function test_processInco
       throw "I don't like this record! Baaaaaah!";
     }
     return this._applyIncoming.apply(this, arguments);
   };
 
   // Keep track of requests made of a collection.
   let count = 0;
   let uris  = [];
-  function recording_handler(collection) {
-    let h = collection.handler();
+  function recording_handler(recordedCollection) {
+    let h = recordedCollection.handler();
     return function(req, res) {
       ++count;
       uris.push(req.path + "?" + req.queryString);
       return h(req, res);
     };
   }
   let server = sync_httpd_setup({
       "/1.1/foo/storage/rotary": recording_handler(collection)
--- a/services/sync/tests/unit/test_telemetry.js
+++ b/services/sync/tests/unit/test_telemetry.js
@@ -339,17 +339,17 @@ add_task(async function test_generic_eng
   let e = new Error("generic failure message")
   engine._errToThrow = e;
 
   try {
     _(`test_generic_engine_fail: Steam tracker contents: ${
       JSON.stringify(engine._tracker.changedIDs)}`);
     let ping = await sync_and_validate_telem(true);
     equal(ping.status.service, SYNC_FAILED_PARTIAL);
-    deepEqual(ping.engines.find(e => e.name === "steam").failureReason, {
+    deepEqual(ping.engines.find(err => err.name === "steam").failureReason, {
       name: "unexpectederror",
       error: String(e)
     });
   } finally {
     await cleanAndGo(engine, server);
     Service.engineManager.unregister(engine);
   }
 });
--- a/services/sync/tests/unit/test_utils_notify.js
+++ b/services/sync/tests/unit/test_utils_notify.js
@@ -23,27 +23,27 @@ function run_test() {
         didCall = true;
         throw 10;
       })();
     }
   };
 
   let state = 0;
   let makeObs = function(topic) {
-    let obj = {
-      observe(subject, topic, data) {
+    let obj2 = {
+      observe(subject, obsTopic, data) {
         this.state = ++state;
         this.subject = subject;
-        this.topic = topic;
+        this.topic = obsTopic;
         this.data = data;
       }
     };
 
-    Svc.Obs.add(topic, obj);
-    return obj;
+    Svc.Obs.add(topic, obj2);
+    return obj2;
   };
 
   _("Make sure a normal call will call and return with notifications");
   rightThis = didCall = false;
   let fs = makeObs("foo:bar:start");
   let ff = makeObs("foo:bar:finish");
   let fe = makeObs("foo:bar:error");
   ret = obj.func();