Bug 1160145 - Fix eslint warnings in Loop's xpcshell and mochitest files and turn on linting for them. r=dmose
authorMark Banner <standard8@mozilla.com>
Fri, 01 May 2015 10:42:46 +0100
changeset 273249 f27feb597c05ce0dea505f25ad54730487519d88
parent 273248 fe7300d84cd6c2c0682b086ae21bfe595262faef
child 273250 60b269fed8cfad8c7028a0292721aa241f94a361
child 273355 89a69f4178775107fd56ce0fc314e6da3389fe14
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmose
bugs1160145
milestone40.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 1160145 - Fix eslint warnings in Loop's xpcshell and mochitest files and turn on linting for them. r=dmose
browser/components/loop/.eslintignore
browser/components/loop/README.txt
browser/components/loop/test/mochitest/.eslintrc
browser/components/loop/test/mochitest/browser_CardDavImporter.js
browser/components/loop/test/mochitest/browser_GoogleImporter.js
browser/components/loop/test/mochitest/browser_LoopContacts.js
browser/components/loop/test/mochitest/browser_mozLoop_appVersionInfo.js
browser/components/loop/test/mochitest/browser_mozLoop_doNotDisturb.js
browser/components/loop/test/mochitest/browser_mozLoop_pluralStrings.js
browser/components/loop/test/mochitest/browser_mozLoop_prefs.js
browser/components/loop/test/mochitest/browser_mozLoop_socialShare.js
browser/components/loop/test/mochitest/browser_mozLoop_telemetry.js
browser/components/loop/test/mochitest/head.js
browser/components/loop/test/xpcshell/.eslintrc
browser/components/loop/test/xpcshell/head.js
browser/components/loop/test/xpcshell/test_looppush_initialize.js
browser/components/loop/test/xpcshell/test_looprooms.js
browser/components/loop/test/xpcshell/test_loopservice_busy.js
browser/components/loop/test/xpcshell/test_loopservice_directcall.js
browser/components/loop/test/xpcshell/test_loopservice_dnd.js
browser/components/loop/test/xpcshell/test_loopservice_encryptionkey.js
browser/components/loop/test/xpcshell/test_loopservice_initialize.js
browser/components/loop/test/xpcshell/test_loopservice_locales.js
browser/components/loop/test/xpcshell/test_loopservice_loop_prefs.js
browser/components/loop/test/xpcshell/test_loopservice_notification.js
browser/components/loop/test/xpcshell/test_loopservice_registration.js
browser/components/loop/test/xpcshell/test_loopservice_registration_retry.js
browser/components/loop/test/xpcshell/test_loopservice_restart.js
browser/components/loop/test/xpcshell/test_loopservice_token_invalid.js
browser/components/loop/test/xpcshell/test_loopservice_token_save.js
browser/components/loop/test/xpcshell/test_loopservice_token_send.js
browser/components/loop/test/xpcshell/test_loopservice_token_validation.js
--- a/browser/components/loop/.eslintignore
+++ b/browser/components/loop/.eslintignore
@@ -4,14 +4,11 @@ modules/MozLoopWorker.js
 # This file currently uses es7 features eslint issue:
 # https://github.com/eslint/espree/issues/125
 modules/MozLoopAPI.jsm
 # Libs we don't need to check
 content/libs
 content/shared/libs
 standalone/content/libs
 standalone/node_modules
-# We should look at turning these on when we fix the warnings
-test/xpcshell
-test/mochitest
 # Libs we don't need to check
 test/shared/vendor
 
--- a/browser/components/loop/README.txt
+++ b/browser/components/loop/README.txt
@@ -49,17 +49,17 @@ you've installed the dependencies by typ
 
 If you install eslint and the react plugin globally:
 
   npm install -g eslint
   npm install -g eslint-plugin-react
 
 You can also run it by hand in the browser/components/loop directory:
 
-  eslint -ext .js -ext .jsx --ext .jsm .
+  eslint --ext .js --ext .jsx --ext .jsm .
 
 Front-End Unit Tests
 ====================
 The unit tests for Loop reside in three directories:
 
 - test/desktop-local
 - test/shared
 - test/standalone
new file mode 100644
--- /dev/null
+++ b/browser/components/loop/test/mochitest/.eslintrc
@@ -0,0 +1,17 @@
+{
+  "ecmaFeatures": {
+    "arrowFunctions": true,
+    "blockBindings": true,
+    "destructuring": true,
+    "generators": true,
+    "restParams": true,
+    "spread": true,
+    "objectLiteralShorthandMethods": true,
+  },
+  "rules": {
+    "generator-star-spacing": [2, "after"],
+    // We should fix the errors and enable this (set to 2)
+    "no-var": 0,
+    "strict": [2, "global"]
+  }
+}
--- a/browser/components/loop/test/mochitest/browser_CardDavImporter.js
+++ b/browser/components/loop/test/mochitest/browser_CardDavImporter.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const {CardDavImporter} = Cu.import("resource:///modules/loop/CardDavImporter.jsm", {});
 
 const kAuth = {
   "method": "basic",
   "user": "username",
   "password": "p455w0rd"
 }
 
--- a/browser/components/loop/test/mochitest/browser_GoogleImporter.js
+++ b/browser/components/loop/test/mochitest/browser_GoogleImporter.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const {GoogleImporter} = Cu.import("resource:///modules/loop/GoogleImporter.jsm", {});
 
 let importer = new GoogleImporter();
 
 function promiseImport() {
   return new Promise(function(resolve, reject) {
     importer.startImport({}, function(err, stats) {
       if (err) {
--- a/browser/components/loop/test/mochitest/browser_LoopContacts.js
+++ b/browser/components/loop/test/mochitest/browser_LoopContacts.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const {LoopContacts} = Cu.import("resource:///modules/loop/LoopContacts.jsm", {});
 const {LoopStorage} = Cu.import("resource:///modules/loop/LoopStorage.jsm", {});
 
 XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
 const kContacts = [{
@@ -216,18 +218,23 @@ add_task(function* () {
 
   info("Get a couple of contacts.");
   yield new Promise((resolve, reject) => {
     let toRetrieve = [contacts[0], contacts[2], contacts[3]];
     LoopContacts.getMany(toRetrieve.map(contact => contact._guid), (err, result) => {
       Assert.ok(!err, "There shouldn't be an error");
       Assert.equal(result.length, toRetrieve.length, "Result list should be the same " +
                    "size as the list of items to retrieve");
+
+      function resultFilter(c) {
+        return c._guid == this._guid;
+      }
+
       for (let contact of toRetrieve) {
-        let found = result.filter(c => c._guid == contact._guid);
+        let found = result.filter(resultFilter.bind(contact));
         Assert.ok(found.length, "Contact " + contact._guid + " should be in the list");
         compareContacts(found[0], contact);
       }
       resolve();
     });
   });
 
   info("Get all contacts.");
--- a/browser/components/loop/test/mochitest/browser_mozLoop_appVersionInfo.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_appVersionInfo.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This is an integration test from navigator.mozLoop through to the end
  * effects - rather than just testing MozLoopAPI alone.
  */
 
+"use strict";
+
 Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
 add_task(loadLoopPanel);
 
 add_task(function* test_mozLoop_appVersionInfo() {
   Assert.ok(gMozLoopAPI, "mozLoop should exist");
 
   let appVersionInfo = gMozLoopAPI.appVersionInfo;
--- a/browser/components/loop/test/mochitest/browser_mozLoop_doNotDisturb.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_doNotDisturb.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This is an integration test from navigator.mozLoop through to the end
  * effects - rather than just testing MozLoopAPI alone.
  */
 
+"use strict";
+
 Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
 add_task(loadLoopPanel);
 
 add_task(function* test_mozLoop_doNotDisturb() {
   registerCleanupFunction(function () {
     Services.prefs.clearUserPref("loop.do_not_disturb");
   });
--- a/browser/components/loop/test/mochitest/browser_mozLoop_pluralStrings.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_pluralStrings.js
@@ -1,21 +1,23 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * This is an integration test from navigator.mozLoop through to the end
- * effects - rather than just testing MozLoopAPI alone.
- */
-
-Components.utils.import("resource://gre/modules/Promise.jsm", this);
-
-add_task(loadLoopPanel);
-
-add_task(function* test_mozLoop_pluralStrings() {
-  Assert.ok(gMozLoopAPI, "mozLoop should exist");
-
-  var strings = JSON.parse(gMozLoopAPI.getStrings("feedback_window_will_close_in2"));
-  Assert.equal(gMozLoopAPI.getPluralForm(0, strings.textContent),
-               "This window will close in {{countdown}} seconds");
-  Assert.equal(gMozLoopAPI.getPluralForm(1, strings.textContent),
-               "This window will close in {{countdown}} second");
-});
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * This is an integration test from navigator.mozLoop through to the end
+ * effects - rather than just testing MozLoopAPI alone.
+ */
+
+"use strict";
+
+Components.utils.import("resource://gre/modules/Promise.jsm", this);
+
+add_task(loadLoopPanel);
+
+add_task(function* test_mozLoop_pluralStrings() {
+  Assert.ok(gMozLoopAPI, "mozLoop should exist");
+
+  var strings = JSON.parse(gMozLoopAPI.getStrings("feedback_window_will_close_in2"));
+  Assert.equal(gMozLoopAPI.getPluralForm(0, strings.textContent),
+               "This window will close in {{countdown}} seconds");
+  Assert.equal(gMozLoopAPI.getPluralForm(1, strings.textContent),
+               "This window will close in {{countdown}} second");
+});
--- a/browser/components/loop/test/mochitest/browser_mozLoop_prefs.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_prefs.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This is an integration test from navigator.mozLoop through to the end
  * effects - rather than just testing MozLoopAPI alone.
  */
 
+"use strict";
+
 Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
 add_task(loadLoopPanel);
 
 add_task(function* test_mozLoop_charPref() {
   registerCleanupFunction(function () {
     Services.prefs.clearUserPref("loop.test");
   });
--- a/browser/components/loop/test/mochitest/browser_mozLoop_socialShare.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_socialShare.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This is an integration test from navigator.mozLoop through to the end
  * effects - rather than just testing MozLoopAPI alone.
  */
 
+"use strict";
+
 Cu.import("resource://gre/modules/Promise.jsm");
 const {SocialService} = Cu.import("resource://gre/modules/SocialService.jsm", {});
 
 add_task(loadLoopPanel);
 
 const kShareWidgetId = "social-share-button";
 const kShareProvider = {
   name: "provider 1",
--- a/browser/components/loop/test/mochitest/browser_mozLoop_telemetry.js
+++ b/browser/components/loop/test/mochitest/browser_mozLoop_telemetry.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /*
  * This file contains tests for the mozLoop telemetry API.
  */
+
+"use strict";
+
 Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
 add_task(loadLoopPanel);
 
 /**
  * Enable local telemetry recording for the duration of the tests.
  */
 add_task(function* test_initialize() {
--- a/browser/components/loop/test/mochitest/head.js
+++ b/browser/components/loop/test/mochitest/head.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const HAWK_TOKEN_LENGTH = 64;
 const {
   LOOP_SESSION_TYPE,
   MozLoopServiceInternal,
   MozLoopService,
 } = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
 const {LoopCalls} = Cu.import("resource:///modules/loop/LoopCalls.jsm", {});
 const {LoopRooms} = Cu.import("resource:///modules/loop/LoopRooms.jsm", {});
@@ -118,18 +120,18 @@ function loadLoopPanel(aOverrideOptions 
   registerCleanupFunction(function() {
     Services.io.offline = WAS_OFFLINE;
   });
 
   // Turn off animations to make tests quicker.
   let loopPanel = document.getElementById("loop-notification-panel");
   loopPanel.setAttribute("animate", "false");
 
-  // Now get the actual API.
-  yield promiseGetMozLoopAPI();
+  // Now get the actual API loaded into gMozLoopAPI.
+  return promiseGetMozLoopAPI();
 }
 
 function promiseOAuthParamsSetup(baseURL, params) {
   return new Promise((resolve, reject) => {
     let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
                 createInstance(Ci.nsIXMLHttpRequest);
     xhr.open("POST", baseURL + "/setup_params", true);
     xhr.setRequestHeader("X-Params", JSON.stringify(params));
@@ -314,17 +316,17 @@ const mockDb = {
       callback(new Error("No 'id' field present"));
       return;
     }
     details._guid = this._next_guid++;
     this._store[details._guid] = details;
     callback(null, details);
   },
   remove: function(guid, callback) {
-    if (!guid in this._store) {
+    if (!(guid in this._store)) {
       callback(new Error("Could not find _guid '" + guid + "' in database"));
       return;
     }
     delete this._store[guid];
     callback(null);
   },
   getAll: function(callback) {
     callback(null, this._store);
new file mode 100644
--- /dev/null
+++ b/browser/components/loop/test/xpcshell/.eslintrc
@@ -0,0 +1,17 @@
+{
+  "ecmaFeatures": {
+    "arrowFunctions": true,
+    "blockBindings": true,
+    "destructuring": true,
+    "generators": true,
+    "restParams": true,
+    "spread": true,
+    "objectLiteralShorthandMethods": true,
+  },
+  "rules": {
+    "generator-star-spacing": [2, "after"],
+    // We should fix the errors and enable this (set to 2)
+    "no-var": 0,
+    "strict": [2, "global"]
+  }
+}
--- a/browser/components/loop/test/xpcshell/head.js
+++ b/browser/components/loop/test/xpcshell/head.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Http.jsm");
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource:///modules/loop/MozLoopService.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
--- a/browser/components/loop/test/xpcshell/test_looppush_initialize.js
+++ b/browser/components/loop/test/xpcshell/test_looppush_initialize.js
@@ -1,222 +1,223 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
-{
-  let dummyCallback = () => {};
-  let mockWebSocket = new MockWebSocketChannel();
-  let pushServerRequestCount = 0;
+
+"use strict";
+
+let dummyCallback = () => {};
+let mockWebSocket = new MockWebSocketChannel();
+let pushServerRequestCount = 0;
 
-  add_test(function test_initalize_offline() {
-    Services.io.offline = true;
-    do_check_false(MozLoopPushHandler.initialize());
-    Services.io.offline = false;
-    run_next_test();
-  });
+add_test(function test_initalize_offline() {
+  Services.io.offline = true;
+  do_check_false(MozLoopPushHandler.initialize());
+  Services.io.offline = false;
+  run_next_test();
+});
 
-  add_test(function test_initalize_missing_chanid() {
-    Assert.throws(() => MozLoopPushHandler.register(null, dummyCallback, dummyCallback));
-    run_next_test();
-  });
+add_test(function test_initalize_missing_chanid() {
+  Assert.throws(() => MozLoopPushHandler.register(null, dummyCallback, dummyCallback));
+  run_next_test();
+});
 
-  add_test(function test_initalize_missing_regcallback() {
-    Assert.throws(() => MozLoopPushHandler.register("chan-1", null, dummyCallback));
-    run_next_test();
-  });
+add_test(function test_initalize_missing_regcallback() {
+  Assert.throws(() => MozLoopPushHandler.register("chan-1", null, dummyCallback));
+  run_next_test();
+});
 
-  add_test(function test_initalize_missing_notifycallback() {
-    Assert.throws(() => MozLoopPushHandler.register("chan-1", dummyCallback, null));
-    run_next_test();
-  });
+add_test(function test_initalize_missing_notifycallback() {
+  Assert.throws(() => MozLoopPushHandler.register("chan-1", dummyCallback, null));
+  run_next_test();
+});
 
-  add_test(function test_initalize_websocket() {
-    do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}));
-    MozLoopPushHandler.register(
-      "chan-1",
-      function(err, url, id) {
-        Assert.equal(err, null, "err should be null to indicate success");
-        Assert.equal(url, kEndPointUrl, "Should return push server application URL");
-        Assert.equal(id, "chan-1", "Should have channel id = chan-1");
-        Assert.equal(mockWebSocket.uri.prePath, kServerPushUrl,
-                     "Should have the url from preferences");
-        Assert.equal(mockWebSocket.origin, kServerPushUrl,
-                     "Should have the origin url from preferences");
-        Assert.equal(mockWebSocket.protocol, "push-notification",
-                     "Should have the protocol set to push-notifications");
-        mockWebSocket.notify(15);
-      },
-      function(version, id) {
-        Assert.equal(version, 15, "Should have version number 15");
-        Assert.equal(id, "chan-1", "Should have channel id = chan-1");
-        run_next_test();
-      });
-  });
+add_test(function test_initalize_websocket() {
+  do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}));
+  MozLoopPushHandler.register(
+    "chan-1",
+    function(err, url, id) {
+      Assert.equal(err, null, "err should be null to indicate success");
+      Assert.equal(url, kEndPointUrl, "Should return push server application URL");
+      Assert.equal(id, "chan-1", "Should have channel id = chan-1");
+      Assert.equal(mockWebSocket.uri.prePath, kServerPushUrl,
+                   "Should have the url from preferences");
+      Assert.equal(mockWebSocket.origin, kServerPushUrl,
+                   "Should have the origin url from preferences");
+      Assert.equal(mockWebSocket.protocol, "push-notification",
+                   "Should have the protocol set to push-notifications");
+      mockWebSocket.notify(15);
+    },
+    function(version, id) {
+      Assert.equal(version, 15, "Should have version number 15");
+      Assert.equal(id, "chan-1", "Should have channel id = chan-1");
+      run_next_test();
+    });
+});
 
-  add_test(function test_register_twice_same_channel() {
-    MozLoopPushHandler.register(
-      "chan-2",
-      function(err, url, id) {
-        Assert.equal(err, null, "Should return null for success");
-        Assert.equal(url, kEndPointUrl, "Should return push server application URL");
-        Assert.equal(id, "chan-2", "Should have channel id = chan-2");
-        Assert.equal(mockWebSocket.uri.prePath, kServerPushUrl,
-                     "Should have the url from preferences");
-        Assert.equal(mockWebSocket.origin, kServerPushUrl,
-                     "Should have the origin url from preferences");
-        Assert.equal(mockWebSocket.protocol, "push-notification",
-                     "Should have the protocol set to push-notifications");
+add_test(function test_register_twice_same_channel() {
+  MozLoopPushHandler.register(
+    "chan-2",
+    function(err, url, id) {
+      Assert.equal(err, null, "Should return null for success");
+      Assert.equal(url, kEndPointUrl, "Should return push server application URL");
+      Assert.equal(id, "chan-2", "Should have channel id = chan-2");
+      Assert.equal(mockWebSocket.uri.prePath, kServerPushUrl,
+                   "Should have the url from preferences");
+      Assert.equal(mockWebSocket.origin, kServerPushUrl,
+                   "Should have the origin url from preferences");
+      Assert.equal(mockWebSocket.protocol, "push-notification",
+                   "Should have the protocol set to push-notifications");
 
-        // Register again for the same channel
-        MozLoopPushHandler.register(
-          "chan-2",
-          function(err, url, id) {
-            Assert.equal(err, null, "Should return null for success");
-            Assert.equal(id, "chan-2", "Should have channel id = chan-2");
-            run_next_test();
-          },
-          dummyCallback
-        );
-      },
-      dummyCallback
-    );
-  });
+      // Register again for the same channel
+      MozLoopPushHandler.register(
+        "chan-2",
+        function(err, url, id) {
+          Assert.equal(err, null, "Should return null for success");
+          Assert.equal(id, "chan-2", "Should have channel id = chan-2");
+          run_next_test();
+        },
+        dummyCallback
+      );
+    },
+    dummyCallback
+  );
+});
 
-  // Test that the PushHander will re-connect after the near-end disconnect.
-  // The uaID is cleared to force re-registration of all notification channels.
-  add_test(function test_reconnect_websocket() {
-    MozLoopPushHandler.uaID = undefined;
-    mockWebSocket.stop();
-    // Previously registered onRegistration callbacks will fire and be checked (see above).
-  });
-
-  // Test that the PushHander will re-connect after the far-end disconnect.
-  // The uaID is cleared to force re-regsitration of all notification channels.
-  add_test(function test_reopen_websocket() {
-    MozLoopPushHandler.uaID = undefined;
-    MozLoopPushHandler.registeredChannels = {}; //Do this to force a new registration callback.
-    mockWebSocket.serverClose();
-    // Previously registered onRegistration callbacks will fire and be checked (see above).
-  });
+// Test that the PushHander will re-connect after the near-end disconnect.
+// The uaID is cleared to force re-registration of all notification channels.
+add_test(function test_reconnect_websocket() {
+  MozLoopPushHandler.uaID = undefined;
+  mockWebSocket.stop();
+  // Previously registered onRegistration callbacks will fire and be checked (see above).
+});
 
-  // Force a re-registration cycle and have the PushServer return a 500.
-  // A retry should occur and the registration then complete.
-  add_test(function test_retry_registration() {
-    MozLoopPushHandler.uaID = undefined;
-    mockWebSocket.initRegStatus = 500;
-    mockWebSocket.stop();
-  });
+// Test that the PushHander will re-connect after the far-end disconnect.
+// The uaID is cleared to force re-regsitration of all notification channels.
+add_test(function test_reopen_websocket() {
+  MozLoopPushHandler.uaID = undefined;
+  MozLoopPushHandler.registeredChannels = {}; //Do this to force a new registration callback.
+  mockWebSocket.serverClose();
+  // Previously registered onRegistration callbacks will fire and be checked (see above).
+});
+
+// Force a re-registration cycle and have the PushServer return a 500.
+// A retry should occur and the registration then complete.
+add_test(function test_retry_registration() {
+  MozLoopPushHandler.uaID = undefined;
+  mockWebSocket.initRegStatus = 500;
+  mockWebSocket.stop();
+});
 
-  add_test(function test_reconnect_no_registration() {
-    let regCnt = 0;
-    MozLoopPushHandler.shutdown();
-    MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
-    MozLoopPushHandler.register(
-      "test-chan",
-      function(err, url, id) {
-        Assert.equal(++regCnt, 1, "onRegistered should only be called once");
-        Assert.equal(err, null, "err should be null to indicate success");
-        Assert.equal(url, kEndPointUrl, "Should return push server application URL");
-        Assert.equal(id, "test-chan", "Should have channel id = test-chan");
-        mockWebSocket.stop();
-        setTimeout(run_next_test(), 0);
-      },
-      dummyCallback
-    );
-  });
+add_test(function test_reconnect_no_registration() {
+  let regCnt = 0;
+  MozLoopPushHandler.shutdown();
+  MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
+  MozLoopPushHandler.register(
+    "test-chan",
+    function(err, url, id) {
+      Assert.equal(++regCnt, 1, "onRegistered should only be called once");
+      Assert.equal(err, null, "err should be null to indicate success");
+      Assert.equal(url, kEndPointUrl, "Should return push server application URL");
+      Assert.equal(id, "test-chan", "Should have channel id = test-chan");
+      mockWebSocket.stop();
+      setTimeout(run_next_test(), 0);
+    },
+    dummyCallback
+  );
+});
 
-  add_test(function test_ping_websocket() {
-    let pingReceived = false,
-        socketClosed = false;
-    mockWebSocket.defaultMsgHandler = (msg) => {
-      pingReceived = true;
-      // Do not send a ping response.
-    }
-    mockWebSocket.close = () => {
-      socketClosed = true;
-    }
+add_test(function test_ping_websocket() {
+  let pingReceived = false,
+      socketClosed = false;
+  mockWebSocket.defaultMsgHandler = (msg) => {
+    pingReceived = true;
+    // Do not send a ping response.
+  }
+  mockWebSocket.close = () => {
+    socketClosed = true;
+  }
 
-    MozLoopPushHandler.shutdown();
-    MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
-    MozLoopPushHandler.register(
-      "test-chan",
-      function(err, url) {
-        Assert.equal(err, null, "err should be null to indicate success");
-        waitForCondition(() => pingReceived).then(() => {
-          waitForCondition(() => socketClosed).then(() => {
-            run_next_test();
-          }, () => {
-            do_throw("should have closed the websocket");
-          });
+  MozLoopPushHandler.shutdown();
+  MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket});
+  MozLoopPushHandler.register(
+    "test-chan",
+    function(err, url) {
+      Assert.equal(err, null, "err should be null to indicate success");
+      waitForCondition(() => pingReceived).then(() => {
+        waitForCondition(() => socketClosed).then(() => {
+          run_next_test();
         }, () => {
-          do_throw("should have sent ping");
+          do_throw("should have closed the websocket");
         });
-      },
-      dummyCallback
-    );
-  });
+      }, () => {
+        do_throw("should have sent ping");
+      });
+    },
+    dummyCallback
+  );
+});
 
-  add_test(function test_retry_pushurl() {
-    MozLoopPushHandler.shutdown();
-    loopServer.registerPathHandler("/push-server-config", (request, response) => {
-      // The PushHandler should retry the request for the push-server-config for
-      // each of these cases without throwing an error.
-      let n = 0;
-      switch (++pushServerRequestCount) {
-      case ++n:
-        // Non-200 response
-        response.setStatusLine(null, 500, "Retry");
-        response.processAsync();
-        response.finish();
-        break;
-      case ++n:
-        // missing parameter
-        response.setStatusLine(null, 200, "OK");
-        response.write(JSON.stringify({pushServerURI: null}));
-        response.processAsync();
-        response.finish();
-        break;
-      case ++n:
-        // json parse error
-        response.setStatusLine(null, 200, "OK");
-        response.processAsync();
-        response.finish();
-        break;
-      case ++n:
-        response.setStatusLine(null, 200, "OK");
-        response.write(JSON.stringify({pushServerURI: kServerPushUrl}));
-        response.processAsync();
-        response.finish();
-
-        run_next_test();
-        break;
-      }
-    });
-
-    do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}));
-  });
-
-  function run_test() {
-    setupFakeLoopServer();
-
-    loopServer.registerPathHandler("/push-server-config", (request, response) => {
+add_test(function test_retry_pushurl() {
+  MozLoopPushHandler.shutdown();
+  loopServer.registerPathHandler("/push-server-config", (request, response) => {
+    // The PushHandler should retry the request for the push-server-config for
+    // each of these cases without throwing an error.
+    let n = 0;
+    switch (++pushServerRequestCount) {
+    case ++n:
+      // Non-200 response
+      response.setStatusLine(null, 500, "Retry");
+      response.processAsync();
+      response.finish();
+      break;
+    case ++n:
+      // missing parameter
+      response.setStatusLine(null, 200, "OK");
+      response.write(JSON.stringify({pushServerURI: null}));
+      response.processAsync();
+      response.finish();
+      break;
+    case ++n:
+      // json parse error
+      response.setStatusLine(null, 200, "OK");
+      response.processAsync();
+      response.finish();
+      break;
+    case ++n:
       response.setStatusLine(null, 200, "OK");
       response.write(JSON.stringify({pushServerURI: kServerPushUrl}));
       response.processAsync();
       response.finish();
-    });
+
+      run_next_test();
+      break;
+    }
+  });
 
-    Services.prefs.setCharPref("services.push.serverURL", kServerPushUrl);
-    Services.prefs.setIntPref("loop.retry_delay.start", 10); // 10 ms
-    Services.prefs.setIntPref("loop.retry_delay.limit", 20); // 20 ms
-    Services.prefs.setIntPref("loop.ping.interval", 50); // 50 ms
-    Services.prefs.setIntPref("loop.ping.timeout", 20); // 20 ms
+  do_check_true(MozLoopPushHandler.initialize({mockWebSocket: mockWebSocket}));
+});
+
+function run_test() {
+  setupFakeLoopServer();
 
-    do_register_cleanup(function() {
-      Services.prefs.clearUserPref("services.push.serverULR");
-      Services.prefs.clearUserPref("loop.retry_delay.start");
-      Services.prefs.clearUserPref("loop.retry_delay.limit");
-      Services.prefs.clearUserPref("loop.ping.interval");
-      Services.prefs.clearUserPref("loop.ping.timeout");
-    });
+  loopServer.registerPathHandler("/push-server-config", (request, response) => {
+    response.setStatusLine(null, 200, "OK");
+    response.write(JSON.stringify({pushServerURI: kServerPushUrl}));
+    response.processAsync();
+    response.finish();
+  });
 
-    run_next_test();
-  };
-}
+  Services.prefs.setCharPref("services.push.serverURL", kServerPushUrl);
+  Services.prefs.setIntPref("loop.retry_delay.start", 10); // 10 ms
+  Services.prefs.setIntPref("loop.retry_delay.limit", 20); // 20 ms
+  Services.prefs.setIntPref("loop.ping.interval", 50); // 50 ms
+  Services.prefs.setIntPref("loop.ping.timeout", 20); // 20 ms
+
+  do_register_cleanup(function() {
+    Services.prefs.clearUserPref("services.push.serverULR");
+    Services.prefs.clearUserPref("loop.retry_delay.start");
+    Services.prefs.clearUserPref("loop.retry_delay.limit");
+    Services.prefs.clearUserPref("loop.ping.interval");
+    Services.prefs.clearUserPref("loop.ping.timeout");
+  });
+
+  run_next_test();
+};
--- a/browser/components/loop/test/xpcshell/test_looprooms.js
+++ b/browser/components/loop/test/xpcshell/test_looprooms.js
@@ -1,12 +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/. */
 
+"use strict";
+
 Cu.import("resource://services-common/utils.js");
 Cu.import("resource:///modules/loop/LoopRooms.jsm");
 Cu.import("resource:///modules/Chat.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 
 let openChatOrig = Chat.open;
 
 const kContextEnabledPref = "loop.contextInConverations.enabled";
--- a/browser/components/loop/test/xpcshell/test_loopservice_busy.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_busy.js
@@ -1,12 +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/. */
 
+"use strict";
+
 const { LoopCallsInternal } = Cu.import("resource:///modules/loop/LoopCalls.jsm", {});
 
 XPCOMUtils.defineLazyModuleGetter(this, "Chat",
                                   "resource:///modules/Chat.jsm");
 
 let actionReceived = false;
 let openChatOrig = Chat.open;
 
--- a/browser/components/loop/test/xpcshell/test_loopservice_directcall.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_directcall.js
@@ -1,12 +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/. */
 
+"use strict";
+
 XPCOMUtils.defineLazyModuleGetter(this, "Chat",
                                   "resource:///modules/Chat.jsm");
 let openChatOrig = Chat.open;
 
 const contact = {
   name: [ "Mr Smith" ],
   email: [{
     type: "home",
--- a/browser/components/loop/test/xpcshell/test_loopservice_dnd.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_dnd.js
@@ -1,12 +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/. */
 
+"use strict";
+
 XPCOMUtils.defineLazyModuleGetter(this, "Chat",
                                   "resource:///modules/Chat.jsm");
 let openChatOrig = Chat.open;
 
 add_test(function test_get_do_not_disturb() {
   Services.prefs.setBoolPref("loop.do_not_disturb", false);
 
   do_check_false(MozLoopService.doNotDisturb);
@@ -36,17 +38,17 @@ add_test(function test_do_not_disturb_di
   MozLoopService.promiseRegisteredWithServers(LOOP_SESSION_TYPE.FXA).then(() => {
     let opened = false;
     Chat.open = function() {
       opened = true;
     };
 
     mockPushHandler.notify(1, MozLoopService.channelIDs.callsFxA);
 
-    waitForCondition(function() opened).then(() => {
+    waitForCondition(() => opened).then(() => {
       run_next_test();
     }, () => {
       do_throw("should have opened a chat window");
     });
   });
 });
 
 add_test(function test_do_not_disturb_enabled_shouldnt_open_chat_window() {
--- a/browser/components/loop/test/xpcshell/test_loopservice_encryptionkey.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_encryptionkey.js
@@ -1,12 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/ */
 /* global Services, Assert */
 
+"use strict";
+
 const kGuestKeyPref = "loop.key";
 const kFxAKeyPref = "loop.key.fxa";
 
 do_register_cleanup(function() {
   Services.prefs.clearUserPref(kGuestKeyPref);
   MozLoopServiceInternal.fxAOAuthTokenData = null;
   MozLoopServiceInternal.fxAOAuthProfile = null;
 });
--- a/browser/components/loop/test/xpcshell/test_loopservice_initialize.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_initialize.js
@@ -1,18 +1,20 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 let startTimerCalled = false;
 
 /**
  * Tests that registration doesn't happen when the expiry time is
  * not set.
  */
-add_task(function test_initialize_no_expiry() {
+add_task(function* test_initialize_no_expiry() {
   startTimerCalled = false;
 
   let initializedPromise = yield MozLoopService.initialize();
   Assert.equal(initializedPromise, "registration not needed",
                "Promise should be fulfilled");
   Assert.equal(startTimerCalled, false,
     "should not register when no expiry time is set");
 });
--- a/browser/components/loop/test/xpcshell/test_loopservice_locales.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_locales.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 function test_locale() {
   // Set the pref to something controlled.
   Services.prefs.setCharPref("general.useragent.locale", "ab-CD");
 
   Assert.equal(MozLoopService.locale, "ab-CD");
 
   Services.prefs.clearUserPref("general.useragent.locale");
 }
--- a/browser/components/loop/test/xpcshell/test_loopservice_loop_prefs.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_loop_prefs.js
@@ -1,12 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/ */
 /*global XPCOMUtils, Services, Assert */
 
+"use strict";
+
 var fakeCharPrefName = "color";
 var fakeBoolPrefName = "boolean";
 var fakePrefValue = "green";
 
 function test_getLoopPref()
 {
   Services.prefs.setCharPref("loop." + fakeCharPrefName, fakePrefValue);
 
--- a/browser/components/loop/test/xpcshell/test_loopservice_notification.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_notification.js
@@ -1,12 +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/. */
 
+"use strict";
+
 XPCOMUtils.defineLazyModuleGetter(this, "Chat",
                                   "resource:///modules/Chat.jsm");
 
 let openChatOrig = Chat.open;
 
 add_test(function test_openChatWindow_on_notification() {
   Services.prefs.setCharPref("loop.seenToS", "unseen");
 
@@ -15,17 +17,17 @@ add_test(function test_openChatWindow_on
   MozLoopService.promiseRegisteredWithServers(LOOP_SESSION_TYPE.FXA).then(() => {
     let opened = false;
     Chat.open = function() {
       opened = true;
     };
 
     mockPushHandler.notify(1, MozLoopService.channelIDs.callsFxA);
 
-    waitForCondition(function() opened).then(() => {
+    waitForCondition(() => opened).then(() => {
       do_check_true(opened, "should open a chat window");
 
       do_check_eq(Services.prefs.getCharPref("loop.seenToS"), "seen",
                   "should set the pref to 'seen'");
 
       run_next_test();
     }, () => {
       do_throw("should have opened a chat window");
--- a/browser/components/loop/test/xpcshell/test_loopservice_registration.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_registration.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 Cu.import("resource://services-common/utils.js");
 
 /**
  * This file is to test general registration. Note that once successful
  * registration has taken place, we can no longer test the server side
  * parts as the service protects against this, hence, they need testing in
  * other test files.
  */
--- a/browser/components/loop/test/xpcshell/test_loopservice_registration_retry.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_registration_retry.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/utils.js");
 
 /**
  * Tests that it's possible to retry registration after an error.
  */
 
 add_test(function test_retry_after_failed_push_reg() {
--- a/browser/components/loop/test/xpcshell/test_loopservice_restart.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_restart.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const FAKE_FXA_TOKEN_DATA = JSON.stringify({
   "token_type": "bearer",
   "access_token": "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1752",
   "scope": "profile"
 });
 const FAKE_FXA_PROFILE = JSON.stringify({
   "email": "test@example.com",
   "uid": "999999994d9f4b08a2cbfc0999999999",
@@ -15,47 +17,47 @@ const LOOP_FXA_TOKEN_PREF = "loop.fxa_oa
 const LOOP_FXA_PROFILE_PREF = "loop.fxa_oauth.profile";
 const LOOP_CREATED_ROOM_PREF = "loop.createdRoom";
 const LOOP_INITIAL_DELAY_PREF = "loop.initialDelay";
 
 /**
  * This file is to test restart+reauth.
  */
 
-add_task(function test_initialize_with_no_guest_rooms_and_no_auth_token() {
+add_task(function* test_initialize_with_no_guest_rooms_and_no_auth_token() {
   // Set time to be 2 seconds in the past.
   var nowSeconds = Date.now() / 1000;
   Services.prefs.setBoolPref(LOOP_CREATED_ROOM_PREF, false);
   Services.prefs.clearUserPref(LOOP_FXA_TOKEN_PREF);
 
   yield MozLoopService.initialize().then((msg) => {
     Assert.equal(msg, "registration not needed", "Initialize should not register when the " +
                                                  "URLs are expired and there are no auth tokens");
   }, (error) => {
     Assert.ok(false, error, "should have resolved the promise that initialize returned");
   });
 });
 
-add_task(function test_initialize_with_created_room_and_no_auth_token() {
+add_task(function* test_initialize_with_created_room_and_no_auth_token() {
   Services.prefs.setBoolPref(LOOP_CREATED_ROOM_PREF, true);
   Services.prefs.clearUserPref(LOOP_FXA_TOKEN_PREF);
 
   loopServer.registerPathHandler("/registration", (request, response) => {
     response.setStatusLine(null, 200, "OK");
   });
 
   yield MozLoopService.initialize().then((msg) => {
     Assert.equal(msg, "initialized without FxA status", "Initialize should register as a " +
                                                      "guest when no auth tokens but expired URLs");
   }, (error) => {
     Assert.ok(false, error, "should have resolved the promise that initialize returned");
   });
 });
 
-add_task(function test_initialize_with_invalid_fxa_token() {
+add_task(function* test_initialize_with_invalid_fxa_token() {
   Services.prefs.setCharPref(LOOP_FXA_PROFILE_PREF, FAKE_FXA_PROFILE);
   Services.prefs.setCharPref(LOOP_FXA_TOKEN_PREF, FAKE_FXA_TOKEN_DATA);
 
   // Only need to implement the FxA registration because the previous
   // test registered as a guest.
   loopServer.registerPathHandler("/registration", (request, response) => {
     response.setStatusLine(null, 401, "Unauthorized");
     response.write(JSON.stringify({
@@ -78,17 +80,17 @@ add_task(function test_initialize_with_i
     Assert.ok(MozLoopServiceInternal.errors.has("login"),
               "Initialization error should have been reported to UI");
     Assert.ok(MozLoopServiceInternal.errors.has("login"));
     Assert.ok(MozLoopServiceInternal.errors.get("login").friendlyDetailsButtonCallback,
               "Check that there is a retry callback");
   });
 });
 
-add_task(function test_initialize_with_fxa_token() {
+add_task(function* test_initialize_with_fxa_token() {
   Services.prefs.setCharPref(LOOP_FXA_PROFILE_PREF, FAKE_FXA_PROFILE);
   Services.prefs.setCharPref(LOOP_FXA_TOKEN_PREF, FAKE_FXA_TOKEN_DATA);
 
   MozLoopService.errors.clear();
 
   loopServer.registerPathHandler("/registration", (request, response) => {
     response.setStatusLine(null, 200, "OK");
   });
--- a/browser/components/loop/test/xpcshell/test_loopservice_token_invalid.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_token_invalid.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 const LOOP_HAWK_PREF = "loop.hawk-session-token";
 const fakeSessionToken1 = "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1751";
 const fakeSessionToken2 = "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1750";
 
 add_test(function test_registration_invalid_token() {
   Services.prefs.setCharPref(LOOP_HAWK_PREF, fakeSessionToken1);
   var authorizationAttempts = 0;
 
--- a/browser/components/loop/test/xpcshell/test_loopservice_token_save.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_token_save.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 /**
  * Test that things behave reasonably when a reasonable Hawk-Session-Token
  * header is returned with the registration response.
  */
 add_test(function test_registration_returns_hawk_session_token() {
   var fakeSessionToken = "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1750";
   Services.prefs.clearUserPref("loop.hawk-session-token");
 
--- a/browser/components/loop/test/xpcshell/test_loopservice_token_send.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_token_send.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 add_test(function test_registration_uses_hawk_session_token() {
   Services.prefs.setCharPref("loop.hawk-session-token",
     "1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1750");
 
   loopServer.registerPathHandler("/registration", (request, response) => {
     // Check that we have an Authorization header with the correct bits. The
     // translation of values are tested in different modules, for the components
     // that we use.
--- a/browser/components/loop/test/xpcshell/test_loopservice_token_validation.js
+++ b/browser/components/loop/test/xpcshell/test_loopservice_token_validation.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+"use strict";
+
 // XXX should report error if Hawk-Session-Token is lexically invalid
 // (not a string of 64 hex digits) to help resist other possible injection
 // attacks.  For now, however, we're just checking if it's the right length.
 add_test(function test_registration_handles_bogus_hawk_token() {
 
   var wrongSizeToken = "jdkasjkasjdlaksj";
   Services.prefs.clearUserPref("loop.hawk-session-token");