Bug 1561435 - Format services/, a=automatic-formatting
authorVictor Porof <vporof@mozilla.com>
Fri, 05 Jul 2019 10:58:22 +0200
changeset 544264 854373e1ab9e7a438d9a666d76d4cfd227a7e0ae
parent 544263 6ceb52b9a600947561a2f5495bbac8c262003e81
child 544265 dcd5e22d383858713ce4e73bfd66fb277fa87b5b
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatic-formatting
bugs1561435
milestone69.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 1561435 - Format services/, a=automatic-formatting # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35930
.eslintrc.js
.prettierignore
services/common/async.js
services/common/hawkclient.js
services/common/hawkrequest.js
services/common/kinto-storage-adapter.js
services/common/logmanager.js
services/common/modules-testing/logging.js
services/common/observers.js
services/common/rest.js
services/common/tests/unit/head_global.js
services/common/tests/unit/head_helpers.js
services/common/tests/unit/head_http.js
services/common/tests/unit/test_async_chain.js
services/common/tests/unit/test_async_foreach.js
services/common/tests/unit/test_hawkclient.js
services/common/tests/unit/test_hawkrequest.js
services/common/tests/unit/test_kinto.js
services/common/tests/unit/test_load_modules.js
services/common/tests/unit/test_logmanager.js
services/common/tests/unit/test_observers.js
services/common/tests/unit/test_restrequest.js
services/common/tests/unit/test_storage_adapter.js
services/common/tests/unit/test_storage_adapter_shutdown.js
services/common/tests/unit/test_tokenauthenticatedrequest.js
services/common/tests/unit/test_tokenserverclient.js
services/common/tests/unit/test_uptake_telemetry.js
services/common/tests/unit/test_utils_convert_string.js
services/common/tests/unit/test_utils_dateprefs.js
services/common/tests/unit/test_utils_encodeBase32.js
services/common/tests/unit/test_utils_ensureMillisecondsTimestamp.js
services/common/tests/unit/test_utils_json.js
services/common/tests/unit/test_utils_namedTimer.js
services/common/tokenserverclient.js
services/common/uptake-telemetry.js
services/common/utils.js
services/crypto/modules/WeaveCrypto.js
services/crypto/modules/jwcrypto.jsm
services/crypto/modules/utils.js
services/crypto/tests/unit/head_helpers.js
services/crypto/tests/unit/test_crypto_crypt.js
services/crypto/tests/unit/test_crypto_random.js
services/crypto/tests/unit/test_crypto_service.js
services/crypto/tests/unit/test_jwcrypto.js
services/crypto/tests/unit/test_load_modules.js
services/crypto/tests/unit/test_utils_hawk.js
services/crypto/tests/unit/test_utils_httpmac.js
services/fxaccounts/Credentials.jsm
services/fxaccounts/FxAccounts.jsm
services/fxaccounts/FxAccountsClient.jsm
services/fxaccounts/FxAccountsCommands.js
services/fxaccounts/FxAccountsCommon.js
services/fxaccounts/FxAccountsConfig.jsm
services/fxaccounts/FxAccountsOAuthGrantClient.jsm
services/fxaccounts/FxAccountsPairing.jsm
services/fxaccounts/FxAccountsProfile.jsm
services/fxaccounts/FxAccountsProfileClient.jsm
services/fxaccounts/FxAccountsPush.jsm
services/fxaccounts/FxAccountsStorage.jsm
services/fxaccounts/FxAccountsWebChannel.jsm
services/fxaccounts/tests/browser/browser_device_connected.js
services/fxaccounts/tests/browser/browser_verify_login.js
services/fxaccounts/tests/browser/head.js
services/fxaccounts/tests/xpcshell/head.js
services/fxaccounts/tests/xpcshell/test_accounts.js
services/fxaccounts/tests/xpcshell/test_accounts_config.js
services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js
services/fxaccounts/tests/xpcshell/test_client.js
services/fxaccounts/tests/xpcshell/test_commands.js
services/fxaccounts/tests/xpcshell/test_credentials.js
services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js
services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js
services/fxaccounts/tests/xpcshell/test_oauth_grant_client_server.js
services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js
services/fxaccounts/tests/xpcshell/test_oauth_tokens.js
services/fxaccounts/tests/xpcshell/test_pairing.js
services/fxaccounts/tests/xpcshell/test_profile.js
services/fxaccounts/tests/xpcshell/test_profile_client.js
services/fxaccounts/tests/xpcshell/test_push_service.js
services/fxaccounts/tests/xpcshell/test_storage_manager.js
services/fxaccounts/tests/xpcshell/test_web_channel.js
services/settings/Attachments.jsm
services/settings/RemoteSettingsClient.jsm
services/settings/RemoteSettingsComponents.jsm
services/settings/RemoteSettingsWorker.js
services/settings/RemoteSettingsWorker.jsm
services/settings/Utils.jsm
services/settings/remote-settings.js
services/settings/test/unit/test_attachments_downloader.js
services/settings/test/unit/test_remote_settings.js
services/settings/test/unit/test_remote_settings_jexl_filters.js
services/settings/test/unit/test_remote_settings_poll.js
services/settings/test/unit/test_remote_settings_signatures.js
services/settings/test/unit/test_remote_settings_worker.js
services/sync/Weave.jsm
services/sync/modules-testing/fakeservices.js
services/sync/modules-testing/fxa_utils.js
services/sync/modules-testing/rotaryengine.js
services/sync/modules-testing/utils.js
services/sync/modules/SyncDisconnect.jsm
services/sync/modules/SyncedTabs.jsm
services/sync/modules/UIState.jsm
services/sync/modules/addonsreconciler.js
services/sync/modules/addonutils.js
services/sync/modules/bookmark_repair.js
services/sync/modules/bookmark_validator.js
services/sync/modules/browserid_identity.js
services/sync/modules/collection_repair.js
services/sync/modules/collection_validator.js
services/sync/modules/doctor.js
services/sync/modules/engines.js
services/sync/modules/engines/addons.js
services/sync/modules/engines/bookmarks.js
services/sync/modules/engines/clients.js
services/sync/modules/engines/extension-storage.js
services/sync/modules/engines/forms.js
services/sync/modules/engines/history.js
services/sync/modules/engines/passwords.js
services/sync/modules/engines/prefs.js
services/sync/modules/engines/tabs.js
services/sync/modules/keys.js
services/sync/modules/main.js
services/sync/modules/policies.js
services/sync/modules/record.js
services/sync/modules/resource.js
services/sync/modules/service.js
services/sync/modules/stages/declined.js
services/sync/modules/stages/enginesync.js
services/sync/modules/status.js
services/sync/modules/telemetry.js
services/sync/modules/util.js
services/sync/tests/tps/test_addon_reconciling.js
services/sync/tests/tps/test_addon_restartless_xpi.js
services/sync/tests/tps/test_addon_webext_xpi.js
services/sync/tests/tps/test_addon_wipe.js
services/sync/tests/tps/test_addresses.js
services/sync/tests/tps/test_bookmark_conflict.js
services/sync/tests/tps/test_bookmarks_in_same_named_folder.js
services/sync/tests/tps/test_bug501528.js
services/sync/tests/tps/test_bug530717.js
services/sync/tests/tps/test_bug531489.js
services/sync/tests/tps/test_bug535326.js
services/sync/tests/tps/test_bug538298.js
services/sync/tests/tps/test_bug546807.js
services/sync/tests/tps/test_bug556509.js
services/sync/tests/tps/test_bug562515.js
services/sync/tests/tps/test_bug575423.js
services/sync/tests/tps/test_client_wipe.js
services/sync/tests/tps/test_creditcards.js
services/sync/tests/tps/test_existing_bookmarks.js
services/sync/tests/tps/test_formdata.js
services/sync/tests/tps/test_history.js
services/sync/tests/tps/test_history_collision.js
services/sync/tests/tps/test_passwords.js
services/sync/tests/tps/test_prefs.js
services/sync/tests/tps/test_privbrw_passwords.js
services/sync/tests/tps/test_privbrw_tabs.js
services/sync/tests/tps/test_special_tabs.js
services/sync/tests/tps/test_sync.js
services/sync/tests/tps/test_tabs.js
services/sync/tests/unit/head_appinfo.js
services/sync/tests/unit/head_errorhandler_common.js
services/sync/tests/unit/head_helpers.js
services/sync/tests/unit/head_http_server.js
services/sync/tests/unit/test_412.js
services/sync/tests/unit/test_addon_utils.js
services/sync/tests/unit/test_addons_engine.js
services/sync/tests/unit/test_addons_reconciler.js
services/sync/tests/unit/test_addons_store.js
services/sync/tests/unit/test_addons_tracker.js
services/sync/tests/unit/test_addons_validator.js
services/sync/tests/unit/test_bookmark_batch_fail.js
services/sync/tests/unit/test_bookmark_decline_undecline.js
services/sync/tests/unit/test_bookmark_duping.js
services/sync/tests/unit/test_bookmark_engine.js
services/sync/tests/unit/test_bookmark_invalid.js
services/sync/tests/unit/test_bookmark_order.js
services/sync/tests/unit/test_bookmark_places_query_rewriting.js
services/sync/tests/unit/test_bookmark_record.js
services/sync/tests/unit/test_bookmark_repair.js
services/sync/tests/unit/test_bookmark_repair_requestor.js
services/sync/tests/unit/test_bookmark_repair_responder.js
services/sync/tests/unit/test_bookmark_store.js
services/sync/tests/unit/test_bookmark_tracker.js
services/sync/tests/unit/test_bookmark_validator.js
services/sync/tests/unit/test_browserid_identity.js
services/sync/tests/unit/test_browserid_identity_telemetry.js
services/sync/tests/unit/test_clients_engine.js
services/sync/tests/unit/test_clients_escape.js
services/sync/tests/unit/test_collection_getBatched.js
services/sync/tests/unit/test_collections_recovery.js
services/sync/tests/unit/test_corrupt_keys.js
services/sync/tests/unit/test_declined.js
services/sync/tests/unit/test_disconnect_shutdown.js
services/sync/tests/unit/test_doctor.js
services/sync/tests/unit/test_engine.js
services/sync/tests/unit/test_engine_abort.js
services/sync/tests/unit/test_engine_changes_during_sync.js
services/sync/tests/unit/test_enginemanager.js
services/sync/tests/unit/test_errorhandler_1.js
services/sync/tests/unit/test_errorhandler_2.js
services/sync/tests/unit/test_errorhandler_filelog.js
services/sync/tests/unit/test_errorhandler_sync_checkServerError.js
services/sync/tests/unit/test_extension_storage_engine.js
services/sync/tests/unit/test_extension_storage_tracker.js
services/sync/tests/unit/test_form_validator.js
services/sync/tests/unit/test_forms_store.js
services/sync/tests/unit/test_forms_tracker.js
services/sync/tests/unit/test_fxa_node_reassignment.js
services/sync/tests/unit/test_fxa_service_cluster.js
services/sync/tests/unit/test_history_engine.js
services/sync/tests/unit/test_history_store.js
services/sync/tests/unit/test_history_tracker.js
services/sync/tests/unit/test_hmac_error.js
services/sync/tests/unit/test_httpd_sync_server.js
services/sync/tests/unit/test_interval_triggers.js
services/sync/tests/unit/test_keys.js
services/sync/tests/unit/test_node_reassignment.js
services/sync/tests/unit/test_password_engine.js
services/sync/tests/unit/test_password_store.js
services/sync/tests/unit/test_password_tracker.js
services/sync/tests/unit/test_password_validator.js
services/sync/tests/unit/test_postqueue.js
services/sync/tests/unit/test_prefs_store.js
services/sync/tests/unit/test_prefs_tracker.js
services/sync/tests/unit/test_records_crypto.js
services/sync/tests/unit/test_records_wbo.js
services/sync/tests/unit/test_resource.js
services/sync/tests/unit/test_resource_header.js
services/sync/tests/unit/test_resource_ua.js
services/sync/tests/unit/test_score_triggers.js
services/sync/tests/unit/test_service_attributes.js
services/sync/tests/unit/test_service_cluster.js
services/sync/tests/unit/test_service_detect_upgrade.js
services/sync/tests/unit/test_service_login.js
services/sync/tests/unit/test_service_startOver.js
services/sync/tests/unit/test_service_startup.js
services/sync/tests/unit/test_service_sync_401.js
services/sync/tests/unit/test_service_sync_locked.js
services/sync/tests/unit/test_service_sync_remoteSetup.js
services/sync/tests/unit/test_service_sync_specified.js
services/sync/tests/unit/test_service_sync_updateEnabledEngines.js
services/sync/tests/unit/test_service_verifyLogin.js
services/sync/tests/unit/test_service_wipeClient.js
services/sync/tests/unit/test_service_wipeServer.js
services/sync/tests/unit/test_status.js
services/sync/tests/unit/test_status_checkSetup.js
services/sync/tests/unit/test_syncedtabs.js
services/sync/tests/unit/test_syncengine.js
services/sync/tests/unit/test_syncengine_sync.js
services/sync/tests/unit/test_syncscheduler.js
services/sync/tests/unit/test_tab_engine.js
services/sync/tests/unit/test_tab_store.js
services/sync/tests/unit/test_tab_tracker.js
services/sync/tests/unit/test_telemetry.js
services/sync/tests/unit/test_tracker_addChanged.js
services/sync/tests/unit/test_uistate.js
services/sync/tests/unit/test_utils_catch.js
services/sync/tests/unit/test_utils_deepEquals.js
services/sync/tests/unit/test_utils_deferGetSet.js
services/sync/tests/unit/test_utils_json.js
services/sync/tests/unit/test_utils_keyEncoding.js
services/sync/tests/unit/test_utils_lock.js
services/sync/tests/unit/test_utils_makeGUID.js
services/sync/tests/unit/test_utils_misc.js
services/sync/tests/unit/test_utils_passphrase.js
services/sync/tps/extensions/tps/api.js
services/sync/tps/extensions/tps/resource/auth/fxaccounts.jsm
services/sync/tps/extensions/tps/resource/logger.jsm
services/sync/tps/extensions/tps/resource/modules/addons.jsm
services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm
services/sync/tps/extensions/tps/resource/modules/formautofill.jsm
services/sync/tps/extensions/tps/resource/modules/forms.jsm
services/sync/tps/extensions/tps/resource/modules/history.jsm
services/sync/tps/extensions/tps/resource/modules/passwords.jsm
services/sync/tps/extensions/tps/resource/modules/prefs.jsm
services/sync/tps/extensions/tps/resource/modules/tabs.jsm
services/sync/tps/extensions/tps/resource/modules/windows.jsm
services/sync/tps/extensions/tps/resource/quit.js
services/sync/tps/extensions/tps/resource/tps.jsm
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -40,17 +40,16 @@ module.exports = {
     "plugin:mozilla/recommended"
   ],
   "plugins": [
     "mozilla"
   ],
   "overrides": [{
       "files": [
         "devtools/**",
-        "services/**",
         "servo/**",
         "startupcache/**",
         "storage/**",
         "taskcluster/**",
         "testing/**",
         "toolkit/**",
         "tools/**",
         "uriloader/**",
--- a/.prettierignore
+++ b/.prettierignore
@@ -35,17 +35,16 @@ security/manager/ssl/security-prefs.js
 services/common/services-common.js
 services/sync/services-sync.js
 services/sync/tests/unit/prefs_test_prefs_store.js
 testing/marionette/prefs/marionette.js
 toolkit/components/telemetry/datareporting-prefs.js
 toolkit/components/telemetry/healthreport-prefs.js
 
 # Ignore all top-level directories for now.
-services/**
 servo/**
 startupcache/**
 storage/**
 taskcluster/**
 testing/**
 toolkit/**
 tools/**
 uriloader/**
--- a/services/common/async.js
+++ b/services/common/async.js
@@ -1,21 +1,20 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["Async"];
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /*
  * Helpers for various async operations.
  */
 var Async = {
-
   /**
    * Execute an arbitrary number of asynchronous functions one after the
    * other, passing the callback arguments on to the next one.  All functions
    * must take a callback function as their last argument.  The 'this' object
    * will be whatever chain()'s is.
    *
    * @usage this._chain = Async.chain;
    *        this._chain(this.foo, this.bar, this.baz)(args, for, foo)
@@ -44,23 +43,28 @@ var Async = {
    * Check if the app is still ready (not quitting). Returns true, or throws an
    * exception if not ready.
    */
   checkAppReady: function checkAppReady() {
     // Watch for app-quit notification to stop any sync calls
     Services.obs.addObserver(function onQuitApplication() {
       Services.obs.removeObserver(onQuitApplication, "quit-application");
       Async.checkAppReady = Async.promiseYield = function() {
-        let exception = Components.Exception("App. Quitting", Cr.NS_ERROR_ABORT);
+        let exception = Components.Exception(
+          "App. Quitting",
+          Cr.NS_ERROR_ABORT
+        );
         exception.appIsShuttingDown = true;
         throw exception;
       };
     }, "quit-application");
     // In the common case, checkAppReady just returns true
-    return (Async.checkAppReady = function() { return true; })();
+    return (Async.checkAppReady = function() {
+      return true;
+    })();
   },
 
   /**
    * Check if the app is still ready (not quitting). Returns true if the app
    * is ready, or false if it is being shut down.
    */
   isAppReady() {
     try {
@@ -130,17 +134,20 @@ var Async = {
    * @param [yieldEvery = 50] {number|object}
    *        The number of iterations to complete before yielding back to the event
    *        loop.
    *
    * @return {boolean}
    *         Whether or not the function returned early.
    */
   async yieldingForEach(iterable, fn, yieldEvery = 50) {
-    const yieldState = typeof yieldEvery === "number" ? Async.yieldState(yieldEvery) : yieldEvery;
+    const yieldState =
+      typeof yieldEvery === "number"
+        ? Async.yieldState(yieldEvery)
+        : yieldEvery;
     let iteration = 0;
 
     for (const item of iterable) {
       let result = fn(item, iteration++);
       if (typeof result !== "undefined" && typeof result.then !== "undefined") {
         // If we await result when it is not a Promise, we create an
         // automatically resolved promise, which is exactly the case that we
         // are trying to avoid.
@@ -173,17 +180,20 @@ var Async = {
  * Allows consumers to enqueue asynchronous callbacks to be called in order.
  * Typically this is used when providing a callback to a caller that doesn't
  * await on promises.
  */
 class AsyncQueueCaller {
   constructor(log) {
     this._log = log;
     this._queue = Promise.resolve();
-    this.QueryInterface = ChromeUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]);
+    this.QueryInterface = ChromeUtils.generateQI([
+      Ci.nsIObserver,
+      Ci.nsISupportsWeakReference,
+    ]);
   }
 
   /**
    * /!\ Never await on another function that calls enqueueCall /!\
    *     on the same queue or we will deadlock.
    */
   enqueueCall(func) {
     this._queue = (async () => {
--- a/services/common/hawkclient.js
+++ b/services/common/hawkclient.js
@@ -21,21 +21,27 @@
  * clock delta on the client vs the server.  The library provides an interface
  * for deriving HAWK credentials and making HAWK-authenticated REST requests to
  * a single remote server.  Therefore, callers who want to interact with
  * multiple HAWK services should instantiate one HawkClient per service.
  */
 
 var EXPORTED_SYMBOLS = ["HawkClient"];
 
-const {HAWKAuthenticatedRESTRequest} = ChromeUtils.import("resource://services-common/hawkrequest.js");
-const {Observers} = ChromeUtils.import("resource://services-common/observers.js");
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { HAWKAuthenticatedRESTRequest } = ChromeUtils.import(
+  "resource://services-common/hawkrequest.js"
+);
+const { Observers } = ChromeUtils.import(
+  "resource://services-common/observers.js"
+);
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 // log.appender.dump should be one of "Fatal", "Error", "Warn", "Info", "Config",
 // "Debug", "Trace" or "All". If none is specified, "Error" will be used by
 // default.
 // Note however that Sync will also add this log to *its* DumpAppender, so
 // in a Sync context it shouldn't be necessary to adjust this - however, that
 // also means error logs are likely to be dump'd twice but that's OK.
 const PREF_LOG_LEVEL = "services.common.hawk.log.appender.dump";
@@ -50,18 +56,19 @@ XPCOMUtils.defineLazyGetter(this, "log",
   // the appender.  This allows other things to send the logs to different
   // appenders, while still allowing the pref to control what is seen via dump()
   log.level = Log.Level.Debug;
   let appender = new Log.DumpAppender();
   log.addAppender(appender);
   appender.level = Log.Level.Error;
   try {
     let level =
-      Services.prefs.getPrefType(PREF_LOG_LEVEL) == Ci.nsIPrefBranch.PREF_STRING
-      && Services.prefs.getCharPref(PREF_LOG_LEVEL);
+      Services.prefs.getPrefType(PREF_LOG_LEVEL) ==
+        Ci.nsIPrefBranch.PREF_STRING &&
+      Services.prefs.getCharPref(PREF_LOG_LEVEL);
     appender.level = Log.Level[level] || Log.Level.Error;
   } catch (e) {
     log.error(e);
   }
 
   return log;
 });
 
@@ -90,17 +97,16 @@ var HawkClient = function(host) {
   this.host = host;
 
   // Clock offset in milliseconds between our client's clock and the date
   // reported in responses from our host.
   this._localtimeOffsetMsec = 0;
 };
 
 this.HawkClient.prototype = {
-
   /*
    * Construct an error message for a response.  Private.
    *
    * @param restResponse
    *        A RESTResponse object from a RESTRequest
    *
    * @param error
    *        A string or object describing the error
@@ -115,17 +121,18 @@ this.HawkClient.prototype = {
       errorString: error.toString(),
       message: restResponse.statusText,
       code: restResponse.status,
       errno: restResponse.status,
       toString() {
         return this.code + ": " + this.message;
       },
     };
-    let retryAfter = restResponse.headers && restResponse.headers["retry-after"];
+    let retryAfter =
+      restResponse.headers && restResponse.headers["retry-after"];
     retryAfter = retryAfter ? parseInt(retryAfter) : retryAfter;
     if (retryAfter) {
       errorObj.retryAfter = retryAfter;
       // and notify observers of the retry interval
       if (this.observerPrefix) {
         Observers.notify(this.observerPrefix + ":backoff:interval", retryAfter);
       }
     }
@@ -146,17 +153,19 @@ this.HawkClient.prototype = {
    *
    * For HAWK clock skew and replay protection, see
    * https://github.com/hueniverse/hawk#replay-protection
    */
   _updateClockOffset(dateString) {
     try {
       let serverDateMsec = Date.parse(dateString);
       this._localtimeOffsetMsec = serverDateMsec - this.now();
-      log.debug("Clock offset vs " + this.host + ": " + this._localtimeOffsetMsec);
+      log.debug(
+        "Clock offset vs " + this.host + ": " + this._localtimeOffsetMsec
+      );
     } catch (err) {
       log.warn("Bad date header in server response: " + dateString);
     }
   },
 
   /*
    * Get the current clock offset in milliseconds.
    *
@@ -189,18 +198,24 @@ this.HawkClient.prototype = {
    * @param extraHeaders
    *        An object with header/value pairs to send with the request.
    * @return Promise
    *        Returns a promise that resolves to the response of the API call,
    *        or is rejected with an error.  If the server response can be parsed
    *        as JSON and contains an 'error' property, the promise will be
    *        rejected with this JSON-parsed response.
    */
-  async request(path, method, credentials = null, payloadObj = {}, extraHeaders = {},
-                retryOK = true) {
+  async request(
+    path,
+    method,
+    credentials = null,
+    payloadObj = {},
+    extraHeaders = {},
+    retryOK = true
+  ) {
     method = method.toLowerCase();
 
     let uri = this.host + path;
 
     let extra = {
       now: this.now(),
       localtimeOffsetMsec: this.localtimeOffsetMsec,
       headers: extraHeaders,
@@ -218,18 +233,24 @@ this.HawkClient.prototype = {
 
     // This shouldn't happen anymore, but it's not exactly difficult to handle.
     if (!restResponse) {
       throw error;
     }
 
     let status = restResponse.status;
 
-    log.debug("(Response) " + path + ": code: " + status +
-              " - Status text: " + restResponse.statusText);
+    log.debug(
+      "(Response) " +
+        path +
+        ": code: " +
+        status +
+        " - Status text: " +
+        restResponse.statusText
+    );
     if (logPII) {
       log.debug("Response text", restResponse.body);
     }
 
     // All responses may have backoff headers, which are a server-side safety
     // valve to allow slowing down clients without hurting performance.
     this._maybeNotifyBackoff(restResponse, "x-weave-backoff");
     this._maybeNotifyBackoff(restResponse, "x-backoff");
@@ -241,32 +262,39 @@ this.HawkClient.prototype = {
     }
 
     this._updateClockOffset(restResponse.headers.date);
 
     if (status === 401 && retryOK && !("retry-after" in restResponse.headers)) {
       // Retry once if we were rejected due to a bad timestamp.
       // Clock offset is adjusted already in the top of this function.
       log.debug("Received 401 for " + path + ": retrying");
-      return this.request(path, method, credentials, payloadObj, extraHeaders, false);
+      return this.request(
+        path,
+        method,
+        credentials,
+        payloadObj,
+        extraHeaders,
+        false
+      );
     }
 
     // If the server returned a json error message, use it in the rejection
     // of the promise.
     //
     // In the case of a 401, in which we are probably being rejected for a
     // bad timestamp, retry exactly once, during which time clock offset will
     // be adjusted.
 
     let jsonResponse = {};
     try {
       jsonResponse = JSON.parse(restResponse.body);
     } catch (notJSON) {}
 
-    let okResponse = (200 <= status && status < 300);
+    let okResponse = 200 <= status && status < 300;
     if (!okResponse || jsonResponse.error) {
       if (jsonResponse.error) {
         throw jsonResponse;
       }
       throw this._constructError(restResponse, "Request failed");
     }
 
     // It's up to the caller to know how to decode the response.
@@ -291,21 +319,27 @@ this.HawkClient.prototype = {
     let headerVal = response.headers[headerName];
     if (!headerVal) {
       return;
     }
     let backoffInterval;
     try {
       backoffInterval = parseInt(headerVal, 10);
     } catch (ex) {
-      log.error("hawkclient response had invalid backoff value in '" +
-                headerName + "' header: " + headerVal);
+      log.error(
+        "hawkclient response had invalid backoff value in '" +
+          headerName +
+          "' header: " +
+          headerVal
+      );
       return;
     }
-    Observers.notify(this.observerPrefix + ":backoff:interval", backoffInterval);
+    Observers.notify(
+      this.observerPrefix + ":backoff:interval",
+      backoffInterval
+    );
   },
 
   // override points for testing.
   newHAWKAuthenticatedRESTRequest(uri, credentials, extra) {
     return new HAWKAuthenticatedRESTRequest(uri, credentials, extra);
   },
-
 };
--- a/services/common/hawkrequest.js
+++ b/services/common/hawkrequest.js
@@ -4,25 +4,36 @@
 
 "use strict";
 
 var EXPORTED_SYMBOLS = [
   "HAWKAuthenticatedRESTRequest",
   "deriveHawkCredentials",
 ];
 
-const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-const {RESTRequest} = ChromeUtils.import("resource://services-common/rest.js");
-const {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
-const {Credentials} = ChromeUtils.import("resource://gre/modules/Credentials.jsm");
+const { Preferences } = ChromeUtils.import(
+  "resource://gre/modules/Preferences.jsm"
+);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { RESTRequest } = ChromeUtils.import(
+  "resource://services-common/rest.js"
+);
+const { CommonUtils } = ChromeUtils.import(
+  "resource://services-common/utils.js"
+);
+const { Credentials } = ChromeUtils.import(
+  "resource://gre/modules/Credentials.jsm"
+);
 
-ChromeUtils.defineModuleGetter(this, "CryptoUtils",
-                               "resource://services-crypto/utils.js");
+ChromeUtils.defineModuleGetter(
+  this,
+  "CryptoUtils",
+  "resource://services-crypto/utils.js"
+);
 
 const Prefs = new Preferences("services.common.rest.");
 
 /**
  * Single-use HAWK-authenticated HTTP requests to RESTish resources.
  *
  * @param uri
  *        (String) URI for the RESTRequest constructor
@@ -44,24 +55,29 @@ const Prefs = new Preferences("services.
  *                                as headers on the request>
  *
  * extra.localtimeOffsetMsec is the value in milliseconds that must be added to
  * the local clock to make it agree with the server's clock.  For instance, if
  * the local clock is two minutes ahead of the server, the time offset in
  * milliseconds will be -120000.
  */
 
-var HAWKAuthenticatedRESTRequest =
- function HawkAuthenticatedRESTRequest(uri, credentials, extra = {}) {
+var HAWKAuthenticatedRESTRequest = function HawkAuthenticatedRESTRequest(
+  uri,
+  credentials,
+  extra = {}
+) {
   RESTRequest.call(this, uri);
 
   this.credentials = credentials;
   this.now = extra.now || Date.now();
   this.localtimeOffsetMsec = extra.localtimeOffsetMsec || 0;
-  this._log.trace("local time, offset: " + this.now + ", " + (this.localtimeOffsetMsec));
+  this._log.trace(
+    "local time, offset: " + this.now + ", " + this.localtimeOffsetMsec
+  );
   this.extraHeaders = extra.headers || {};
 
   // Expose for testing
   this._intl = getIntl();
 };
 HAWKAuthenticatedRESTRequest.prototype = {
   __proto__: RESTRequest.prototype,
 
@@ -70,17 +86,17 @@ HAWKAuthenticatedRESTRequest.prototype =
     if (method == "POST" || method == "PUT" || method == "PATCH") {
       contentType = "application/json";
     }
     if (this.credentials) {
       let options = {
         now: this.now,
         localtimeOffsetMsec: this.localtimeOffsetMsec,
         credentials: this.credentials,
-        payload: data && JSON.stringify(data) || "",
+        payload: (data && JSON.stringify(data)) || "",
         contentType,
       };
       let header = await CryptoUtils.computeHAWK(this.uri, method, options);
       this.setHeader("Authorization", header.field);
     }
 
     for (let header in this.extraHeaders) {
       this.setHeader(header, this.extraHeaders[header]);
@@ -89,42 +105,46 @@ HAWKAuthenticatedRESTRequest.prototype =
     this.setHeader("Content-Type", contentType);
 
     this.setHeader("Accept-Language", this._intl.accept_languages);
 
     return super.dispatch(method, data);
   },
 };
 
-
 /**
-  * Generic function to derive Hawk credentials.
-  *
-  * Hawk credentials are derived using shared secrets, which depend on the token
-  * in use.
-  *
-  * @param tokenHex
-  *        The current session token encoded in hex
-  * @param context
-  *        A context for the credentials. A protocol version will be prepended
-  *        to the context, see Credentials.keyWord for more information.
-  * @param size
-  *        The size in bytes of the expected derived buffer,
-  *        defaults to 3 * 32.
-  * @return credentials
-  *        Returns an object:
-  *        {
-  *          id: the Hawk id (from the first 32 bytes derived)
-  *          key: the Hawk key (from bytes 32 to 64)
-  *          extra: size - 64 extra bytes (if size > 64)
-  *        }
-  */
+ * Generic function to derive Hawk credentials.
+ *
+ * Hawk credentials are derived using shared secrets, which depend on the token
+ * in use.
+ *
+ * @param tokenHex
+ *        The current session token encoded in hex
+ * @param context
+ *        A context for the credentials. A protocol version will be prepended
+ *        to the context, see Credentials.keyWord for more information.
+ * @param size
+ *        The size in bytes of the expected derived buffer,
+ *        defaults to 3 * 32.
+ * @return credentials
+ *        Returns an object:
+ *        {
+ *          id: the Hawk id (from the first 32 bytes derived)
+ *          key: the Hawk key (from bytes 32 to 64)
+ *          extra: size - 64 extra bytes (if size > 64)
+ *        }
+ */
 async function deriveHawkCredentials(tokenHex, context, size = 96) {
   let token = CommonUtils.hexToBytes(tokenHex);
-  let out = await CryptoUtils.hkdfLegacy(token, undefined, Credentials.keyWord(context), size);
+  let out = await CryptoUtils.hkdfLegacy(
+    token,
+    undefined,
+    Credentials.keyWord(context),
+    size
+  );
 
   let result = {
     key: out.slice(32, 64),
     id: CommonUtils.bytesAsHex(out.slice(0, 32)),
   };
   if (size > 64) {
     result.extra = out.slice(64);
   }
@@ -157,17 +177,19 @@ this.Intl.prototype = {
   observe(subject, topic, data) {
     this.readPref();
   },
 
   readPref() {
     this._everRead = true;
     try {
       this._accepted = Services.prefs.getComplexValue(
-        "intl.accept_languages", Ci.nsIPrefLocalizedString).data;
+        "intl.accept_languages",
+        Ci.nsIPrefLocalizedString
+      ).data;
     } catch (err) {
       this._log.error("Error reading intl.accept_languages pref", err);
     }
   },
 
   get accept_languages() {
     if (!this._everRead) {
       this.readPref();
--- a/services/common/kinto-storage-adapter.js
+++ b/services/common/kinto-storage-adapter.js
@@ -7,17 +7,19 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 const { Sqlite } = ChromeUtils.import("resource://gre/modules/Sqlite.jsm");
-const { Kinto } = ChromeUtils.import("resource://services-common/kinto-offline-client.js");
+const { Kinto } = ChromeUtils.import(
+  "resource://services-common/kinto-offline-client.js"
+);
 
 /**
  * Filter and sort list against provided filters and order.
  *
  * @param  {Object} filters  The filters to apply.
  * @param  {String} order    The order to apply.
  * @param  {Array}  list     The list to reduce.
  * @return {Array}
@@ -89,110 +91,110 @@ function filterObject(filters, entry) {
  *
  * This is a copy of `filterObjects` from kinto.js/src/utils.js.
  *
  * @param  {Object} filters  The filters object.
  * @param  {Array}  list     The collection to filter.
  * @return {Array}
  */
 function filterObjects(filters, list) {
-  return list.filter((entry) => {
+  return list.filter(entry => {
     return filterObject(filters, entry);
   });
 }
 
 const statements = {
-  "createCollectionData": `
+  createCollectionData: `
     CREATE TABLE collection_data (
       collection_name TEXT,
       record_id TEXT,
       record TEXT
     );`,
 
-  "createCollectionMetadata": `
+  createCollectionMetadata: `
     CREATE TABLE collection_metadata (
       collection_name TEXT PRIMARY KEY,
       last_modified INTEGER,
       metadata TEXT
     ) WITHOUT ROWID;`,
 
-  "createCollectionDataRecordIdIndex": `
+  createCollectionDataRecordIdIndex: `
     CREATE UNIQUE INDEX unique_collection_record
       ON collection_data(collection_name, record_id);`,
 
-  "clearData": `
+  clearData: `
     DELETE FROM collection_data
       WHERE collection_name = :collection_name;`,
 
-  "createData": `
+  createData: `
     INSERT INTO collection_data (collection_name, record_id, record)
       VALUES (:collection_name, :record_id, :record);`,
 
-  "updateData": `
+  updateData: `
     INSERT OR REPLACE INTO collection_data (collection_name, record_id, record)
       VALUES (:collection_name, :record_id, :record);`,
 
-  "deleteData": `
+  deleteData: `
     DELETE FROM collection_data
       WHERE collection_name = :collection_name
       AND record_id = :record_id;`,
 
-  "saveLastModified": `
+  saveLastModified: `
     INSERT INTO collection_metadata(collection_name, last_modified)
       VALUES(:collection_name, :last_modified)
         ON CONFLICT(collection_name) DO UPDATE SET last_modified = :last_modified`,
 
-  "getLastModified": `
+  getLastModified: `
     SELECT last_modified
       FROM collection_metadata
         WHERE collection_name = :collection_name;`,
 
-  "saveMetadata": `
+  saveMetadata: `
     INSERT INTO collection_metadata(collection_name, metadata)
       VALUES(:collection_name, :metadata)
         ON CONFLICT(collection_name) DO UPDATE SET metadata = :metadata`,
 
-  "getMetadata": `
+  getMetadata: `
     SELECT metadata
       FROM collection_metadata
         WHERE collection_name = :collection_name;`,
 
-  "getRecord": `
+  getRecord: `
     SELECT record
       FROM collection_data
         WHERE collection_name = :collection_name
         AND record_id = :record_id;`,
 
-  "listRecords": `
+  listRecords: `
     SELECT record
       FROM collection_data
         WHERE collection_name = :collection_name;`,
 
   // N.B. we have to have a dynamic number of placeholders, which you
   // can't do without building your own statement. See `execute` for details
-  "listRecordsById": `
+  listRecordsById: `
     SELECT record_id, record
       FROM collection_data
         WHERE collection_name = ?
           AND record_id IN `,
 
-  "importData": `
+  importData: `
     REPLACE INTO collection_data (collection_name, record_id, record)
       VALUES (:collection_name, :record_id, :record);`,
 
-  "scanAllRecords": `SELECT * FROM collection_data;`,
+  scanAllRecords: `SELECT * FROM collection_data;`,
 
-  "clearCollectionMetadata": `DELETE FROM collection_metadata;`,
+  clearCollectionMetadata: `DELETE FROM collection_metadata;`,
 
-  "calculateStorage": `
+  calculateStorage: `
     SELECT collection_name, SUM(LENGTH(record)) as size, COUNT(record) as num_records
       FROM collection_data
         GROUP BY collection_name;`,
 
-  "addMetadataColumn": `
+  addMetadataColumn: `
     ALTER TABLE collection_metadata
       ADD COLUMN metadata TEXT;`,
 };
 
 const createStatements = [
   "createCollectionData",
   "createCollectionMetadata",
   "createCollectionDataRecordIdIndex",
@@ -256,18 +258,20 @@ class FirefoxAdapter extends Kinto.adapt
    *   - path: The path for the Sqlite database
    *
    * @returns SqliteConnection
    */
   static async openConnection(options) {
     const opts = Object.assign({}, { sharedMemoryCache: false }, options);
     const conn = await Sqlite.openConnection(opts).then(this._init);
     try {
-      Sqlite.shutdown.addBlocker("Kinto storage adapter connection closing",
-                                 () => conn.close());
+      Sqlite.shutdown.addBlocker(
+        "Kinto storage adapter connection closing",
+        () => conn.close()
+      );
     } catch (e) {
       // It's too late to block shutdown, just close the connection.
       await conn.close();
       throw e;
     }
     return conn;
   }
 
@@ -276,51 +280,51 @@ class FirefoxAdapter extends Kinto.adapt
     return this._executeStatement(statements.clearData, params);
   }
 
   execute(callback, options = { preload: [] }) {
     let result;
     const conn = this._connection;
     const collection = this.collection;
 
-    return conn.executeTransaction(async function doExecuteTransaction() {
-      // Preload specified records from DB, within transaction.
+    return conn
+      .executeTransaction(async function doExecuteTransaction() {
+        // Preload specified records from DB, within transaction.
 
-      // if options.preload has more elements than the sqlite variable
-      // limit, split it up.
-      const limit = 100;
-      let preloaded = {};
-      let preload;
-      let more = options.preload;
+        // if options.preload has more elements than the sqlite variable
+        // limit, split it up.
+        const limit = 100;
+        let preloaded = {};
+        let preload;
+        let more = options.preload;
 
-      while (more.length > 0) {
-        preload = more.slice(0, limit);
-        more = more.slice(limit, more.length);
+        while (more.length > 0) {
+          preload = more.slice(0, limit);
+          more = more.slice(limit, more.length);
 
-        const parameters = [
-          collection,
-          ...preload,
-        ];
-        const placeholders = preload.map(_ => "?");
-        const stmt = statements.listRecordsById + "(" + placeholders.join(",") + ");";
-        const rows = await conn.execute(stmt, parameters);
+          const parameters = [collection, ...preload];
+          const placeholders = preload.map(_ => "?");
+          const stmt =
+            statements.listRecordsById + "(" + placeholders.join(",") + ");";
+          const rows = await conn.execute(stmt, parameters);
 
-        rows.reduce((acc, row) => {
-          const record = JSON.parse(row.getResultByName("record"));
-          acc[row.getResultByName("record_id")] = record;
-          return acc;
-        }, preloaded);
-      }
-      const proxy = transactionProxy(collection, preloaded);
-      result = callback(proxy);
+          rows.reduce((acc, row) => {
+            const record = JSON.parse(row.getResultByName("record"));
+            acc[row.getResultByName("record_id")] = record;
+            return acc;
+          }, preloaded);
+        }
+        const proxy = transactionProxy(collection, preloaded);
+        result = callback(proxy);
 
-      for (let { statement, params } of proxy.operations) {
-        await conn.executeCached(statement, params);
-      }
-    }, conn.TRANSACTION_EXCLUSIVE).then(_ => result);
+        for (let { statement, params } of proxy.operations) {
+          await conn.executeCached(statement, params);
+        }
+      }, conn.TRANSACTION_EXCLUSIVE)
+      .then(_ => result);
   }
 
   get(id) {
     const params = {
       collection_name: this.collection,
       record_id: id,
     };
     return this._executeStatement(statements.getRecord, params).then(result => {
@@ -330,28 +334,30 @@ class FirefoxAdapter extends Kinto.adapt
       return JSON.parse(result[0].getResultByName("record"));
     });
   }
 
   list(params = { filters: {}, order: "" }) {
     const parameters = {
       collection_name: this.collection,
     };
-    return this._executeStatement(statements.listRecords, parameters).then(result => {
-      const records = [];
-      for (let k = 0; k < result.length; k++) {
-        const row = result[k];
-        records.push(JSON.parse(row.getResultByName("record")));
-      }
-      return records;
-    }).then(results => {
-      // The resulting list of records is filtered and sorted.
-      // XXX: with some efforts, this could be implemented using SQL.
-      return reduceRecords(params.filters, params.order, results);
-    });
+    return this._executeStatement(statements.listRecords, parameters)
+      .then(result => {
+        const records = [];
+        for (let k = 0; k < result.length; k++) {
+          const row = result[k];
+          records.push(JSON.parse(row.getResultByName("record")));
+        }
+        return records;
+      })
+      .then(results => {
+        // The resulting list of records is filtered and sorted.
+        // XXX: with some efforts, this could be implemented using SQL.
+        return reduceRecords(params.filters, params.order, results);
+      });
   }
 
   async loadDump(records) {
     return this.importBulk(records);
   }
 
   /**
    * Load a list of records into the local database.
@@ -370,22 +376,25 @@ class FirefoxAdapter extends Kinto.adapt
       for (let record of records) {
         const params = {
           collection_name,
           record_id: record.id,
           record: JSON.stringify(record),
         };
         await connection.execute(statements.importData, params);
       }
-      const lastModified = Math.max(...records.map(record => record.last_modified));
+      const lastModified = Math.max(
+        ...records.map(record => record.last_modified)
+      );
       const params = {
         collection_name,
       };
-      const previousLastModified = await connection.execute(
-        statements.getLastModified, params).then(result => {
+      const previousLastModified = await connection
+        .execute(statements.getLastModified, params)
+        .then(result => {
           return result.length > 0
             ? result[0].getResultByName("last_modified")
             : -1;
         });
       if (lastModified > previousLastModified) {
         const params = {
           collection_name,
           last_modified: lastModified,
@@ -397,31 +406,33 @@ class FirefoxAdapter extends Kinto.adapt
   }
 
   saveLastModified(lastModified) {
     const parsedLastModified = parseInt(lastModified, 10) || null;
     const params = {
       collection_name: this.collection,
       last_modified: parsedLastModified,
     };
-    return this._executeStatement(statements.saveLastModified, params)
-      .then(() => parsedLastModified);
+    return this._executeStatement(statements.saveLastModified, params).then(
+      () => parsedLastModified
+    );
   }
 
   getLastModified() {
     const params = {
       collection_name: this.collection,
     };
-    return this._executeStatement(statements.getLastModified, params)
-      .then(result => {
+    return this._executeStatement(statements.getLastModified, params).then(
+      result => {
         if (result.length == 0) {
           return 0;
         }
         return result[0].getResultByName("last_modified");
-      });
+      }
+    );
   }
 
   async saveMetadata(metadata) {
     const params = {
       collection_name: this.collection,
       metadata: JSON.stringify(metadata),
     };
     await this._executeStatement(statements.saveMetadata, params);
@@ -435,24 +446,25 @@ class FirefoxAdapter extends Kinto.adapt
     const result = await this._executeStatement(statements.getMetadata, params);
     if (result.length == 0) {
       return null;
     }
     return JSON.parse(result[0].getResultByName("metadata"));
   }
 
   calculateStorage() {
-    return this._executeStatement(statements.calculateStorage, {})
-      .then(result => {
+    return this._executeStatement(statements.calculateStorage, {}).then(
+      result => {
         return Array.from(result, row => ({
           collectionName: row.getResultByName("collection_name"),
           size: row.getResultByName("size"),
           numRecords: row.getResultByName("num_records"),
         }));
-      });
+      }
+    );
   }
 
   /**
    * Reset the sync status of every record and collection we have
    * access to.
    */
   resetSyncStatus() {
     // We're going to use execute instead of executeCached, so build
@@ -464,36 +476,39 @@ class FirefoxAdapter extends Kinto.adapt
     return this._connection.executeTransaction(async function(conn) {
       const promises = [];
       await conn.execute(statements.scanAllRecords, null, function(row) {
         const record = JSON.parse(row.getResultByName("record"));
         const record_id = row.getResultByName("record_id");
         const collection_name = row.getResultByName("collection_name");
         if (record._status === "deleted") {
           // Garbage collect deleted records.
-          promises.push(conn.execute(statements.deleteData, { collection_name, record_id }));
+          promises.push(
+            conn.execute(statements.deleteData, { collection_name, record_id })
+          );
         } else {
           const newRecord = Object.assign({}, record, {
             _status: "created",
             last_modified: undefined,
           });
-          promises.push(conn.execute(statements.updateData, {
-            record: JSON.stringify(newRecord),
-            record_id,
-            collection_name,
-          }));
+          promises.push(
+            conn.execute(statements.updateData, {
+              record: JSON.stringify(newRecord),
+              record_id,
+              collection_name,
+            })
+          );
         }
       });
       await Promise.all(promises);
       await conn.execute(statements.clearCollectionMetadata);
     });
   }
 }
 
-
 function transactionProxy(collection, preloaded) {
   const _operations = [];
 
   return {
     get operations() {
       return _operations;
     },
 
--- a/services/common/logmanager.js
+++ b/services/common/logmanager.js
@@ -1,29 +1,36 @@
 /* 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;";
 
-ChromeUtils.defineModuleGetter(this, "Services",
-  "resource://gre/modules/Services.jsm");
-ChromeUtils.defineModuleGetter(this, "FileUtils",
-  "resource://gre/modules/FileUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "Log",
-  "resource://gre/modules/Log.jsm");
-ChromeUtils.defineModuleGetter(this, "OS",
-  "resource://gre/modules/osfile.jsm");
-ChromeUtils.defineModuleGetter(this, "CommonUtils",
-  "resource://services-common/utils.js");
+ChromeUtils.defineModuleGetter(
+  this,
+  "Services",
+  "resource://gre/modules/Services.jsm"
+);
+ChromeUtils.defineModuleGetter(
+  this,
+  "FileUtils",
+  "resource://gre/modules/FileUtils.jsm"
+);
+ChromeUtils.defineModuleGetter(this, "Log", "resource://gre/modules/Log.jsm");
+ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
+ChromeUtils.defineModuleGetter(
+  this,
+  "CommonUtils",
+  "resource://services-common/utils.js"
+);
 
-const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
+const { Preferences } = ChromeUtils.import(
+  "resource://gre/modules/Preferences.jsm"
+);
 
-var EXPORTED_SYMBOLS = [
-  "LogManager",
-];
+var EXPORTED_SYMBOLS = ["LogManager"];
 
 const DEFAULT_MAX_ERROR_AGE = 20 * 24 * 60 * 60; // 20 days
 
 // "shared" logs (ie, where the same log name is used by multiple LogManager
 // instances) are a fact of life here - eg, FirefoxAccounts logs are used by
 // both Sync and Reading List.
 // However, different instances have different pref branches, so we need to
 // handle when one pref branch says "Debug" and the other says "Error"
@@ -73,27 +80,29 @@ class StorageStreamAppender extends Log.
       this._outputStream = this.newOutputStream();
       if (!this._outputStream) {
         return null;
       }
 
       // Wrap the raw stream in an nsIConverterOutputStream. We can reuse
       // the instance if we already have one.
       if (!this._converterStream) {
-        this._converterStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
-                                  .createInstance(Ci.nsIConverterOutputStream);
+        this._converterStream = Cc[
+          "@mozilla.org/intl/converter-output-stream;1"
+        ].createInstance(Ci.nsIConverterOutputStream);
       }
       this._converterStream.init(this._outputStream, "UTF-8");
     }
     return this._converterStream;
   }
 
   newOutputStream() {
-    let ss = this._ss = Cc["@mozilla.org/storagestream;1"]
-                          .createInstance(Ci.nsIStorageStream);
+    let ss = (this._ss = Cc["@mozilla.org/storagestream;1"].createInstance(
+      Ci.nsIStorageStream
+    ));
     ss.init(STREAM_SEGMENT_SIZE, PR_UINT32_MAX, null);
     return ss.getOutputStream(0);
   }
 
   getInputStream() {
     if (!this._ss) {
       return null;
     }
@@ -115,18 +124,19 @@ class StorageStreamAppender extends Log.
     }
     try {
       this.outputStream.writeString(formatted + "\n");
     } catch (ex) {
       if (ex.result == Cr.NS_BASE_STREAM_CLOSED) {
         // The underlying output stream is closed, so let's open a new one
         // and try again.
         this._outputStream = null;
-      } try {
-          this.outputStream.writeString(formatted + "\n");
+      }
+      try {
+        this.outputStream.writeString(formatted + "\n");
       } catch (ex) {
         // Ah well, we tried, but something seems to be hosed permanently.
       }
     }
   }
 }
 
 // A storage appender that is flushable to a file on disk.  Policies for
@@ -179,30 +189,40 @@ class FlushableStorageAppender extends S
    * Returns a promise that is resolved on completion or rejected with an error.
    */
   async _copyStreamToFile(inputStream, subdirArray, outputFileName, log) {
     // The log data could be large, so we don't want to pass it all in a single
     // message, so use BUFFER_SIZE chunks.
     const BUFFER_SIZE = 8192;
 
     // get a binary stream
-    let binaryStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream);
+    let binaryStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(
+      Ci.nsIBinaryInputStream
+    );
     binaryStream.setInputStream(inputStream);
 
-    let outputDirectory = OS.Path.join(OS.Constants.Path.profileDir, ...subdirArray);
-    await OS.File.makeDir(outputDirectory, { ignoreExisting: true, from: OS.Constants.Path.profileDir });
+    let outputDirectory = OS.Path.join(
+      OS.Constants.Path.profileDir,
+      ...subdirArray
+    );
+    await OS.File.makeDir(outputDirectory, {
+      ignoreExisting: true,
+      from: OS.Constants.Path.profileDir,
+    });
     let fullOutputFileName = OS.Path.join(outputDirectory, outputFileName);
-    let output = await OS.File.open(fullOutputFileName, { write: true} );
+    let output = await OS.File.open(fullOutputFileName, { write: true });
     try {
       while (true) {
         let available = binaryStream.available();
         if (!available) {
           break;
         }
-        let chunk = binaryStream.readByteArray(Math.min(available, BUFFER_SIZE));
+        let chunk = binaryStream.readByteArray(
+          Math.min(available, BUFFER_SIZE)
+        );
         await output.write(new Uint8Array(chunk));
       }
     } finally {
       try {
         binaryStream.close(); // inputStream is closed by the binaryStream
         await output.close();
       } catch (ex) {
         log.error("Failed to close the input stream", ex);
@@ -236,17 +256,22 @@ LogManager.prototype = {
       formatter = new Log.BasicFormatter();
       consoleAppender = new Log.ConsoleAppender(formatter);
       dumpAppender = new Log.DumpAppender(formatter);
     }
 
     allBranches.add(this._prefs._branchStr);
     // We create a preference observer for all our prefs so they are magically
     // reflected if the pref changes after creation.
-    let setupAppender = (appender, prefName, defaultLevel, findSmallest = false) => {
+    let setupAppender = (
+      appender,
+      prefName,
+      defaultLevel,
+      findSmallest = false
+    ) => {
       let observer = newVal => {
         let level = Log.Level[newVal] || defaultLevel;
         if (findSmallest) {
           // As some of our appenders have global impact (ie, there is only one
           // place 'dump' goes to), we need to find the smallest value from all
           // prefs controlling this appender.
           // For example, if consumerA has dump=Debug then consumerB sets
           // dump=Error, we need to keep dump=Debug so consumerA is respected.
@@ -262,24 +287,38 @@ LogManager.prototype = {
       };
       this._prefs.observe(prefName, observer, this);
       this._prefObservers.push([prefName, observer]);
       // and call the observer now with the current pref value.
       observer(this._prefs.get(prefName));
       return observer;
     };
 
-    this._observeConsolePref = setupAppender(consoleAppender, "log.appender.console", Log.Level.Fatal, true);
-    this._observeDumpPref = setupAppender(dumpAppender, "log.appender.dump", Log.Level.Error, true);
+    this._observeConsolePref = setupAppender(
+      consoleAppender,
+      "log.appender.console",
+      Log.Level.Fatal,
+      true
+    );
+    this._observeDumpPref = setupAppender(
+      dumpAppender,
+      "log.appender.dump",
+      Log.Level.Error,
+      true
+    );
 
     // The file appender doesn't get the special singleton behaviour.
-    let fapp = this._fileAppender = new FlushableStorageAppender(formatter);
+    let fapp = (this._fileAppender = new FlushableStorageAppender(formatter));
     // the stream gets a default of Debug as the user must go out of their way
     // to see the stuff spewed to it.
-    this._observeStreamPref = setupAppender(fapp, "log.appender.file.level", Log.Level.Debug);
+    this._observeStreamPref = setupAppender(
+      fapp,
+      "log.appender.file.level",
+      Log.Level.Debug
+    );
 
     // now attach the appenders to all our logs.
     for (let logName of logNames) {
       let log = Log.repository.getLogger(logName);
       for (let appender of [fapp, dumpAppender, consoleAppender]) {
         log.addAppender(appender);
       }
     }
@@ -344,18 +383,23 @@ LogManager.prototype = {
       // might as well avoid creating an input stream if we aren't going to use it.
       if (!flushToFile) {
         this._fileAppender.reset();
         return null;
       }
 
       // We have reasonPrefix at the start of the filename so all "error"
       // logs are grouped in about:sync-log.
-      let filename = reasonPrefix + "-" + this.logFilePrefix + "-" + Date.now() + ".txt";
-      await this._fileAppender.flushToFile(this._logFileSubDirectoryEntries, filename, this._log);
+      let filename =
+        reasonPrefix + "-" + this.logFilePrefix + "-" + Date.now() + ".txt";
+      await this._fileAppender.flushToFile(
+        this._logFileSubDirectoryEntries,
+        filename,
+        this._log
+      );
       // It's not completely clear to markh why we only do log cleanups
       // for errors, but for now the Sync semantics have been copied...
       // (one theory is that only cleaning up on error makes it less
       // likely old error logs would be removed, but that's not true if
       // there are occasional errors - let's address this later!)
       if (reason == this.ERROR_LOG_WRITTEN && !this._cleaningUpFileLogs) {
         this._log.trace("Running cleanup.");
         try {
@@ -370,17 +414,20 @@ LogManager.prototype = {
       return null;
     }
   },
 
   /**
    * Finds all logs older than maxErrorAge and deletes them using async I/O.
    */
   cleanupLogs() {
-    let maxAge = this._prefs.get("log.appender.file.maxErrorAge", DEFAULT_MAX_ERROR_AGE);
+    let maxAge = this._prefs.get(
+      "log.appender.file.maxErrorAge",
+      DEFAULT_MAX_ERROR_AGE
+    );
     let threshold = Date.now() - 1000 * maxAge;
     this._log.debug("Log cleanup threshold time: " + threshold);
 
     let shouldDelete = fileInfo => {
       return fileInfo.lastModificationDate.getTime() < threshold;
     };
     return this._deleteLogFiles(shouldDelete);
   },
@@ -394,44 +441,56 @@ LogManager.prototype = {
 
   // Delete some log files. A callback is invoked for each found log file to
   // determine if that file should be removed.
   async _deleteLogFiles(cbShouldDelete) {
     this._cleaningUpFileLogs = true;
     let logDir = FileUtils.getDir("ProfD", this._logFileSubDirectoryEntries);
     let iterator = new OS.File.DirectoryIterator(logDir.path);
 
-    await iterator.forEach(async (entry) => {
+    await iterator.forEach(async entry => {
       // Note that we don't check this.logFilePrefix is in the name - we cleanup
       // all files in this directory regardless of that prefix so old logfiles
       // for prefixes no longer in use are still cleaned up. See bug 1279145.
-      if (!entry.name.startsWith("error-") &&
-          !entry.name.startsWith("success-")) {
+      if (
+        !entry.name.startsWith("error-") &&
+        !entry.name.startsWith("success-")
+      ) {
         return;
       }
       try {
         // need to call .stat() as the enumerator doesn't give that to us on *nix.
         let info = await OS.File.stat(entry.path);
         if (!cbShouldDelete(info)) {
           return;
         }
-        this._log.trace(" > Cleanup removing " + entry.name +
-                        " (" + info.lastModificationDate.getTime() + ")");
+        this._log.trace(
+          " > Cleanup removing " +
+            entry.name +
+            " (" +
+            info.lastModificationDate.getTime() +
+            ")"
+        );
         await OS.File.remove(entry.path);
         this._log.trace("Deleted " + entry.name);
       } catch (ex) {
-        this._log.debug("Encountered error trying to clean up old log file "
-                        + entry.name, ex);
+        this._log.debug(
+          "Encountered error trying to clean up old log file " + entry.name,
+          ex
+        );
       }
     });
     // Wait for this to close if we need to (but it might fail if OS.File has
     // shut down)
     try {
       await iterator.close();
     } catch (e) {
       this._log.warn("Failed to close directory iterator", e);
     }
     this._cleaningUpFileLogs = false;
     this._log.debug("Done deleting files.");
     // This notification is used only for tests.
-    Services.obs.notifyObservers(null, "services-tests:common:log-manager:cleanup-logs");
+    Services.obs.notifyObservers(
+      null,
+      "services-tests:common:log-manager:cleanup-logs"
+    );
   },
 };
--- a/services/common/modules-testing/logging.js
+++ b/services/common/modules-testing/logging.js
@@ -1,42 +1,47 @@
 /* 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";
 
-var EXPORTED_SYMBOLS = [
-  "getTestLogger",
-  "initTestLogging",
-];
+var EXPORTED_SYMBOLS = ["getTestLogger", "initTestLogging"];
 
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
 
 function initTestLogging(level) {
   function LogStats() {
     this.errorsLogged = 0;
   }
   LogStats.prototype = {
     format: function format(message) {
       if (message.level == Log.Level.Error) {
         this.errorsLogged += 1;
       }
 
-      return message.time + "\t" + message.loggerName + "\t" + message.levelDesc + "\t" +
-        this.formatText(message) + "\n";
+      return (
+        message.time +
+        "\t" +
+        message.loggerName +
+        "\t" +
+        message.levelDesc +
+        "\t" +
+        this.formatText(message) +
+        "\n"
+      );
     },
   };
   LogStats.prototype.__proto__ = new Log.BasicFormatter();
 
   let log = Log.repository.rootLogger;
   let logStats = new LogStats();
   let appender = new Log.DumpAppender(logStats);
 
-  if (typeof(level) == "undefined") {
+  if (typeof level == "undefined") {
     level = "Debug";
   }
   getTestLogger().level = Log.Level[level];
   Log.repository.getLogger("Services").level = Log.Level[level];
 
   log.level = Log.Level.Trace;
   appender.level = Log.Level.Trace;
   // Overwrite any other appenders (e.g. from previous incarnations)
@@ -48,9 +53,8 @@ function initTestLogging(level) {
   Log.repository.getLogger("Sqlite").level = Log.Level.Info;
 
   return logStats;
 }
 
 function getTestLogger(component) {
   return Log.repository.getLogger("Testing");
 }
-
--- a/services/common/observers.js
+++ b/services/common/observers.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["Observers"];
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * A service for adding, removing and notifying observers of notifications.
  * Wraps the nsIObserverService interface.
  *
  * @version 0.2
  */
 var Observers = {
@@ -48,19 +48,20 @@ var Observers = {
    * @param thisObject  {Object}  [optional]
    *        the object being used as |this| when calling a Function callback
    */
   remove(topic, callback, thisObject) {
     // This seems fairly inefficient, but I'm not sure how much better
     // we can make it.  We could index by topic, but we can't index by callback
     // or thisObject, as far as I know, since the keys to JavaScript hashes
     // (a.k.a. objects) can apparently only be primitive values.
-    let [observer] = this._cache.filter(v => v.topic == topic &&
-                                             v.callback == callback &&
-                                             v.thisObject == thisObject);
+    let [observer] = this._cache.filter(
+      v =>
+        v.topic == topic && v.callback == callback && v.thisObject == thisObject
+    );
     if (observer) {
       Services.obs.removeObserver(observer, topic);
       this._cache.splice(this._cache.indexOf(observer), 1);
     } else {
       throw new Error("Attempt to remove non-existing observer");
     }
   },
 
@@ -76,64 +77,71 @@ var Observers = {
    * @param data    {String}  [optional] [deprecated]
    *        some more information about the topic; deprecated as the subject
    *        is sufficient to pass all needed information to the JS observers
    *        that this module targets; if you have multiple values to pass to
    *        the observer, wrap them in an object and pass them via the subject
    *        parameter (i.e.: { foo: 1, bar: "some string", baz: myObject })
    */
   notify(topic, subject, data) {
-    subject = (typeof subject == "undefined") ? null : new Subject(subject);
-       data = (typeof data == "undefined") ? null : data;
+    subject = typeof subject == "undefined" ? null : new Subject(subject);
+    data = typeof data == "undefined" ? null : data;
     Services.obs.notifyObservers(subject, topic, data);
   },
 
   /**
    * A cache of observers that have been added.
    *
    * We use this to remove observers when a caller calls |remove|.
    *
    * XXX This might result in reference cycles, causing memory leaks,
    * if we hold a reference to an observer that holds a reference to us.
    * Could we fix that by making this an independent top-level object
    * rather than a property of this object?
    */
   _cache: [],
 };
 
-
 function Observer(topic, callback, thisObject) {
   this.topic = topic;
   this.callback = callback;
   this.thisObject = thisObject;
 }
 
 Observer.prototype = {
-  QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
+  QueryInterface: ChromeUtils.generateQI([
+    Ci.nsIObserver,
+    Ci.nsISupportsWeakReference,
+  ]),
   observe(subject, topic, data) {
     // Extract the wrapped object for subjects that are one of our wrappers
     // around a JS object.  This way we support both wrapped subjects created
     // using this module and those that are real XPCOM components.
-    if (subject && typeof subject == "object" &&
-        ("wrappedJSObject" in subject) &&
-        ("observersModuleSubjectWrapper" in subject.wrappedJSObject))
+    if (
+      subject &&
+      typeof subject == "object" &&
+      "wrappedJSObject" in subject &&
+      "observersModuleSubjectWrapper" in subject.wrappedJSObject
+    ) {
       subject = subject.wrappedJSObject.object;
+    }
 
     if (typeof this.callback == "function") {
-      if (this.thisObject)
+      if (this.thisObject) {
         this.callback.call(this.thisObject, subject, data);
-      else
+      } else {
         this.callback(subject, data);
-    } else { // typeof this.callback == "object" (nsIObserver)
+      }
+    } else {
+      // typeof this.callback == "object" (nsIObserver)
       this.callback.observe(subject, topic, data);
     }
   },
 };
 
-
 function Subject(object) {
   // Double-wrap the object and set a property identifying the wrappedJSObject
   // as one of our wrappers to distinguish between subjects that are one of our
   // wrappers (which we should unwrap when notifying our observers) and those
   // that are real JS XPCOM components (which we should pass through unaltered).
   this.wrappedJSObject = { observersModuleSubjectWrapper: true, object };
 }
 
--- a/services/common/rest.js
+++ b/services/common/rest.js
@@ -3,41 +3,54 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var EXPORTED_SYMBOLS = [
   "RESTRequest",
   "RESTResponse",
   "TokenAuthenticatedRESTRequest",
 ];
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
-const {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { PromiseUtils } = ChromeUtils.import(
+  "resource://gre/modules/PromiseUtils.jsm"
+);
+const { CommonUtils } = ChromeUtils.import(
+  "resource://services-common/utils.js"
+);
 
-ChromeUtils.defineModuleGetter(this, "CryptoUtils",
-                               "resource://services-crypto/utils.js");
+ChromeUtils.defineModuleGetter(
+  this,
+  "CryptoUtils",
+  "resource://services-crypto/utils.js"
+);
 
 function decodeString(data, charset) {
   if (!data || !charset) {
     return data;
   }
 
   // This could be simpler if we assumed the charset is only ever UTF-8.
   // It's unclear to me how willing we are to assume this, though...
-  let stringStream = Cc["@mozilla.org/io/string-input-stream;1"]
-                     .createInstance(Ci.nsIStringInputStream);
+  let stringStream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
+    Ci.nsIStringInputStream
+  );
   stringStream.setData(data, data.length);
 
-  let converterStream = Cc["@mozilla.org/intl/converter-input-stream;1"]
-                        .createInstance(Ci.nsIConverterInputStream);
+  let converterStream = Cc[
+    "@mozilla.org/intl/converter-input-stream;1"
+  ].createInstance(Ci.nsIConverterInputStream);
 
-  converterStream.init(stringStream, charset, 0,
-                       converterStream.DEFAULT_REPLACEMENT_CHARACTER);
+  converterStream.init(
+    stringStream,
+    charset,
+    0,
+    converterStream.DEFAULT_REPLACEMENT_CHARACTER
+  );
 
   let remaining = data.length;
   let body = "";
   while (remaining > 0) {
     let str = {};
     let num = converterStream.readString(remaining, str);
     if (!num) {
       break;
@@ -84,17 +97,16 @@ function RESTRequest(uri) {
 
   this._headers = {};
   this._deferred = PromiseUtils.defer();
   this._log = Log.repository.getLogger(this._logName);
   this._log.manageLevelFromPref("services.common.log.logger.rest.request");
 }
 
 RESTRequest.prototype = {
-
   _logName: "Services.Common.RESTRequest",
 
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIInterfaceRequestor,
     Ci.nsIChannelEventSink,
   ]),
 
   /** Public API: **/
@@ -113,35 +125,38 @@ RESTRequest.prototype = {
    * RESTResponse object
    */
   response: null,
 
   /**
    * nsIRequest load flags. Don't do any caching by default. Don't send user
    * cookies and such over the wire (Bug 644734).
    */
-  loadFlags: Ci.nsIRequest.LOAD_BYPASS_CACHE | Ci.nsIRequest.INHIBIT_CACHING | Ci.nsIRequest.LOAD_ANONYMOUS,
+  loadFlags:
+    Ci.nsIRequest.LOAD_BYPASS_CACHE |
+    Ci.nsIRequest.INHIBIT_CACHING |
+    Ci.nsIRequest.LOAD_ANONYMOUS,
 
   /**
    * nsIHttpChannel
    */
   channel: null,
 
   /**
    * Flag to indicate the status of the request.
    *
    * One of NOT_SENT, SENT, IN_PROGRESS, COMPLETED, ABORTED.
    */
   status: null,
 
-  NOT_SENT:    0,
-  SENT:        1,
+  NOT_SENT: 0,
+  SENT: 1,
   IN_PROGRESS: 2,
-  COMPLETED:   4,
-  ABORTED:     8,
+  COMPLETED: 4,
+  ABORTED: 8,
 
   /**
    * HTTP status text of response
    */
   statusText: null,
 
   /**
    * Request timeout (in seconds, though decimal values can be used for
@@ -248,19 +263,22 @@ RESTRequest.prototype = {
   async dispatch(method, data) {
     if (this.status != this.NOT_SENT) {
       throw new Error("Request has already been sent!");
     }
 
     this.method = method;
 
     // Create and initialize HTTP channel.
-    let channel = NetUtil.newChannel({uri: this.uri, loadUsingSystemPrincipal: true})
-                         .QueryInterface(Ci.nsIRequest)
-                         .QueryInterface(Ci.nsIHttpChannel);
+    let channel = NetUtil.newChannel({
+      uri: this.uri,
+      loadUsingSystemPrincipal: true,
+    })
+      .QueryInterface(Ci.nsIRequest)
+      .QueryInterface(Ci.nsIHttpChannel);
     this.channel = channel;
     channel.loadFlags |= this.loadFlags;
     channel.notificationCallbacks = this;
 
     this._log.debug(`${method} request to ${this.uri.spec}`);
     // Set request headers.
     let headers = this._headers;
     for (let key in headers) {
@@ -269,17 +287,21 @@ RESTRequest.prototype = {
       } else {
         this._log.trace("HTTP Header " + key + ": " + headers[key]);
       }
       channel.setRequestHeader(key, headers[key], false);
     }
 
     // REST requests accept JSON by default
     if (!headers.accept) {
-      channel.setRequestHeader("accept", "application/json;q=0.9,*/*;q=0.2", false);
+      channel.setRequestHeader(
+        "accept",
+        "application/json;q=0.9,*/*;q=0.2",
+        false
+      );
     }
 
     // Set HTTP request body.
     if (method == "PUT" || method == "POST" || method == "PATCH") {
       // Convert non-string bodies into JSON with utf-8 encoding. If a string
       // is passed we assume they've already encoded it.
       let contentType = headers["content-type"];
       if (typeof data != "string") {
@@ -289,32 +311,35 @@ RESTRequest.prototype = {
         }
         if (!contentType.includes("charset")) {
           data = CommonUtils.encodeUTF8(data);
           contentType += "; charset=utf-8";
         } else {
           // If someone handed us an object but also a custom content-type
           // it's probably confused. We could go to even further lengths to
           // respect it, but this shouldn't happen in practice.
-          Cu.reportError("rest.js found an object to JSON.stringify but also a " +
-                         "content-type header with a charset specification. " +
-                         "This probably isn't going to do what you expect");
+          Cu.reportError(
+            "rest.js found an object to JSON.stringify but also a " +
+              "content-type header with a charset specification. " +
+              "This probably isn't going to do what you expect"
+          );
         }
       }
       if (!contentType) {
         contentType = "text/plain";
       }
 
       this._log.debug(method + " Length: " + data.length);
       if (this._log.level <= Log.Level.Trace) {
         this._log.trace(method + " Body: " + data);
       }
 
-      let stream = Cc["@mozilla.org/io/string-input-stream;1"]
-                     .createInstance(Ci.nsIStringInputStream);
+      let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
+        Ci.nsIStringInputStream
+      );
       stream.setData(data, data.length);
 
       channel.QueryInterface(Ci.nsIUploadChannel);
       channel.setUploadStream(stream, contentType, data.length);
     }
     // We must set this after setting the upload stream, otherwise it
     // will always be 'PUT'. Yeah, I know.
     channel.requestMethod = method;
@@ -336,108 +361,138 @@ RESTRequest.prototype = {
     return this._deferred.promise;
   },
 
   /**
    * Create or push back the abort timer that kills this request.
    */
   delayTimeout() {
     if (this.timeout) {
-      CommonUtils.namedTimer(this.abortTimeout, this.timeout * 1000, this,
-                             "timeoutTimer");
+      CommonUtils.namedTimer(
+        this.abortTimeout,
+        this.timeout * 1000,
+        this,
+        "timeoutTimer"
+      );
     }
   },
 
   /**
    * Abort the request based on a timeout.
    */
   abortTimeout() {
-    this.abort(Components.Exception("Aborting due to channel inactivity.",
-                                    Cr.NS_ERROR_NET_TIMEOUT));
+    this.abort(
+      Components.Exception(
+        "Aborting due to channel inactivity.",
+        Cr.NS_ERROR_NET_TIMEOUT
+      )
+    );
   },
 
   /** nsIStreamListener **/
 
   onStartRequest(channel) {
     if (this.status == this.ABORTED) {
-      this._log.trace("Not proceeding with onStartRequest, request was aborted.");
+      this._log.trace(
+        "Not proceeding with onStartRequest, request was aborted."
+      );
       // We might have already rejected, but just in case.
-      this._deferred.reject(Components.Exception("Request aborted", Cr.NS_BINDING_ABORTED));
+      this._deferred.reject(
+        Components.Exception("Request aborted", Cr.NS_BINDING_ABORTED)
+      );
       return;
     }
 
     try {
       channel.QueryInterface(Ci.nsIHttpChannel);
     } catch (ex) {
       this._log.error("Unexpected error: channel is not a nsIHttpChannel!");
       this.status = this.ABORTED;
       channel.cancel(Cr.NS_BINDING_ABORTED);
       this._deferred.reject(ex);
       return;
     }
 
     this.status = this.IN_PROGRESS;
 
-    this._log.trace("onStartRequest: " + channel.requestMethod + " " +
-                    channel.URI.spec);
+    this._log.trace(
+      "onStartRequest: " + channel.requestMethod + " " + channel.URI.spec
+    );
 
     // Create a new response object.
     this.response = new RESTResponse(this);
 
     this.delayTimeout();
   },
 
   onStopRequest(channel, statusCode) {
     if (this.timeoutTimer) {
       // Clear the abort timer now that the channel is done.
       this.timeoutTimer.clear();
     }
 
     // We don't want to do anything for a request that's already been aborted.
     if (this.status == this.ABORTED) {
-      this._log.trace("Not proceeding with onStopRequest, request was aborted.");
+      this._log.trace(
+        "Not proceeding with onStopRequest, request was aborted."
+      );
       // We might not have already rejected if the user called reject() manually.
       // If we have already rejected, then this is a no-op
-      this._deferred.reject(Components.Exception("Request aborted",
-                                                 Cr.NS_BINDING_ABORTED));
+      this._deferred.reject(
+        Components.Exception("Request aborted", Cr.NS_BINDING_ABORTED)
+      );
       return;
     }
 
     try {
       channel.QueryInterface(Ci.nsIHttpChannel);
     } catch (ex) {
       this._log.error("Unexpected error: channel not nsIHttpChannel!");
       this.status = this.ABORTED;
       this._deferred.reject(ex);
       return;
     }
 
     this.status = this.COMPLETED;
 
     try {
-      this.response.body = decodeString(this.response._rawBody, this.response.charset);
+      this.response.body = decodeString(
+        this.response._rawBody,
+        this.response.charset
+      );
       this.response._rawBody = null;
     } catch (ex) {
-      this._log.warn(`Exception decoding response - ${this.method} ${channel.URI.spec}`, ex);
+      this._log.warn(
+        `Exception decoding response - ${this.method} ${channel.URI.spec}`,
+        ex
+      );
       this._deferred.reject(ex);
       return;
     }
 
     let statusSuccess = Components.isSuccessCode(statusCode);
-    let uri = channel && channel.URI && channel.URI.spec || "<unknown>";
-    this._log.trace("Channel for " + channel.requestMethod + " " + uri +
-                    " returned status code " + statusCode);
+    let uri = (channel && channel.URI && channel.URI.spec) || "<unknown>";
+    this._log.trace(
+      "Channel for " +
+        channel.requestMethod +
+        " " +
+        uri +
+        " returned status code " +
+        statusCode
+    );
 
     // Throw the failure code and stop execution.  Use Components.Exception()
     // instead of Error() so the exception is QI-able and can be passed across
     // XPCOM borders while preserving the status code.
     if (!statusSuccess) {
       let message = Components.Exception("", statusCode).name;
       let error = Components.Exception(message, statusCode);
-      this._log.debug(this.method + " " + uri + " failed: " + statusCode + " - " + message);
+      this._log.debug(
+        this.method + " " + uri + " failed: " + statusCode + " - " + message
+      );
       // Additionally give the full response body when Trace logging.
       if (this._log.level <= Log.Level.Trace) {
         this._log.trace(this.method + " body", this.response.body);
       }
       this._deferred.reject(error);
       return;
     }
 
@@ -462,18 +517,19 @@ RESTRequest.prototype = {
 
     if (channel.contentCharset) {
       this.response.charset = channel.contentCharset;
     } else {
       this.response.charset = null;
     }
 
     if (!this._inputStream) {
-      this._inputStream = Cc["@mozilla.org/scriptableinputstream;1"]
-                            .createInstance(Ci.nsIScriptableInputStream);
+      this._inputStream = Cc[
+        "@mozilla.org/scriptableinputstream;1"
+      ].createInstance(Ci.nsIScriptableInputStream);
     }
     this._inputStream.init(stream);
 
     this.response._rawBody += this._inputStream.read(count);
 
     this.delayTimeout();
   },
 
@@ -485,27 +541,37 @@ RESTRequest.prototype = {
 
   /**
    * Returns true if headers from the old channel should be
    * copied to the new channel. Invoked when a channel redirect
    * is in progress.
    */
   shouldCopyOnRedirect(oldChannel, newChannel, flags) {
     let isInternal = !!(flags & Ci.nsIChannelEventSink.REDIRECT_INTERNAL);
-    let isSameURI  = newChannel.URI.equals(oldChannel.URI);
-    this._log.debug("Channel redirect: " + oldChannel.URI.spec + ", " +
-                    newChannel.URI.spec + ", internal = " + isInternal);
+    let isSameURI = newChannel.URI.equals(oldChannel.URI);
+    this._log.debug(
+      "Channel redirect: " +
+        oldChannel.URI.spec +
+        ", " +
+        newChannel.URI.spec +
+        ", internal = " +
+        isInternal
+    );
     return isInternal && isSameURI;
   },
 
   /** nsIChannelEventSink **/
   asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
-    let oldSpec = (oldChannel && oldChannel.URI) ? oldChannel.URI.spec : "<undefined>";
-    let newSpec = (newChannel && newChannel.URI) ? newChannel.URI.spec : "<undefined>";
-    this._log.debug("Channel redirect: " + oldSpec + ", " + newSpec + ", " + flags);
+    let oldSpec =
+      oldChannel && oldChannel.URI ? oldChannel.URI.spec : "<undefined>";
+    let newSpec =
+      newChannel && newChannel.URI ? newChannel.URI.spec : "<undefined>";
+    this._log.debug(
+      "Channel redirect: " + oldSpec + ", " + newSpec + ", " + flags
+    );
 
     try {
       newChannel.QueryInterface(Ci.nsIHttpChannel);
     } catch (ex) {
       this._log.error("Unexpected error: channel not nsIHttpChannel!");
       callback.onRedirectVerifyCallback(Cr.NS_ERROR_NO_INTERFACE);
       return;
     }
@@ -536,17 +602,16 @@ RESTRequest.prototype = {
 function RESTResponse(request = null) {
   this.body = "";
   this._rawBody = "";
   this.request = request;
   this._log = Log.repository.getLogger(this._logName);
   this._log.manageLevelFromPref("services.common.log.logger.rest.response");
 }
 RESTResponse.prototype = {
-
   _logName: "Services.Common.RESTResponse",
 
   /**
    * Corresponding REST request
    */
   request: null,
 
   /**
@@ -555,47 +620,47 @@ RESTResponse.prototype = {
   get status() {
     let status;
     try {
       status = this.request.channel.responseStatus;
     } catch (ex) {
       this._log.debug("Caught exception fetching HTTP status code", ex);
       return null;
     }
-    Object.defineProperty(this, "status", {value: status});
+    Object.defineProperty(this, "status", { value: status });
     return status;
   },
 
   /**
    * HTTP status text
    */
   get statusText() {
     let statusText;
     try {
       statusText = this.request.channel.responseStatusText;
     } catch (ex) {
       this._log.debug("Caught exception fetching HTTP status text", ex);
       return null;
     }
-    Object.defineProperty(this, "statusText", {value: statusText});
+    Object.defineProperty(this, "statusText", { value: statusText });
     return statusText;
   },
 
   /**
    * Boolean flag that indicates whether the HTTP status code is 2xx or not.
    */
   get success() {
     let success;
     try {
       success = this.request.channel.requestSucceeded;
     } catch (ex) {
       this._log.debug("Caught exception fetching HTTP success flag", ex);
       return null;
     }
-    Object.defineProperty(this, "success", {value: success});
+    Object.defineProperty(this, "success", { value: success });
     return success;
   },
 
   /**
    * Object containing HTTP headers (keyed as lower case)
    */
   get headers() {
     let headers = {};
@@ -605,25 +670,24 @@ RESTResponse.prototype = {
       channel.visitResponseHeaders(function(header, value) {
         headers[header.toLowerCase()] = value;
       });
     } catch (ex) {
       this._log.debug("Caught exception processing response headers", ex);
       return null;
     }
 
-    Object.defineProperty(this, "headers", {value: headers});
+    Object.defineProperty(this, "headers", { value: headers });
     return headers;
   },
 
   /**
    * HTTP body (string)
    */
   body: null,
-
 };
 
 /**
  * Single use MAC authenticated HTTP requests to RESTish resources.
  *
  * @param uri
  *        URI going to the RESTRequest constructor.
  * @param authToken
@@ -641,16 +705,20 @@ function TokenAuthenticatedRESTRequest(u
   this.authToken = authToken;
   this.extra = extra || {};
 }
 TokenAuthenticatedRESTRequest.prototype = {
   __proto__: RESTRequest.prototype,
 
   async dispatch(method, data) {
     let sig = await CryptoUtils.computeHTTPMACSHA1(
-      this.authToken.id, this.authToken.key, method, this.uri, this.extra
+      this.authToken.id,
+      this.authToken.key,
+      method,
+      this.uri,
+      this.extra
     );
 
     this.setHeader("Authorization", sig.getHeader());
 
     return super.dispatch(method, data);
   },
 };
--- a/services/common/tests/unit/head_global.js
+++ b/services/common/tests/unit/head_global.js
@@ -1,29 +1,36 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var Cm = Components.manager;
 
 // Required to avoid failures.
 do_get_profile();
-var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+var { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
 
 ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo({
   name: "XPCShell",
   ID: "xpcshell@tests.mozilla.org",
   version: "1",
   platformVersion: "",
 });
 
 function addResourceAlias() {
-  const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-  const handler = Services.io.getProtocolHandler("resource")
-                  .QueryInterface(Ci.nsIResProtocolHandler);
+  const { Services } = ChromeUtils.import(
+    "resource://gre/modules/Services.jsm"
+  );
+  const handler = Services.io
+    .getProtocolHandler("resource")
+    .QueryInterface(Ci.nsIResProtocolHandler);
 
   let modules = ["common", "crypto", "settings"];
   for (let module of modules) {
-    let uri = Services.io.newURI("resource://gre/modules/services-" + module + "/");
+    let uri = Services.io.newURI(
+      "resource://gre/modules/services-" + module + "/"
+    );
     handler.setSubstitution("services-" + module, uri);
   }
 }
 addResourceAlias();
--- a/services/common/tests/unit/head_helpers.js
+++ b/services/common/tests/unit/head_helpers.js
@@ -1,19 +1,49 @@
 /* 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/. */
 
 /* import-globals-from head_global.js */
 
-var {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-var {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
-var {HTTP_400, HTTP_401, HTTP_402, HTTP_403, HTTP_404, HTTP_405, HTTP_406, HTTP_407, HTTP_408, HTTP_409, HTTP_410, HTTP_411, HTTP_412, HTTP_413, HTTP_414, HTTP_415, HTTP_417, HTTP_500, HTTP_501, HTTP_502, HTTP_503, HTTP_504, HTTP_505, HttpError, HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js");
-var {getTestLogger, initTestLogging} = ChromeUtils.import("resource://testing-common/services/common/logging.js");
-var {MockRegistrar} = ChromeUtils.import("resource://testing-common/MockRegistrar.jsm");
+var { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+var { CommonUtils } = ChromeUtils.import("resource://services-common/utils.js");
+var {
+  HTTP_400,
+  HTTP_401,
+  HTTP_402,
+  HTTP_403,
+  HTTP_404,
+  HTTP_405,
+  HTTP_406,
+  HTTP_407,
+  HTTP_408,
+  HTTP_409,
+  HTTP_410,
+  HTTP_411,
+  HTTP_412,
+  HTTP_413,
+  HTTP_414,
+  HTTP_415,
+  HTTP_417,
+  HTTP_500,
+  HTTP_501,
+  HTTP_502,
+  HTTP_503,
+  HTTP_504,
+  HTTP_505,
+  HttpError,
+  HttpServer,
+} = ChromeUtils.import("resource://testing-common/httpd.js");
+var { getTestLogger, initTestLogging } = ChromeUtils.import(
+  "resource://testing-common/services/common/logging.js"
+);
+var { MockRegistrar } = ChromeUtils.import(
+  "resource://testing-common/MockRegistrar.jsm"
+);
 
 function do_check_empty(obj) {
   do_check_attribute_count(obj, 0);
 }
 
 function do_check_attribute_count(obj, c) {
   Assert.equal(c, Object.keys(obj).length);
 }
@@ -23,17 +53,16 @@ function do_check_throws(aFunc, aResult)
     aFunc();
   } catch (e) {
     Assert.equal(e.result, aResult);
     return;
   }
   do_throw("Expected result " + aResult + ", none thrown.");
 }
 
-
 /**
  * Test whether specified function throws exception with expected
  * result.
  *
  * @param func
  *        Function to be tested.
  * @param message
  *        Message of expected exception. <code>null</code> for no throws.
@@ -74,17 +103,18 @@ function httpd_setup(handlers, port = -1
     _("Error: " + Log.exceptionStr(ex));
     _("Is there a process already listening on port " + port + "?");
     _("==========================================");
     do_throw(ex);
   }
 
   // Set the base URI for convenience.
   let i = server.identity;
-  server.baseURI = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort;
+  server.baseURI =
+    i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort;
 
   return server;
 }
 
 function httpd_handler(statusCode, status, body) {
   return function handler(request, response) {
     _("Processing request");
     // Allow test functions to inspect the request.
@@ -140,72 +170,128 @@ var PACSystemSettings = {
   getProxyForURI: function getProxyForURI(aURI) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 };
 
 var fakePACCID;
 function installFakePAC() {
   _("Installing fake PAC.");
-  fakePACCID = MockRegistrar.register("@mozilla.org/system-proxy-settings;1",
-                                      PACSystemSettings);
+  fakePACCID = MockRegistrar.register(
+    "@mozilla.org/system-proxy-settings;1",
+    PACSystemSettings
+  );
 }
 
 function uninstallFakePAC() {
   _("Uninstalling fake PAC.");
   MockRegistrar.unregister(fakePACCID);
 }
 
 function _eventsTelemetrySnapshot(component, source) {
-  const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+  const { Services } = ChromeUtils.import(
+    "resource://gre/modules/Services.jsm"
+  );
   const TELEMETRY_CATEGORY_ID = "uptake.remotecontent.result";
-  const snapshot = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_ALL_CHANNELS, true);
+  const snapshot = Services.telemetry.snapshotEvents(
+    Ci.nsITelemetry.DATASET_ALL_CHANNELS,
+    true
+  );
   const parentEvents = snapshot.parent || [];
-  return parentEvents
-    // Transform raw event data to objects.
-    .map(([i, category, method, object, value, extras]) => { return { category, method, object, value, extras }; })
-    // Keep only for the specified component and source.
-    .filter((e) => e.category == TELEMETRY_CATEGORY_ID && e.object == component && e.extras.source == source)
-    // Return total number of events received by status, to mimic histograms snapshots.
-    .reduce((acc, e) => {
-      acc[e.value] = (acc[e.value] || 0) + 1;
-      return acc;
-    }, {});
+  return (
+    parentEvents
+      // Transform raw event data to objects.
+      .map(([i, category, method, object, value, extras]) => {
+        return { category, method, object, value, extras };
+      })
+      // Keep only for the specified component and source.
+      .filter(
+        e =>
+          e.category == TELEMETRY_CATEGORY_ID &&
+          e.object == component &&
+          e.extras.source == source
+      )
+      // Return total number of events received by status, to mimic histograms snapshots.
+      .reduce((acc, e) => {
+        acc[e.value] = (acc[e.value] || 0) + 1;
+        return acc;
+      }, {})
+  );
 }
 
 function getUptakeTelemetrySnapshot(key) {
-  const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+  const { Services } = ChromeUtils.import(
+    "resource://gre/modules/Services.jsm"
+  );
   const TELEMETRY_HISTOGRAM_ID = "UPTAKE_REMOTE_CONTENT_RESULT_1";
   const TELEMETRY_COMPONENT = "remotesettings";
-  const histogram = Services.telemetry.getKeyedHistogramById(TELEMETRY_HISTOGRAM_ID).snapshot()[key];
+  const histogram = Services.telemetry
+    .getKeyedHistogramById(TELEMETRY_HISTOGRAM_ID)
+    .snapshot()[key];
   const events = _eventsTelemetrySnapshot(TELEMETRY_COMPONENT, key);
   return { histogram, events };
 }
 
 function checkUptakeTelemetry(snapshot1, snapshot2, expectedIncrements) {
-  const STATUSES = ["up_to_date", "success", "backoff", "pref_disabled", "parse_error", "content_error", "sign_error", "sign_retry_error", "conflict_error", "sync_error", "apply_error", "server_error", "certificate_error", "download_error", "timeout_error", "network_error", "offline_error", "cleanup_error", "unknown_error", "custom_1_error", "custom_2_error", "custom_3_error", "custom_4_error", "custom_5_error"];
+  const STATUSES = [
+    "up_to_date",
+    "success",
+    "backoff",
+    "pref_disabled",
+    "parse_error",
+    "content_error",
+    "sign_error",
+    "sign_retry_error",
+    "conflict_error",
+    "sync_error",
+    "apply_error",
+    "server_error",
+    "certificate_error",
+    "download_error",
+    "timeout_error",
+    "network_error",
+    "offline_error",
+    "cleanup_error",
+    "unknown_error",
+    "custom_1_error",
+    "custom_2_error",
+    "custom_3_error",
+    "custom_4_error",
+    "custom_5_error",
+  ];
 
   for (const status of STATUSES) {
     const key = STATUSES.indexOf(status);
     const expected = expectedIncrements[status] || 0;
     // Check histogram increments.
-    let value1 = (snapshot1 && snapshot1.histogram && snapshot1.histogram.values[key]) || 0;
-    let value2 = (snapshot2 && snapshot2.histogram && snapshot2.histogram.values[key]) || 0;
+    let value1 =
+      (snapshot1 && snapshot1.histogram && snapshot1.histogram.values[key]) ||
+      0;
+    let value2 =
+      (snapshot2 && snapshot2.histogram && snapshot2.histogram.values[key]) ||
+      0;
     let actual = value2 - value1;
     equal(expected, actual, `check histogram values for ${status}`);
     // Check events increments.
-    value1 = (snapshot1 && snapshot1.histogram && snapshot1.histogram.values[key]) || 0;
-    value2 = (snapshot2 && snapshot2.histogram && snapshot2.histogram.values[key]) || 0;
+    value1 =
+      (snapshot1 && snapshot1.histogram && snapshot1.histogram.values[key]) ||
+      0;
+    value2 =
+      (snapshot2 && snapshot2.histogram && snapshot2.histogram.values[key]) ||
+      0;
     actual = value2 - value1;
     equal(expected, actual, `check events for ${status}`);
   }
 }
 
 async function withFakeChannel(channel, f) {
-  const module = ChromeUtils.import("resource://services-common/uptake-telemetry.js", null);
+  const module = ChromeUtils.import(
+    "resource://services-common/uptake-telemetry.js",
+    null
+  );
   const oldPolicy = module.Policy;
   module.Policy = {
     ...oldPolicy,
     getChannel: () => channel,
   };
   try {
     return await f();
   } finally {
--- a/services/common/tests/unit/head_http.js
+++ b/services/common/tests/unit/head_http.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /* import-globals-from head_global.js */
 
-var {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
+var { CommonUtils } = ChromeUtils.import("resource://services-common/utils.js");
 
 function basic_auth_header(user, password) {
   return "Basic " + btoa(user + ":" + CommonUtils.encodeUTF8(password));
 }
 
 function basic_auth_matches(req, user, password) {
   if (!req.hasHeader("Authorization")) {
     return false;
--- a/services/common/tests/unit/test_async_chain.js
+++ b/services/common/tests/unit/test_async_chain.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Async} = ChromeUtils.import("resource://services-common/async.js");
+const { Async } = ChromeUtils.import("resource://services-common/async.js");
 
 function run_test() {
   _("Chain a few async methods, making sure the 'this' object is correct.");
 
   let methods = {
     save(x, callback) {
       this.x = x;
       callback(x);
@@ -19,12 +19,20 @@ function run_test() {
     },
     neg(x, callback) {
       callback(-x);
     },
   };
   methods.chain = Async.chain;
 
   // ((1 + 1 + 1) * (-1) + 1) * 2 + 1 = -3
-  methods.chain(methods.save, methods.addX, methods.addX, methods.neg,
-                methods.addX, methods.double, methods.addX, methods.save)(1);
+  methods.chain(
+    methods.save,
+    methods.addX,
+    methods.addX,
+    methods.neg,
+    methods.addX,
+    methods.double,
+    methods.addX,
+    methods.save
+  )(1);
   Assert.equal(methods.x, -3);
 }
--- a/services/common/tests/unit/test_async_foreach.js
+++ b/services/common/tests/unit/test_async_foreach.js
@@ -1,49 +1,59 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Async} = ChromeUtils.import("resource://services-common/async.js");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {sinon} = ChromeUtils.import("resource://testing-common/Sinon.jsm");
+const { Async } = ChromeUtils.import("resource://services-common/async.js");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
 
 function makeArray(length) {
   // Start at 1 so that we can just divide by yieldEvery to get the expected
   // call count. (we exp)
   return Array.from({ length }, (v, i) => i + 1);
 }
 
 // Adjust if we ever change the default.
 const DEFAULT_YIELD_EVERY = 50;
 
 add_task(async function testYields() {
   let spy = sinon.spy(Async, "promiseYield");
   try {
     await Async.yieldingForEach(makeArray(DEFAULT_YIELD_EVERY * 2), element => {
       // The yield will happen *after* this function is ran.
-      Assert.equal(spy.callCount, Math.floor((element - 1) / DEFAULT_YIELD_EVERY));
+      Assert.equal(
+        spy.callCount,
+        Math.floor((element - 1) / DEFAULT_YIELD_EVERY)
+      );
     });
   } finally {
     spy.restore();
   }
 });
 
 add_task(async function testExistingYieldState() {
   const yieldState = Async.yieldState(DEFAULT_YIELD_EVERY);
 
   for (let i = 0; i < 15; i++) {
     Assert.equal(yieldState.shouldYield(), false);
   }
 
   let spy = sinon.spy(Async, "promiseYield");
 
   try {
-    await Async.yieldingForEach(makeArray(DEFAULT_YIELD_EVERY * 2), element => {
-      Assert.equal(spy.callCount, Math.floor((element + 15 - 1) / DEFAULT_YIELD_EVERY));
-    }, yieldState);
+    await Async.yieldingForEach(
+      makeArray(DEFAULT_YIELD_EVERY * 2),
+      element => {
+        Assert.equal(
+          spy.callCount,
+          Math.floor((element + 15 - 1) / DEFAULT_YIELD_EVERY)
+        );
+      },
+      yieldState
+    );
   } finally {
     spy.restore();
   }
 });
 
 add_task(async function testEarlyReturn() {
   let lastElement = 0;
   await Async.yieldingForEach(makeArray(DEFAULT_YIELD_EVERY), element => {
@@ -51,17 +61,17 @@ add_task(async function testEarlyReturn(
     return element === 10;
   });
 
   Assert.equal(lastElement, 10);
 });
 
 add_task(async function testEaryReturnAsync() {
   let lastElement = 0;
-  await Async.yieldingForEach(makeArray(DEFAULT_YIELD_EVERY), async (element) => {
+  await Async.yieldingForEach(makeArray(DEFAULT_YIELD_EVERY), async element => {
     lastElement = element;
     return element === 10;
   });
 
   Assert.equal(lastElement, 10);
 });
 
 add_task(async function testEarlyReturnPromise() {
--- a/services/common/tests/unit/test_hawkclient.js
+++ b/services/common/tests/unit/test_hawkclient.js
@@ -1,14 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const {HawkClient} = ChromeUtils.import("resource://services-common/hawkclient.js");
+const { HawkClient } = ChromeUtils.import(
+  "resource://services-common/hawkclient.js"
+);
 
 const SECOND_MS = 1000;
 const MINUTE_MS = SECOND_MS * 60;
 const HOUR_MS = MINUTE_MS * 60;
 
 const TEST_CREDS = {
   id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x",
   key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=",
@@ -25,34 +27,37 @@ add_task(function test_now() {
 
 add_task(function test_updateClockOffset() {
   let client = new HawkClient("https://example.com");
 
   let now = new Date();
   let serverDate = now.toUTCString();
 
   // Client's clock is off
-  client.now = () => { return now.valueOf() + HOUR_MS; };
+  client.now = () => {
+    return now.valueOf() + HOUR_MS;
+  };
 
   client._updateClockOffset(serverDate);
 
   // Check that they're close; there will likely be a one-second rounding
   // error, so checking strict equality will likely fail.
   //
   // localtimeOffsetMsec is how many milliseconds to add to the local clock so
   // that it agrees with the server.  We are one hour ahead of the server, so
   // our offset should be -1 hour.
   Assert.ok(Math.abs(client.localtimeOffsetMsec + HOUR_MS) <= SECOND_MS);
 });
 
 add_task(async function test_authenticated_get_request() {
-  let message = "{\"msg\": \"Great Success!\"}";
+  let message = '{"msg": "Great Success!"}';
   let method = "GET";
 
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       Assert.ok(request.hasHeader("Authorization"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(message, message.length);
     },
   });
 
   let client = new HawkClient(server.baseURI);
@@ -61,28 +66,34 @@ add_task(async function test_authenticat
   let result = JSON.parse(response.body);
 
   Assert.equal("Great Success!", result.msg);
 
   await promiseStopServer(server);
 });
 
 async function check_authenticated_request(method) {
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       Assert.ok(request.hasHeader("Authorization"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
-      response.bodyOutputStream.writeFrom(request.bodyInputStream, request.bodyInputStream.available());
+      response.bodyOutputStream.writeFrom(
+        request.bodyInputStream,
+        request.bodyInputStream.available()
+      );
     },
   });
 
   let client = new HawkClient(server.baseURI);
 
-  let response = await client.request("/foo", method, TEST_CREDS, {foo: "bar"});
+  let response = await client.request("/foo", method, TEST_CREDS, {
+    foo: "bar",
+  });
   let result = JSON.parse(response.body);
 
   Assert.equal("bar", result.foo);
 
   await promiseStopServer(server);
 }
 
 add_task(async function test_authenticated_post_request() {
@@ -93,45 +104,54 @@ add_task(async function test_authenticat
   await check_authenticated_request("PUT");
 });
 
 add_task(async function test_authenticated_patch_request() {
   await check_authenticated_request("PATCH");
 });
 
 add_task(async function test_extra_headers() {
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       Assert.ok(request.hasHeader("Authorization"));
       Assert.ok(request.hasHeader("myHeader"));
       Assert.equal(request.getHeader("myHeader"), "fake");
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
-      response.bodyOutputStream.writeFrom(request.bodyInputStream, request.bodyInputStream.available());
+      response.bodyOutputStream.writeFrom(
+        request.bodyInputStream,
+        request.bodyInputStream.available()
+      );
     },
   });
 
   let client = new HawkClient(server.baseURI);
 
-  let response = await client.request("/foo", "POST", TEST_CREDS, {foo: "bar"},
-                                      {"myHeader": "fake"});
+  let response = await client.request(
+    "/foo",
+    "POST",
+    TEST_CREDS,
+    { foo: "bar" },
+    { myHeader: "fake" }
+  );
   let result = JSON.parse(response.body);
 
   Assert.equal("bar", result.foo);
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_credentials_optional() {
   let method = "GET";
   let server = httpd_setup({
     "/foo": (request, response) => {
       Assert.ok(!request.hasHeader("Authorization"));
 
-      let message = JSON.stringify({msg: "you're in the friend zone"});
+      let message = JSON.stringify({ msg: "you're in the friend zone" });
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
       response.bodyOutputStream.write(message, message.length);
     },
   });
 
   let client = new HawkClient(server.baseURI);
   let result = await client.request("/foo", method); // credentials undefined
@@ -139,17 +159,18 @@ add_task(async function test_credentials
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_server_error() {
   let message = "Ohai!";
   let method = "GET";
 
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       response.setStatusLine(request.httpVersion, 418, "I am a Teapot");
       response.bodyOutputStream.write(message, message.length);
     },
   });
 
   let client = new HawkClient(server.baseURI);
 
   try {
@@ -159,21 +180,26 @@ add_task(async function test_server_erro
     Assert.equal(418, err.code);
     Assert.equal("I am a Teapot", err.message);
   }
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_server_error_json() {
-  let message = JSON.stringify({error: "Cannot get ye flask."});
+  let message = JSON.stringify({ error: "Cannot get ye flask." });
   let method = "GET";
 
-  let server = httpd_setup({"/foo": (request, response) => {
-      response.setStatusLine(request.httpVersion, 400, "What wouldst thou deau?");
+  let server = httpd_setup({
+    "/foo": (request, response) => {
+      response.setStatusLine(
+        request.httpVersion,
+        400,
+        "What wouldst thou deau?"
+      );
       response.bodyOutputStream.write(message, message.length);
     },
   });
 
   let client = new HawkClient(server.baseURI);
 
   try {
     await client.request("/foo", method, TEST_CREDS);
@@ -184,25 +210,28 @@ add_task(async function test_server_erro
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_offset_after_request() {
   let message = "Ohai!";
   let method = "GET";
 
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(message, message.length);
     },
   });
 
   let client = new HawkClient(server.baseURI);
   let now = Date.now();
-  client.now = () => { return now + HOUR_MS; };
+  client.now = () => {
+    return now + HOUR_MS;
+  };
 
   Assert.equal(client.localtimeOffsetMsec, 0);
 
   await client.request("/foo", method, TEST_CREDS);
   // Should be about an hour off
   Assert.ok(Math.abs(client.localtimeOffsetMsec + HOUR_MS) < SECOND_MS);
 
   await promiseStopServer(server);
@@ -255,17 +284,18 @@ add_task(async function test_2xx_success
   // Just to ensure that we're not biased toward 200 OK for success
   let credentials = {
     id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x",
     key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=",
     algorithm: "sha256",
   };
   let method = "GET";
 
-  let server = httpd_setup({"/foo": (request, response) => {
+  let server = httpd_setup({
+    "/foo": (request, response) => {
       response.setStatusLine(request.httpVersion, 202, "Accepted");
     },
   });
 
   let client = new HawkClient(server.baseURI);
 
   let response = await client.request("/foo", method, credentials);
 
@@ -469,16 +499,17 @@ add_task(async function test_401_then_50
   await promiseStopServer(server);
 });
 
 // End of tests.
 // Utility functions follow
 
 function getTimestampDelta(authHeader, now = Date.now()) {
   let tsMS = new Date(
-      parseInt(/ts="(\d+)"/.exec(authHeader)[1], 10) * SECOND_MS);
+    parseInt(/ts="(\d+)"/.exec(authHeader)[1], 10) * SECOND_MS
+  );
   return Math.abs(tsMS - now);
 }
 
 function run_test() {
   initTestLogging("Trace");
   run_next_test();
 }
--- a/services/common/tests/unit/test_hawkrequest.js
+++ b/services/common/tests/unit/test_hawkrequest.js
@@ -1,27 +1,33 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const {HAWKAuthenticatedRESTRequest, deriveHawkCredentials} = ChromeUtils.import("resource://services-common/hawkrequest.js");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {Async} = ChromeUtils.import("resource://services-common/async.js");
+const {
+  HAWKAuthenticatedRESTRequest,
+  deriveHawkCredentials,
+} = ChromeUtils.import("resource://services-common/hawkrequest.js");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Async } = ChromeUtils.import("resource://services-common/async.js");
 
 // https://github.com/mozilla/fxa-auth-server/wiki/onepw-protocol#wiki-use-session-certificatesign-etc
 var SESSION_KEYS = {
-  sessionToken: h("a0a1a2a3a4a5a6a7 a8a9aaabacadaeaf" +
-                  "b0b1b2b3b4b5b6b7 b8b9babbbcbdbebf"),
+  sessionToken: h(
+    "a0a1a2a3a4a5a6a7 a8a9aaabacadaeaf" + "b0b1b2b3b4b5b6b7 b8b9babbbcbdbebf"
+  ),
 
-  tokenID:      h("c0a29dcf46174973 da1378696e4c82ae" +
-                  "10f723cf4f4d9f75 e39f4ae3851595ab"),
+  tokenID: h(
+    "c0a29dcf46174973 da1378696e4c82ae" + "10f723cf4f4d9f75 e39f4ae3851595ab"
+  ),
 
-  reqHMACkey:   h("9d8f22998ee7f579 8b887042466b72d5" +
-                  "3e56ab0c094388bf 65831f702d2febc0"),
+  reqHMACkey: h(
+    "9d8f22998ee7f579 8b887042466b72d5" + "3e56ab0c094388bf 65831f702d2febc0"
+  ),
 };
 
 function do_register_cleanup() {
   Services.prefs.resetUserPrefs();
 
   // remove the pref change listener
   let hawk = new HAWKAuthenticatedRESTRequest("https://example.com");
   hawk._intl.uninit();
@@ -30,22 +36,21 @@ function do_register_cleanup() {
 function run_test() {
   Log.repository.getLogger("Services.Common.RESTRequest").level =
     Log.Level.Trace;
   initTestLogging("Trace");
 
   run_next_test();
 }
 
-
 add_test(function test_intl_accept_language() {
   let testCount = 0;
   let languages = [
-    "zu-NP;vo",     // Nepalese dialect of Zulu, defaulting to Volapük
-    "fa-CG;ik",     // Congolese dialect of Farsei, defaulting to Inupiaq
+    "zu-NP;vo", // Nepalese dialect of Zulu, defaulting to Volapük
+    "fa-CG;ik", // Congolese dialect of Farsei, defaulting to Inupiaq
   ];
 
   function setLanguagePref(lang) {
     Services.prefs.setStringPref("intl.accept_languages", lang);
   }
 
   let hawk = new HAWKAuthenticatedRESTRequest("https://example.com");
 
@@ -62,25 +67,29 @@ add_test(function test_intl_accept_langu
       testCount++;
       if (testCount < languages.length) {
         // Set next language in prefs; Pref service will call checkNextLanguage.
         setLanguagePref(languages[testCount]);
         return;
       }
 
       // We've checked all the entries in languages[]. Cleanup and move on.
-      info("Checked " + testCount + " languages. Removing checkLanguagePref as pref observer.");
+      info(
+        "Checked " +
+          testCount +
+          " languages. Removing checkLanguagePref as pref observer."
+      );
       Services.prefs.removeObserver("intl.accept_languages", checkLanguagePref);
       run_next_test();
     });
   }
 });
 
 add_task(async function test_hawk_authenticated_request() {
-  let postData = {your: "data"};
+  let postData = { your: "data" };
 
   // An arbitrary date - Feb 2, 1971.  It ends in a bunch of zeroes to make our
   // computation with the hawk timestamp easier, since hawk throws away the
   // millisecond values.
   let then = 34329600000;
 
   let clockSkew = 120000;
   let timeOffset = -1 * clockSkew;
@@ -133,26 +142,28 @@ add_task(async function test_hawk_authen
   await Async.promiseYield();
 
   await request.post(postData);
   Assert.equal(200, request.response.status);
   Assert.equal(request.response.body, "yay");
 
   Services.prefs.resetUserPrefs();
   let pref = Services.prefs.getComplexValue(
-    "intl.accept_languages", Ci.nsIPrefLocalizedString);
+    "intl.accept_languages",
+    Ci.nsIPrefLocalizedString
+  );
   Assert.notEqual(acceptLanguage, pref.data);
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_hawk_language_pref_changed() {
   let languages = [
-    "zu-NP",        // Nepalese dialect of Zulu
-    "fa-CG",        // Congolese dialect of Farsi
+    "zu-NP", // Nepalese dialect of Zulu
+    "fa-CG", // Congolese dialect of Farsi
   ];
 
   let credentials = {
     id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x",
     key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=",
     algorithm: "sha256",
   };
 
@@ -179,30 +190,35 @@ add_task(async function test_hawk_langua
 
   // Wait for change to propagate
   await Async.promiseYield();
   Assert.equal(languages[0], request._intl.accept_languages);
 
   // Change the language pref ...
   setLanguage(languages[1]);
 
-
   await Async.promiseYield();
 
   request = new HAWKAuthenticatedRESTRequest(url, credentials);
   let response = await request.post({});
 
   Assert.equal(200, response.status);
   Services.prefs.resetUserPrefs();
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_deriveHawkCredentials() {
-  let credentials = await deriveHawkCredentials(SESSION_KEYS.sessionToken, "sessionToken");
+  let credentials = await deriveHawkCredentials(
+    SESSION_KEYS.sessionToken,
+    "sessionToken"
+  );
   Assert.equal(credentials.id, SESSION_KEYS.tokenID);
-  Assert.equal(CommonUtils.bytesAsHex(credentials.key), SESSION_KEYS.reqHMACkey);
+  Assert.equal(
+    CommonUtils.bytesAsHex(credentials.key),
+    SESSION_KEYS.reqHMACkey
+  );
 });
 
 // turn formatted test vectors into normal hex strings
 function h(hexStr) {
   return hexStr.replace(/\s+/g, "");
 }
--- a/services/common/tests/unit/test_kinto.js
+++ b/services/common/tests/unit/test_kinto.js
@@ -1,32 +1,39 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Kinto} = ChromeUtils.import("resource://services-common/kinto-offline-client.js");
-const {FirefoxAdapter} = ChromeUtils.import("resource://services-common/kinto-storage-adapter.js");
+const { Kinto } = ChromeUtils.import(
+  "resource://services-common/kinto-offline-client.js"
+);
+const { FirefoxAdapter } = ChromeUtils.import(
+  "resource://services-common/kinto-storage-adapter.js"
+);
 
-const BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
-  "nsIBinaryInputStream", "setInputStream");
+const BinaryInputStream = Components.Constructor(
+  "@mozilla.org/binaryinputstream;1",
+  "nsIBinaryInputStream",
+  "setInputStream"
+);
 
 var server;
 
 // set up what we need to make storage adapters
 const kintoFilename = "kinto.sqlite";
 
 function do_get_kinto_sqliteHandle() {
-  return FirefoxAdapter.openConnection({path: kintoFilename});
+  return FirefoxAdapter.openConnection({ path: kintoFilename });
 }
 
 function do_get_kinto_collection(sqliteHandle, collection = "test_collection") {
   let config = {
     remote: `http://localhost:${server.identity.primaryPort}/v1/`,
-    headers: {Authorization: "Basic " + btoa("user:pass")},
+    headers: { Authorization: "Basic " + btoa("user:pass") },
     adapter: FirefoxAdapter,
-    adapterOptions: {sqliteHandle},
+    adapterOptions: { sqliteHandle },
   };
   return new Kinto(config).collection(collection);
 }
 
 async function clear_collection() {
   let sqliteHandle;
   try {
     sqliteHandle = await do_get_kinto_sqliteHandle();
@@ -51,17 +58,17 @@ add_task(async function test_kinto_add_g
     // check getting the record gets the same info
     let getResult = await collection.get(createResult.data.id);
     deepEqual(createResult.data, getResult.data);
     // check what happens if we create the same item again (it should throw
     // since you can't create with id)
     try {
       await collection.create(createResult.data);
       do_throw("Creation of a record with an id should fail");
-    } catch (err) { }
+    } catch (err) {}
     // try a few creates without waiting for the first few to resolve
     let promises = [];
     promises.push(collection.create(newRecord));
     promises.push(collection.create(newRecord));
     promises.push(collection.create(newRecord));
     await collection.create(newRecord);
     await Promise.all(promises);
   } finally {
@@ -72,31 +79,36 @@ add_task(async function test_kinto_add_g
 add_task(clear_collection);
 
 // test some operations on multiple connections
 add_task(async function test_kinto_add_get() {
   let sqliteHandle;
   try {
     sqliteHandle = await do_get_kinto_sqliteHandle();
     const collection1 = do_get_kinto_collection(sqliteHandle);
-    const collection2 = do_get_kinto_collection(sqliteHandle, "test_collection_2");
+    const collection2 = do_get_kinto_collection(
+      sqliteHandle,
+      "test_collection_2"
+    );
 
     let newRecord = { foo: "bar" };
 
     // perform several write operations alternately without waiting for promises
     // to resolve
     let promises = [];
     for (let i = 0; i < 10; i++) {
       promises.push(collection1.create(newRecord));
       promises.push(collection2.create(newRecord));
     }
 
     // ensure subsequent operations still work
-    await Promise.all([collection1.create(newRecord),
-                       collection2.create(newRecord)]);
+    await Promise.all([
+      collection1.create(newRecord),
+      collection2.create(newRecord),
+    ]);
     await Promise.all(promises);
   } finally {
     await sqliteHandle.close();
   }
 });
 
 add_task(clear_collection);
 
@@ -168,17 +180,17 @@ add_task(async function test_kinto_delet
     // delete that record
     let deleteResult = await collection.delete(createResult.data.id);
     // check the ID is set on the result
     Assert.equal(getResult.data.id, deleteResult.data.id);
     // and check that get no longer returns the record
     try {
       getResult = await collection.get(createResult.data.id);
       do_throw("there should not be a result");
-    } catch (e) { }
+    } catch (e) {}
   } finally {
     await sqliteHandle.close();
   }
 });
 
 add_task(async function test_kinto_list() {
   let sqliteHandle;
   try {
@@ -213,101 +225,121 @@ add_task(async function test_kinto_list(
 
 add_task(clear_collection);
 
 add_task(async function test_importBulk_ignores_already_imported_records() {
   let sqliteHandle;
   try {
     sqliteHandle = await do_get_kinto_sqliteHandle();
     const collection = do_get_kinto_collection(sqliteHandle);
-    const record = {id: "41b71c13-17e9-4ee3-9268-6a41abf9730f", title: "foo", last_modified: 1457896541};
+    const record = {
+      id: "41b71c13-17e9-4ee3-9268-6a41abf9730f",
+      title: "foo",
+      last_modified: 1457896541,
+    };
     await collection.importBulk([record]);
     let impactedRecords = await collection.importBulk([record]);
     Assert.equal(impactedRecords.length, 0);
   } finally {
     await sqliteHandle.close();
   }
 });
 
 add_task(clear_collection);
 
 add_task(async function test_loadDump_should_overwrite_old_records() {
   let sqliteHandle;
   try {
     sqliteHandle = await do_get_kinto_sqliteHandle();
     const collection = do_get_kinto_collection(sqliteHandle);
-    const record = {id: "41b71c13-17e9-4ee3-9268-6a41abf9730f", title: "foo", last_modified: 1457896541};
+    const record = {
+      id: "41b71c13-17e9-4ee3-9268-6a41abf9730f",
+      title: "foo",
+      last_modified: 1457896541,
+    };
     await collection.loadDump([record]);
-    const updated = Object.assign({}, record, {last_modified: 1457896543});
+    const updated = Object.assign({}, record, { last_modified: 1457896543 });
     let impactedRecords = await collection.loadDump([updated]);
     Assert.equal(impactedRecords.length, 1);
   } finally {
     await sqliteHandle.close();
   }
 });
 
 add_task(clear_collection);
 
 add_task(async function test_loadDump_should_not_overwrite_unsynced_records() {
   let sqliteHandle;
   try {
     sqliteHandle = await do_get_kinto_sqliteHandle();
     const collection = do_get_kinto_collection(sqliteHandle);
     const recordId = "41b71c13-17e9-4ee3-9268-6a41abf9730f";
-    await collection.create({id: recordId, title: "foo"}, {useRecordId: true});
-    const record = {id: recordId, title: "bar", last_modified: 1457896541};
+    await collection.create(
+      { id: recordId, title: "foo" },
+      { useRecordId: true }
+    );
+    const record = { id: recordId, title: "bar", last_modified: 1457896541 };
     let impactedRecords = await collection.loadDump([record]);
     Assert.equal(impactedRecords.length, 0);
   } finally {
     await sqliteHandle.close();
   }
 });
 
 add_task(clear_collection);
 
-add_task(async function test_loadDump_should_not_overwrite_records_without_last_modified() {
-  let sqliteHandle;
-  try {
-    sqliteHandle = await do_get_kinto_sqliteHandle();
-    const collection = do_get_kinto_collection(sqliteHandle);
-    const recordId = "41b71c13-17e9-4ee3-9268-6a41abf9730f";
-    await collection.create({id: recordId, title: "foo"}, {synced: true});
-    const record = {id: recordId, title: "bar", last_modified: 1457896541};
-    let impactedRecords = await collection.loadDump([record]);
-    Assert.equal(impactedRecords.length, 0);
-  } finally {
-    await sqliteHandle.close();
+add_task(
+  async function test_loadDump_should_not_overwrite_records_without_last_modified() {
+    let sqliteHandle;
+    try {
+      sqliteHandle = await do_get_kinto_sqliteHandle();
+      const collection = do_get_kinto_collection(sqliteHandle);
+      const recordId = "41b71c13-17e9-4ee3-9268-6a41abf9730f";
+      await collection.create({ id: recordId, title: "foo" }, { synced: true });
+      const record = { id: recordId, title: "bar", last_modified: 1457896541 };
+      let impactedRecords = await collection.loadDump([record]);
+      Assert.equal(impactedRecords.length, 0);
+    } finally {
+      await sqliteHandle.close();
+    }
   }
-});
+);
 
 add_task(clear_collection);
 
 // Now do some sanity checks against a server - we're not looking to test
 // core kinto.js functionality here (there is excellent test coverage in
 // kinto.js), more making sure things are basically working as expected.
 add_task(async function test_kinto_sync() {
   const configPath = "/v1/";
   const metadataPath = "/v1/buckets/default/collections/test_collection";
   const recordsPath = "/v1/buckets/default/collections/test_collection/records";
   // register a handler
   function handleResponse(request, response) {
     try {
       const sampled = getSampleResponse(request, server.identity.primaryPort);
       if (!sampled) {
-        do_throw(`unexpected ${request.method} request for ${request.path}?${request.queryString}`);
+        do_throw(
+          `unexpected ${request.method} request for ${request.path}?${
+            request.queryString
+          }`
+        );
       }
 
-      response.setStatusLine(null, sampled.status.status,
-                             sampled.status.statusText);
+      response.setStatusLine(
+        null,
+        sampled.status.status,
+        sampled.status.statusText
+      );
       // send the headers
       for (let headerLine of sampled.sampleHeaders) {
         let headerElements = headerLine.split(":");
         response.setHeader(headerElements[0], headerElements[1].trimLeft());
       }
-      response.setHeader("Date", (new Date()).toUTCString());
+      response.setHeader("Date", new Date().toUTCString());
 
       response.write(sampled.responseBody);
     } catch (e) {
       dump(`${e}\n`);
     }
   }
   server.registerPathHandler(configPath, handleResponse);
   server.registerPathHandler(metadataPath, handleResponse);
@@ -352,125 +384,134 @@ add_task(async function test_kinto_sync(
 function run_test() {
   // Set up an HTTP Server
   server = new HttpServer();
   server.start(-1);
 
   run_next_test();
 
   registerCleanupFunction(function() {
-    server.stop(function() { });
+    server.stop(function() {});
   });
 }
 
 // get a response for a given request from sample data
 function getSampleResponse(req, port) {
   const responses = {
-    "OPTIONS": {
-      "sampleHeaders": [
+    OPTIONS: {
+      sampleHeaders: [
         "Access-Control-Allow-Headers: Content-Length,Expires,Backoff,Retry-After,Last-Modified,Total-Records,ETag,Pragma,Cache-Control,authorization,content-type,if-none-match,Alert,Next-Page",
         "Access-Control-Allow-Methods: GET,HEAD,OPTIONS,POST,DELETE,OPTIONS",
         "Access-Control-Allow-Origin: *",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
       ],
-      "status": {status: 200, statusText: "OK"},
-      "responseBody": "null",
+      status: { status: 200, statusText: "OK" },
+      responseBody: "null",
     },
     "GET:/v1/?": {
-      "sampleHeaders": [
+      sampleHeaders: [
         "Access-Control-Allow-Origin: *",
         "Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
       ],
-      "status": {status: 200, statusText: "OK"},
-      "responseBody": JSON.stringify({
-        "settings": {
-          "batch_max_requests": 25,
+      status: { status: 200, statusText: "OK" },
+      responseBody: JSON.stringify({
+        settings: {
+          batch_max_requests: 25,
         },
-        "url": `http://localhost:${port}/v1/`,
-        "documentation": "https://kinto.readthedocs.org/",
-        "version": "1.5.1",
-        "commit": "cbc6f58",
-        "hello": "kinto",
+        url: `http://localhost:${port}/v1/`,
+        documentation: "https://kinto.readthedocs.org/",
+        version: "1.5.1",
+        commit: "cbc6f58",
+        hello: "kinto",
       }),
     },
     "GET:/v1/buckets/default/collections/test_collection": {
-      "sampleHeaders": [
+      sampleHeaders: [
         "Access-Control-Allow-Origin: *",
         "Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
-        "Etag: \"1234\"",
+        'Etag: "1234"',
       ],
-      "status": { status: 200, statusText: "OK" },
-      "responseBody": JSON.stringify({
-        "data": {
-          "id": "test_collection",
-          "last_modified": 1234,
+      status: { status: 200, statusText: "OK" },
+      responseBody: JSON.stringify({
+        data: {
+          id: "test_collection",
+          last_modified: 1234,
         },
       }),
     },
     "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified": {
-      "sampleHeaders": [
+      sampleHeaders: [
         "Access-Control-Allow-Origin: *",
         "Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
-        "Etag: \"1445606341071\"",
+        'Etag: "1445606341071"',
       ],
-      "status": {status: 200, statusText: "OK"},
-      "responseBody": JSON.stringify({
-        "data": [{
-          "last_modified": 1445606341071,
-          "done": false,
-          "id": "68db8313-686e-4fff-835e-07d78ad6f2af",
-          "title": "New test",
-        }],
+      status: { status: 200, statusText: "OK" },
+      responseBody: JSON.stringify({
+        data: [
+          {
+            last_modified: 1445606341071,
+            done: false,
+            id: "68db8313-686e-4fff-835e-07d78ad6f2af",
+            title: "New test",
+          },
+        ],
       }),
     },
     "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445606341071": {
-      "sampleHeaders": [
+      sampleHeaders: [
         "Access-Control-Allow-Origin: *",
         "Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
-        "Etag: \"1445607941223\"",
+        'Etag: "1445607941223"',
       ],
-      "status": {status: 200, statusText: "OK"},
-      "responseBody": JSON.stringify({
-        "data": [{
-          "last_modified": 1445607941223,
-          "done": false,
-          "id": "901967b0-f729-4b30-8d8d-499cba7f4b1d",
-          "title": "Another new test",
-        }],
+      status: { status: 200, statusText: "OK" },
+      responseBody: JSON.stringify({
+        data: [
+          {
+            last_modified: 1445607941223,
+            done: false,
+            id: "901967b0-f729-4b30-8d8d-499cba7f4b1d",
+            title: "Another new test",
+          },
+        ],
       }),
     },
     "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445607941223": {
-      "sampleHeaders": [
+      sampleHeaders: [
         "Access-Control-Allow-Origin: *",
         "Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
         "Content-Type: application/json; charset=UTF-8",
         "Server: waitress",
-        "Etag: \"1445607541267\"",
+        'Etag: "1445607541267"',
       ],
-      "status": {status: 200, statusText: "OK"},
-      "responseBody": JSON.stringify({
-        "data": [{
-          "last_modified": 1445607541265,
-          "done": false,
-          "id": "901967b0-f729-4b30-8d8d-499cba7f4b1d",
-          "title": "Modified title",
-        }, {
-          "last_modified": 1445607541267,
-          "done": true,
-          "id": "some-manually-chosen-id",
-          "title": "New record with custom ID",
-        }],
+      status: { status: 200, statusText: "OK" },
+      responseBody: JSON.stringify({
+        data: [
+          {
+            last_modified: 1445607541265,
+            done: false,
+            id: "901967b0-f729-4b30-8d8d-499cba7f4b1d",
+            title: "Modified title",
+          },
+          {
+            last_modified: 1445607541267,
+            done: true,
+            id: "some-manually-chosen-id",
+            title: "New record with custom ID",
+          },
+        ],
       }),
     },
   };
-  return responses[`${req.method}:${req.path}?${req.queryString}`] ||
-         responses[`${req.method}:${req.path}`] ||
-         responses[req.method];
+  return (
+    responses[`${req.method}:${req.path}?${req.queryString}`] ||
+    responses[`${req.method}:${req.path}`] ||
+    responses[req.method]
+  );
 }
--- a/services/common/tests/unit/test_load_modules.js
+++ b/services/common/tests/unit/test_load_modules.js
@@ -1,29 +1,22 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 
 const MODULE_BASE = "resource://services-common/";
-const shared_modules = [
-  "async.js",
-  "logmanager.js",
-  "rest.js",
-  "utils.js",
-];
+const shared_modules = ["async.js", "logmanager.js", "rest.js", "utils.js"];
 
-const non_android_modules = [
-  "tokenserverclient.js",
-];
+const non_android_modules = ["tokenserverclient.js"];
 
 const TEST_BASE = "resource://testing-common/services/common/";
-const shared_test_modules = [
-  "logging.js",
-];
+const shared_test_modules = ["logging.js"];
 
 function expectImportsToSucceed(mm, base = MODULE_BASE) {
   for (let m of mm) {
     let resource = base + m;
     let succeeded = false;
     try {
       ChromeUtils.import(resource, {});
       succeeded = true;
--- a/services/common/tests/unit/test_logmanager.js
+++ b/services/common/tests/unit/test_logmanager.js
@@ -1,26 +1,32 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // NOTE: The sync test_errorhandler_* tests have quite good coverage for
 // other aspects of this.
 
-const {LogManager} = ChromeUtils.import("resource://services-common/logmanager.js");
-const {FileUtils} = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { LogManager } = ChromeUtils.import(
+  "resource://services-common/logmanager.js"
+);
+const { FileUtils } = ChromeUtils.import(
+  "resource://gre/modules/FileUtils.jsm"
+);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 // Returns an array of [consoleAppender, dumpAppender, [fileAppenders]] for
 // the specified log.  Note that fileAppenders will usually have length=1
 function getAppenders(log) {
   let capps = log.appenders.filter(app => app instanceof Log.ConsoleAppender);
   equal(capps.length, 1, "should only have one console appender");
   let dapps = log.appenders.filter(app => app instanceof Log.DumpAppender);
   equal(dapps.length, 1, "should only have one dump appender");
-  let fapps = log.appenders.filter(app => app instanceof LogManager.StorageStreamAppender);
+  let fapps = log.appenders.filter(
+    app => app instanceof LogManager.StorageStreamAppender
+  );
   return [capps[0], dapps[0], fapps];
 }
 
 // Test that the correct thing happens when no prefs exist for the log manager.
 add_task(async function test_noPrefs() {
   // tell the log manager to init with a pref branch that doesn't exist.
   let lm = new LogManager("no-such-branch.", ["TestLog"], "test");
 
@@ -34,68 +40,92 @@ add_task(async function test_noPrefs() {
   equal(fapps[0].level, Log.Level.Debug);
   lm.finalize();
 });
 
 // Test that changes to the prefs used by the log manager are updated dynamically.
 add_task(async function test_PrefChanges() {
   Services.prefs.setCharPref("log-manager.test.log.appender.console", "Trace");
   Services.prefs.setCharPref("log-manager.test.log.appender.dump", "Trace");
-  Services.prefs.setCharPref("log-manager.test.log.appender.file.level", "Trace");
+  Services.prefs.setCharPref(
+    "log-manager.test.log.appender.file.level",
+    "Trace"
+  );
   let lm = new LogManager("log-manager.test.", ["TestLog2"], "test");
 
   let log = Log.repository.getLogger("TestLog2");
   let [capp, dapp, [fapp]] = getAppenders(log);
   equal(capp.level, Log.Level.Trace);
   equal(dapp.level, Log.Level.Trace);
   equal(fapp.level, Log.Level.Trace);
   // adjust the prefs and they should magically be reflected in the appenders.
   Services.prefs.setCharPref("log-manager.test.log.appender.console", "Debug");
   Services.prefs.setCharPref("log-manager.test.log.appender.dump", "Debug");
-  Services.prefs.setCharPref("log-manager.test.log.appender.file.level", "Debug");
+  Services.prefs.setCharPref(
+    "log-manager.test.log.appender.file.level",
+    "Debug"
+  );
   equal(capp.level, Log.Level.Debug);
   equal(dapp.level, Log.Level.Debug);
   equal(fapp.level, Log.Level.Debug);
   // and invalid values should cause them to fallback to their defaults.
   Services.prefs.setCharPref("log-manager.test.log.appender.console", "xxx");
   Services.prefs.setCharPref("log-manager.test.log.appender.dump", "xxx");
   Services.prefs.setCharPref("log-manager.test.log.appender.file.level", "xxx");
   equal(capp.level, Log.Level.Fatal);
   equal(dapp.level, Log.Level.Error);
   equal(fapp.level, Log.Level.Debug);
   lm.finalize();
 });
 
 // Test that the same log used by multiple log managers does the right thing.
 add_task(async function test_SharedLogs() {
   // create the prefs for the first instance.
-  Services.prefs.setCharPref("log-manager-1.test.log.appender.console", "Trace");
+  Services.prefs.setCharPref(
+    "log-manager-1.test.log.appender.console",
+    "Trace"
+  );
   Services.prefs.setCharPref("log-manager-1.test.log.appender.dump", "Trace");
-  Services.prefs.setCharPref("log-manager-1.test.log.appender.file.level", "Trace");
+  Services.prefs.setCharPref(
+    "log-manager-1.test.log.appender.file.level",
+    "Trace"
+  );
   let lm1 = new LogManager("log-manager-1.test.", ["TestLog3"], "test");
 
   // and the second.
-  Services.prefs.setCharPref("log-manager-2.test.log.appender.console", "Debug");
+  Services.prefs.setCharPref(
+    "log-manager-2.test.log.appender.console",
+    "Debug"
+  );
   Services.prefs.setCharPref("log-manager-2.test.log.appender.dump", "Debug");
-  Services.prefs.setCharPref("log-manager-2.test.log.appender.file.level", "Debug");
+  Services.prefs.setCharPref(
+    "log-manager-2.test.log.appender.file.level",
+    "Debug"
+  );
   let lm2 = new LogManager("log-manager-2.test.", ["TestLog3"], "test");
 
   let log = Log.repository.getLogger("TestLog3");
-  let [capp, dapp ] = getAppenders(log);
+  let [capp, dapp] = getAppenders(log);
 
   // console and dump appenders should be "trace" as it is more verbose than
   // "debug"
   equal(capp.level, Log.Level.Trace);
   equal(dapp.level, Log.Level.Trace);
 
   // Set the prefs on the -1 branch to "Error" - it should then end up with
   // "Debug" from the -2 branch.
-  Services.prefs.setCharPref("log-manager-1.test.log.appender.console", "Error");
+  Services.prefs.setCharPref(
+    "log-manager-1.test.log.appender.console",
+    "Error"
+  );
   Services.prefs.setCharPref("log-manager-1.test.log.appender.dump", "Error");
-  Services.prefs.setCharPref("log-manager-1.test.log.appender.file.level", "Error");
+  Services.prefs.setCharPref(
+    "log-manager-1.test.log.appender.file.level",
+    "Error"
+  );
 
   equal(capp.level, Log.Level.Debug);
   equal(dapp.level, Log.Level.Debug);
 
   lm1.finalize();
   lm2.finalize();
 });
 
@@ -128,29 +158,38 @@ add_task(async function test_logFileErro
   // One error log file exists.
   checkLogFile("error");
 
   lm.finalize();
 });
 
 // Test that we correctly write success logs.
 add_task(async function test_logFileSuccess() {
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnError", false);
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", false);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnError",
+    false
+  );
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    false
+  );
 
   let lm = new LogManager("log-manager.test.", ["TestLog2"], "test");
 
   let log = Log.repository.getLogger("TestLog2");
   log.info("an info message");
   await lm.resetFileLog();
   // Zero log files exist.
   checkLogFile(null);
 
   // Reset logOnSuccess and do it again - log should appear.
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", true);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    true
+  );
   log.info("an info message");
   await lm.resetFileLog();
 
   checkLogFile("success");
 
   // Now test with no "reason" specified and no "error" record.
   log.info("an info message");
   await lm.resetFileLog();
@@ -169,38 +208,53 @@ add_task(async function test_logFileSucc
   await lm.resetFileLog();
   checkLogFile("success");
 
   lm.finalize();
 });
 
 // Test that we correctly write error logs.
 add_task(async function test_logFileError() {
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnError", false);
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", false);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnError",
+    false
+  );
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    false
+  );
 
   let lm = new LogManager("log-manager.test.", ["TestLog2"], "test");
 
   let log = Log.repository.getLogger("TestLog2");
   log.info("an info message");
   let reason = await lm.resetFileLog();
   Assert.equal(reason, null, "null returned when no file created.");
   // Zero log files exist.
   checkLogFile(null);
 
   // Reset logOnSuccess - success logs should appear if no error records.
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", true);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    true
+  );
   log.info("an info message");
   reason = await lm.resetFileLog();
   Assert.equal(reason, lm.SUCCESS_LOG_WRITTEN);
   checkLogFile("success");
 
   // Set logOnError and unset logOnSuccess - error logs should appear.
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", false);
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnError", true);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    false
+  );
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnError",
+    true
+  );
   log.error("an error message");
   reason = await lm.resetFileLog();
   Assert.equal(reason, lm.ERROR_LOG_WRITTEN);
   checkLogFile("error");
 
   // Now test with no "error" record.
   log.info("an info message");
   reason = await lm.resetFileLog();
@@ -231,28 +285,38 @@ function countLogFiles() {
     void entry;
     count += 1;
   }
   return count;
 }
 
 // Test that removeAllLogs removes all log files.
 add_task(async function test_logFileError() {
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnError", true);
-  Services.prefs.setBoolPref("log-manager.test.log.appender.file.logOnSuccess", true);
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnError",
+    true
+  );
+  Services.prefs.setBoolPref(
+    "log-manager.test.log.appender.file.logOnSuccess",
+    true
+  );
 
   let lm = new LogManager("log-manager.test.", ["TestLog2"], "test");
 
   let log = Log.repository.getLogger("TestLog2");
   log.info("an info message");
   let reason = await lm.resetFileLog();
   Assert.equal(reason, lm.SUCCESS_LOG_WRITTEN, "success log was written.");
 
   log.error("an error message");
   reason = await lm.resetFileLog();
   Assert.equal(reason, lm.ERROR_LOG_WRITTEN);
 
   Assert.equal(countLogFiles(), 2, "expect 2 log files");
   await lm.removeAllLogs();
-  Assert.equal(countLogFiles(), 0, "should be no log files after removing them");
+  Assert.equal(
+    countLogFiles(),
+    0,
+    "should be no log files after removing them"
+  );
 
   lm.finalize();
 });
--- a/services/common/tests/unit/test_observers.js
+++ b/services/common/tests/unit/test_observers.js
@@ -1,12 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Observers} = ChromeUtils.import("resource://services-common/observers.js");
+const { Observers } = ChromeUtils.import(
+  "resource://services-common/observers.js"
+);
 
 var gSubject = {};
 
 add_test(function test_function_observer() {
   let foo = false;
 
   let onFoo = function(subject, data) {
     foo = !foo;
--- a/services/common/tests/unit/test_restrequest.js
+++ b/services/common/tests/unit/test_restrequest.js
@@ -1,15 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {RESTRequest} = ChromeUtils.import("resource://services-common/rest.js");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { RESTRequest } = ChromeUtils.import(
+  "resource://services-common/rest.js"
+);
 
 function run_test() {
   Log.repository.getLogger("Services.Common.RESTRequest").level =
     Log.Level.Trace;
   initTestLogging("Trace");
 
   run_next_test();
 }
@@ -31,49 +33,54 @@ add_test(function test_invalid_uri() {
 add_test(function test_attributes() {
   let uri = "http://foo.com/bar/baz";
   let request = new RESTRequest(uri);
 
   Assert.ok(request.uri instanceof Ci.nsIURI);
   Assert.equal(request.uri.spec, uri);
   Assert.equal(request.response, null);
   Assert.equal(request.status, request.NOT_SENT);
-  let expectedLoadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE |
-                          Ci.nsIRequest.INHIBIT_CACHING |
-                          Ci.nsIRequest.LOAD_ANONYMOUS;
+  let expectedLoadFlags =
+    Ci.nsIRequest.LOAD_BYPASS_CACHE |
+    Ci.nsIRequest.INHIBIT_CACHING |
+    Ci.nsIRequest.LOAD_ANONYMOUS;
   Assert.equal(request.loadFlags, expectedLoadFlags);
 
   run_next_test();
 });
 
 /**
  * Verify that a proxy auth redirect doesn't break us. This has to be the first
  * request made in the file!
  */
 add_task(async function test_proxy_auth_redirect() {
   let pacFetched = false;
   function pacHandler(metadata, response) {
     pacFetched = true;
     let body = 'function FindProxyForURL(url, host) { return "DIRECT"; }';
     response.setStatusLine(metadata.httpVersion, 200, "OK");
-    response.setHeader("Content-Type", "application/x-ns-proxy-autoconfig", false);
+    response.setHeader(
+      "Content-Type",
+      "application/x-ns-proxy-autoconfig",
+      false
+    );
     response.bodyOutputStream.write(body, body.length);
   }
 
   let fetched = false;
   function original(metadata, response) {
     fetched = true;
     let body = "TADA!";
     response.setStatusLine(metadata.httpVersion, 200, "OK");
     response.bodyOutputStream.write(body, body.length);
   }
 
   let server = httpd_setup({
     "/original": original,
-    "/pac3":     pacHandler,
+    "/pac3": pacHandler,
   });
   PACSystemSettings.PACURI = server.baseURI + "/pac3";
   installFakePAC();
 
   let req = new RESTRequest(server.baseURI + "/original");
   await req.get();
 
   Assert.ok(pacFetched);
@@ -88,26 +95,28 @@ add_task(async function test_proxy_auth_
 /**
  * Ensure that failures that cause asyncOpen to throw
  * result in callbacks being invoked.
  * Bug 826086.
  */
 add_task(async function test_forbidden_port() {
   let request = new RESTRequest("http://localhost:6000/");
 
-  await Assert.rejects(request.get(), error =>
-    error.result == Cr.NS_ERROR_PORT_ACCESS_NOT_ALLOWED);
+  await Assert.rejects(
+    request.get(),
+    error => error.result == Cr.NS_ERROR_PORT_ACCESS_NOT_ALLOWED
+  );
 });
 
 /**
  * Demonstrate API short-hand: create a request and dispatch it immediately.
  */
 add_task(async function test_simple_get() {
   let handler = httpd_handler(200, "OK", "Huzzah!");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
   let request = new RESTRequest(server.baseURI + "/resource");
   let promiseResponse = request.get();
 
   Assert.equal(request.status, request.SENT);
   Assert.equal(request.method, "GET");
 
   let response = await promiseResponse;
   Assert.equal(response, request.response);
@@ -119,17 +128,17 @@ add_task(async function test_simple_get(
   await promiseStopServer(server);
 });
 
 /**
  * Test HTTP GET with all bells and whistles.
  */
 add_task(async function test_get() {
   let handler = httpd_handler(200, "OK", "Huzzah!");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   Assert.equal(request.status, request.NOT_SENT);
 
   let promiseResponse = request.get();
 
   Assert.equal(request.status, request.SENT);
   Assert.equal(request.method, "GET");
@@ -156,35 +165,43 @@ add_task(async function test_get() {
  */
 add_task(async function test_get_utf8() {
   let response = "Hello World or Καλημέρα κόσμε or こんにちは 世界 😺";
 
   let contentType = "text/plain";
   let charset = true;
   let charsetSuffix = "; charset=UTF-8";
 
-  let server = httpd_setup({"/resource": function(req, res) {
-    res.setStatusLine(req.httpVersion, 200, "OK");
-    res.setHeader("Content-Type", contentType + (charset ? charsetSuffix : ""));
+  let server = httpd_setup({
+    "/resource": function(req, res) {
+      res.setStatusLine(req.httpVersion, 200, "OK");
+      res.setHeader(
+        "Content-Type",
+        contentType + (charset ? charsetSuffix : "")
+      );
 
-    let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
-                    .createInstance(Ci.nsIConverterOutputStream);
-    converter.init(res.bodyOutputStream, "UTF-8");
-    converter.writeString(response);
-    converter.close();
-  }});
+      let converter = Cc[
+        "@mozilla.org/intl/converter-output-stream;1"
+      ].createInstance(Ci.nsIConverterOutputStream);
+      converter.init(res.bodyOutputStream, "UTF-8");
+      converter.writeString(response);
+      converter.close();
+    },
+  });
 
   // Check if charset in Content-Type is propertly interpreted.
   let request1 = new RESTRequest(server.baseURI + "/resource");
   await request1.get();
 
   Assert.equal(request1.response.status, 200);
   Assert.equal(request1.response.body, response);
-  Assert.equal(request1.response.headers["content-type"],
-               contentType + charsetSuffix);
+  Assert.equal(
+    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");
   await request2.get();
   Assert.equal(request2.response.status, 200);
   Assert.equal(request2.response.body, response);
   Assert.equal(request2.response.headers["content-type"], contentType);
@@ -216,73 +233,86 @@ add_task(async function test_get_utf8() 
 /**
  * Test HTTP POST data is encoded as UTF-8 by default.
  */
 add_task(async function test_post_utf8() {
   // We setup a handler that responds with exactly what it received.
   // Given we've already tested above that responses are correctly utf-8
   // decoded we can surmise that the correct response coming back means the
   // input must also have been encoded.
-  let server = httpd_setup({"/echo": function(req, res) {
-    res.setStatusLine(req.httpVersion, 200, "OK");
-    res.setHeader("Content-Type", req.getHeader("content-type"));
-    // Get the body as bytes and write them back without touching them
-    let sis = Cc["@mozilla.org/scriptableinputstream;1"]
-              .createInstance(Ci.nsIScriptableInputStream);
-    sis.init(req.bodyInputStream);
-    let body = sis.read(sis.available());
-    sis.close();
-    res.write(body);
-  }});
+  let server = httpd_setup({
+    "/echo": function(req, res) {
+      res.setStatusLine(req.httpVersion, 200, "OK");
+      res.setHeader("Content-Type", req.getHeader("content-type"));
+      // Get the body as bytes and write them back without touching them
+      let sis = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
+        Ci.nsIScriptableInputStream
+      );
+      sis.init(req.bodyInputStream);
+      let body = sis.read(sis.available());
+      sis.close();
+      res.write(body);
+    },
+  });
 
   let data = {
     copyright: "©",
     // See the comment in test_get_utf8 about this string.
     long: ("a" + "😺".repeat(2048)).repeat(10),
   };
   let request1 = new RESTRequest(server.baseURI + "/echo");
   await request1.post(data);
 
   Assert.equal(request1.response.status, 200);
   deepEqual(JSON.parse(request1.response.body), data);
-  Assert.equal(request1.response.headers["content-type"],
-               "application/json; charset=utf-8");
+  Assert.equal(
+    request1.response.headers["content-type"],
+    "application/json; charset=utf-8"
+  );
 
   await promiseStopServer(server);
 });
 
 /**
  * Test more variations of charset handling.
  */
 add_task(async function test_charsets() {
   let response = "Hello World, I can't speak Russian";
 
   let contentType = "text/plain";
   let charset = true;
   let charsetSuffix = "; charset=us-ascii";
 
-  let server = httpd_setup({"/resource": function(req, res) {
-    res.setStatusLine(req.httpVersion, 200, "OK");
-    res.setHeader("Content-Type", contentType + (charset ? charsetSuffix : ""));
+  let server = httpd_setup({
+    "/resource": function(req, res) {
+      res.setStatusLine(req.httpVersion, 200, "OK");
+      res.setHeader(
+        "Content-Type",
+        contentType + (charset ? charsetSuffix : "")
+      );
 
-    let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
-                    .createInstance(Ci.nsIConverterOutputStream);
-    converter.init(res.bodyOutputStream, "us-ascii");
-    converter.writeString(response);
-    converter.close();
-  }});
+      let converter = Cc[
+        "@mozilla.org/intl/converter-output-stream;1"
+      ].createInstance(Ci.nsIConverterOutputStream);
+      converter.init(res.bodyOutputStream, "us-ascii");
+      converter.writeString(response);
+      converter.close();
+    },
+  });
 
   // Check that provided charset overrides hint.
   let request1 = new RESTRequest(server.baseURI + "/resource");
   request1.charset = "not-a-charset";
   await request1.get();
   Assert.equal(request1.response.status, 200);
   Assert.equal(request1.response.body, response);
-  Assert.equal(request1.response.headers["content-type"],
-               contentType + charsetSuffix);
+  Assert.equal(
+    request1.response.headers["content-type"],
+    contentType + charsetSuffix
+  );
   Assert.equal(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";
   await request2.get();
 
@@ -295,17 +325,17 @@ add_task(async function test_charsets() 
 });
 
 /**
  * Used for testing PATCH/PUT/POST methods.
  */
 async function check_posting_data(method) {
   let funcName = method.toLowerCase();
   let handler = httpd_handler(200, "OK", "Got it!");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   Assert.equal(request.status, request.NOT_SENT);
   let responsePromise = request[funcName]("Hullo?");
   Assert.equal(request.status, request.SENT);
   Assert.equal(request.method, method);
 
   let response = await responsePromise;
@@ -316,18 +346,20 @@ async function check_posting_data(method
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "Got it!");
 
   Assert.equal(handler.request.method, method);
   Assert.equal(handler.request.body, "Hullo?");
   Assert.equal(handler.request.getHeader("Content-Type"), "text/plain");
 
-  await Assert.rejects(request[funcName]("Hai!"),
-                       /Request has already been sent/);
+  await Assert.rejects(
+    request[funcName]("Hai!"),
+    /Request has already been sent/
+  );
 
   await promiseStopServer(server);
 }
 
 /**
  * Test HTTP PATCH with a simple string argument and default Content-Type.
  */
 add_task(async function test_patch() {
@@ -348,17 +380,17 @@ add_task(async function test_post() {
   await check_posting_data("POST");
 });
 
 /**
  * Test HTTP DELETE.
  */
 add_task(async function test_delete() {
   let handler = httpd_handler(200, "OK", "Got it!");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   Assert.equal(request.status, request.NOT_SENT);
   let responsePromise = request.delete();
   Assert.equal(request.status, request.SENT);
   Assert.equal(request.method, "DELETE");
 
   let response = await responsePromise;
@@ -375,17 +407,17 @@ add_task(async function test_delete() {
   await promiseStopServer(server);
 });
 
 /**
  * Test an HTTP response with a non-200 status code.
  */
 add_task(async function test_get_404() {
   let handler = httpd_handler(404, "Not Found", "Cannae find it!");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.get();
 
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(!request.response.success);
   Assert.equal(request.response.status, 404);
   Assert.equal(request.response.body, "Cannae find it!");
@@ -394,73 +426,79 @@ add_task(async function test_get_404() {
 });
 
 /**
  * The 'data' argument to PUT, if not a string already, is automatically
  * stringified as JSON.
  */
 add_task(async function test_put_json() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let sample_data = {
     some: "sample_data",
     injson: "format",
     number: 42,
   };
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.put(sample_data);
 
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
 
   Assert.equal(handler.request.method, "PUT");
   Assert.equal(handler.request.body, JSON.stringify(sample_data));
-  Assert.equal(handler.request.getHeader("Content-Type"), "application/json; charset=utf-8");
+  Assert.equal(
+    handler.request.getHeader("Content-Type"),
+    "application/json; charset=utf-8"
+  );
 
   await promiseStopServer(server);
 });
 
 /**
  * The 'data' argument to POST, if not a string already, is automatically
  * stringified as JSON.
  */
 add_task(async function test_post_json() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let sample_data = {
     some: "sample_data",
     injson: "format",
     number: 42,
   };
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.post(sample_data);
 
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
 
   Assert.equal(handler.request.method, "POST");
   Assert.equal(handler.request.body, JSON.stringify(sample_data));
-  Assert.equal(handler.request.getHeader("Content-Type"), "application/json; charset=utf-8");
+  Assert.equal(
+    handler.request.getHeader("Content-Type"),
+    "application/json; charset=utf-8"
+  );
 
   await promiseStopServer(server);
 });
 
 /**
  * The content-type will be text/plain without a charset if the 'data' argument
  * to POST is already a string.
  */
 add_task(async function test_post_json() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let sample_data = "hello";
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.post(sample_data);
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
@@ -472,17 +510,17 @@ add_task(async function test_post_json()
   await promiseStopServer(server);
 });
 
 /**
  * HTTP PUT with a custom Content-Type header.
  */
 add_task(async function test_put_override_content_type() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   request.setHeader("Content-Type", "application/lolcat");
   await request.put("O HAI!!1!");
 
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
@@ -495,17 +533,17 @@ add_task(async function test_put_overrid
   await promiseStopServer(server);
 });
 
 /**
  * HTTP POST with a custom Content-Type header.
  */
 add_task(async function test_post_override_content_type() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   request.setHeader("Content-Type", "application/lolcat");
   await request.post("O HAI!!1!");
 
   Assert.equal(request.status, request.COMPLETED);
   Assert.ok(request.response.success);
   Assert.equal(request.response.status, 200);
@@ -518,22 +556,31 @@ add_task(async function test_post_overri
   await promiseStopServer(server);
 });
 
 /**
  * No special headers are sent by default on a GET request.
  */
 add_task(async function test_get_no_headers() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
-  let ignore_headers = ["host", "user-agent", "accept", "accept-language",
-                        "accept-encoding", "accept-charset", "keep-alive",
-                        "connection", "pragma", "cache-control",
-                        "content-length"];
+  let ignore_headers = [
+    "host",
+    "user-agent",
+    "accept",
+    "accept-language",
+    "accept-encoding",
+    "accept-charset",
+    "keep-alive",
+    "connection",
+    "pragma",
+    "cache-control",
+    "content-length",
+  ];
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.get();
 
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
 
   let server_headers = handler.request.headers;
   while (server_headers.hasMoreElements()) {
@@ -546,56 +593,58 @@ add_task(async function test_get_no_head
   await promiseStopServer(server);
 });
 
 /**
  * Client includes default Accept header in API requests
  */
 add_task(async function test_default_accept_headers() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.get();
 
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
 
   let accept_header = handler.request.getHeader("accept");
 
   Assert.ok(!accept_header.includes("text/html"));
   Assert.ok(!accept_header.includes("application/xhtml+xml"));
   Assert.ok(!accept_header.includes("applcation/xml"));
 
-  Assert.ok(accept_header.includes("application/json") ||
-            accept_header.includes("application/newlines"));
+  Assert.ok(
+    accept_header.includes("application/json") ||
+      accept_header.includes("application/newlines")
+  );
 
   await promiseStopServer(server);
 });
 
 /**
  * Test changing the URI after having created the request.
  */
 add_task(async function test_changing_uri() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest("http://localhost:1234/the-wrong-resource");
   request.uri = CommonUtils.makeURI(server.baseURI + "/resource");
   let response = await request.get();
   Assert.equal(response.status, 200);
   await promiseStopServer(server);
 });
 
 /**
  * Test setting HTTP request headers.
  */
 add_task(async function test_request_setHeader() {
   let handler = httpd_handler(200, "OK");
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
 
   request.setHeader("X-What-Is-Weave", "awesome");
   request.setHeader("X-WHAT-is-Weave", "more awesomer");
   request.setHeader("Another-Header", "Hello World");
   await request.get();
 
@@ -612,17 +661,17 @@ add_task(async function test_request_set
  * Test receiving HTTP response headers.
  */
 add_task(async function test_response_headers() {
   function handler(request, response) {
     response.setHeader("X-What-Is-Weave", "awesome");
     response.setHeader("Another-Header", "Hello World");
     response.setStatusLine(request.httpVersion, 200, "OK");
   }
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
   let request = new RESTRequest(server.baseURI + "/resource");
   await request.get();
 
   Assert.equal(request.response.status, 200);
   Assert.equal(request.response.body, "");
 
   Assert.equal(request.response.headers["x-what-is-weave"], "awesome");
   Assert.equal(request.response.headers["another-header"], "Hello World");
@@ -633,31 +682,34 @@ add_task(async function test_response_he
 /**
  * The onComplete() handler gets called in case of any network errors
  * (e.g. NS_ERROR_CONNECTION_REFUSED).
  */
 add_task(async function test_connection_refused() {
   let request = new RESTRequest("http://localhost:1234/resource");
 
   // Fail the test if we resolve, return the error if we reject
-  await Assert.rejects(request.get(), error =>
-    error.result == Cr.NS_ERROR_CONNECTION_REFUSED &&
-    error.message == "NS_ERROR_CONNECTION_REFUSED");
+  await Assert.rejects(
+    request.get(),
+    error =>
+      error.result == Cr.NS_ERROR_CONNECTION_REFUSED &&
+      error.message == "NS_ERROR_CONNECTION_REFUSED"
+  );
 
   Assert.equal(request.status, request.COMPLETED);
 });
 
 /**
  * Abort a request that just sent off.
  */
 add_task(async function test_abort() {
   function handler() {
     do_throw("Shouldn't have gotten here!");
   }
-  let server = httpd_setup({"/resource": handler});
+  let server = httpd_setup({ "/resource": handler });
 
   let request = new RESTRequest(server.baseURI + "/resource");
 
   // Aborting a request that hasn't been sent yet is pointless and will throw.
   do_check_throws(function() {
     request.abort();
   });
 
@@ -687,24 +739,30 @@ add_task(async function test_timeout() {
     // This is a handler that doesn't do anything, just keeps the connection
     // open, thereby mimicking a timing out connection. We keep a reference to
     // the open connection for later so it can be properly disposed of. That's
     // why you really only want to make one HTTP request to this server ever.
     server_connection = connection;
   };
   server.start();
   let identity = server.identity;
-  let uri = identity.primaryScheme + "://" + identity.primaryHost + ":" +
-            identity.primaryPort;
+  let uri =
+    identity.primaryScheme +
+    "://" +
+    identity.primaryHost +
+    ":" +
+    identity.primaryPort;
 
   let request = new RESTRequest(uri + "/resource");
   request.timeout = 0.1; // 100 milliseconds
 
-  await Assert.rejects(request.get(), error =>
-    error.result == Cr.NS_ERROR_NET_TIMEOUT);
+  await Assert.rejects(
+    request.get(),
+    error => error.result == Cr.NS_ERROR_NET_TIMEOUT
+  );
 
   Assert.equal(request.status, request.ABORTED);
 
   // server_connection is undefined on the Android emulator for reasons
   // unknown. Yet, we still get here. If this test is refactored, we should
   // investigate the reason why the above callback is behaving differently.
   if (server_connection) {
     _("Closing connection.");
@@ -739,18 +797,18 @@ add_task(async function test_new_channel
     checkUA(metadata);
     resourceRequested = true;
 
     let body = "Test";
     response.setHeader("Content-Type", "text/plain");
     response.bodyOutputStream.write(body, body.length);
   }
 
-  let server1 = httpd_setup({"/redirect": redirectHandler});
-  let server2 = httpd_setup({"/resource": resourceHandler});
+  let server1 = httpd_setup({ "/redirect": redirectHandler });
+  let server2 = httpd_setup({ "/resource": resourceHandler });
   redirectURL = server2.baseURI + "/resource";
 
   let request = new RESTRequest(server1.baseURI + "/redirect");
   request.setHeader("User-Agent", "foo bar");
 
   // Swizzle in our own fakery, because this redirect is neither
   // internal nor URI-preserving. RESTRequest's policy is to only
   // copy headers under certain circumstances.
@@ -774,20 +832,21 @@ add_task(async function test_new_channel
 
 add_task(async function test_not_sending_cookie() {
   function handler(metadata, response) {
     let body = "COOKIE!";
     response.setStatusLine(metadata.httpVersion, 200, "OK");
     response.bodyOutputStream.write(body, body.length);
     Assert.ok(!metadata.hasHeader("Cookie"));
   }
-  let server = httpd_setup({"/test": handler});
+  let server = httpd_setup({ "/test": handler });
 
-  let cookieSer = Cc["@mozilla.org/cookieService;1"]
-                    .getService(Ci.nsICookieService);
+  let cookieSer = Cc["@mozilla.org/cookieService;1"].getService(
+    Ci.nsICookieService
+  );
   let uri = CommonUtils.makeURI(server.baseURI);
   cookieSer.setCookieString(uri, null, "test=test; path=/;", null);
 
   let res = new RESTRequest(server.baseURI + "/test");
   let response = await res.get();
 
   Assert.ok(response.success);
   Assert.equal("COOKIE!", response.body);
--- a/services/common/tests/unit/test_storage_adapter.js
+++ b/services/common/tests/unit/test_storage_adapter.js
@@ -1,23 +1,25 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Sqlite} = ChromeUtils.import("resource://gre/modules/Sqlite.jsm");
-const {FirefoxAdapter} = ChromeUtils.import("resource://services-common/kinto-storage-adapter.js");
+const { Sqlite } = ChromeUtils.import("resource://gre/modules/Sqlite.jsm");
+const { FirefoxAdapter } = ChromeUtils.import(
+  "resource://services-common/kinto-storage-adapter.js"
+);
 
 // set up what we need to make storage adapters
 const kintoFilename = "kinto.sqlite";
 
 function do_get_kinto_connection() {
-  return FirefoxAdapter.openConnection({path: kintoFilename});
+  return FirefoxAdapter.openConnection({ path: kintoFilename });
 }
 
 function do_get_kinto_adapter(sqliteHandle) {
-  return new FirefoxAdapter("test", {sqliteHandle});
+  return new FirefoxAdapter("test", { sqliteHandle });
 }
 
 function do_get_kinto_db() {
   let profile = do_get_profile();
   let kintoDB = profile.clone();
   kintoDB.append(kintoFilename);
   return kintoDB;
 }
@@ -38,35 +40,35 @@ function test_collection_operations() {
     await adapter.clear();
     await sqliteHandle.close();
   });
 
   // test creating new records... and getting them again
   add_task(async function test_kinto_create_new_get_existing() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
-    let record = {id: "test-id", foo: "bar"};
-    await adapter.execute((transaction) => transaction.create(record));
+    let record = { id: "test-id", foo: "bar" };
+    await adapter.execute(transaction => transaction.create(record));
     let newRecord = await adapter.get("test-id");
     // ensure the record is the same as when it was added
     deepEqual(record, newRecord);
     await sqliteHandle.close();
   });
 
   // test removing records
   add_task(async function test_kinto_can_remove_some_records() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
     // create a second record
-    let record = {id: "test-id-2", foo: "baz"};
-    await adapter.execute((transaction) => transaction.create(record));
+    let record = { id: "test-id-2", foo: "baz" };
+    await adapter.execute(transaction => transaction.create(record));
     let newRecord = await adapter.get("test-id-2");
     deepEqual(record, newRecord);
     // delete the record
-    await adapter.execute((transaction) => transaction.delete(record.id));
+    await adapter.execute(transaction => transaction.delete(record.id));
     newRecord = await adapter.get(record.id);
     // ... and ensure it's no longer there
     Assert.equal(newRecord, undefined);
     // ensure the other record still exists
     newRecord = await adapter.get("test-id");
     Assert.notEqual(newRecord, undefined);
     await sqliteHandle.close();
   });
@@ -81,50 +83,50 @@ function test_collection_operations() {
     Assert.equal(newRecord, undefined);
     await sqliteHandle.close();
   });
 
   // test updating records... and getting them again
   add_task(async function test_kinto_update_get_existing() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
-    let originalRecord = {id: "test-id", foo: "bar"};
-    let updatedRecord = {id: "test-id", foo: "baz"};
+    let originalRecord = { id: "test-id", foo: "bar" };
+    let updatedRecord = { id: "test-id", foo: "baz" };
     await adapter.clear();
-    await adapter.execute((transaction) => transaction.create(originalRecord));
-    await adapter.execute((transaction) => transaction.update(updatedRecord));
+    await adapter.execute(transaction => transaction.create(originalRecord));
+    await adapter.execute(transaction => transaction.update(updatedRecord));
     // ensure the record exists
     let newRecord = await adapter.get("test-id");
     // ensure the record is the same as when it was added
     deepEqual(updatedRecord, newRecord);
     await sqliteHandle.close();
   });
 
   // test listing records
   add_task(async function test_kinto_list() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
-    let originalRecord = {id: "test-id-1", foo: "bar"};
+    let originalRecord = { id: "test-id-1", foo: "bar" };
     let records = await adapter.list();
     Assert.equal(records.length, 1);
-    await adapter.execute((transaction) => transaction.create(originalRecord));
+    await adapter.execute(transaction => transaction.create(originalRecord));
     records = await adapter.list();
     Assert.equal(records.length, 2);
     await sqliteHandle.close();
   });
 
   // test aborting transaction
   add_task(async function test_kinto_aborting_transaction() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
     await adapter.clear();
-    let record = {id: 1, foo: "bar"};
+    let record = { id: 1, foo: "bar" };
     let error = null;
     try {
-      await adapter.execute((transaction) => {
+      await adapter.execute(transaction => {
         transaction.create(record);
         throw new Error("unexpected");
       });
     } catch (e) {
       error = e;
     }
     Assert.notEqual(error, null);
     let records = await adapter.list();
@@ -155,21 +157,19 @@ function test_collection_operations() {
     Assert.equal(lastModified, intendedValue);
     await sqliteHandle.close();
   });
 
   // test loadDump(records)
   add_task(async function test_kinto_import_records() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
-    let record1 = {id: 1, foo: "bar"};
-    let record2 = {id: 2, foo: "baz"};
-    let impactedRecords = await adapter.loadDump([
-      record1, record2,
-    ]);
+    let record1 = { id: 1, foo: "bar" };
+    let record2 = { id: 2, foo: "baz" };
+    let impactedRecords = await adapter.loadDump([record1, record2]);
     Assert.equal(impactedRecords.length, 2);
     let newRecord1 = await adapter.get("1");
     // ensure the record is the same as when it was added
     deepEqual(record1, newRecord1);
     let newRecord2 = await adapter.get("2");
     // ensure the record is the same as when it was added
     deepEqual(record2, newRecord2);
     await sqliteHandle.close();
@@ -177,64 +177,61 @@ function test_collection_operations() {
 
   add_task(async function test_kinto_import_records_should_override_existing() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
     await adapter.clear();
     let records = await adapter.list();
     Assert.equal(records.length, 0);
     let impactedRecords = await adapter.loadDump([
-      {id: 1, foo: "bar"},
-      {id: 2, foo: "baz"},
+      { id: 1, foo: "bar" },
+      { id: 2, foo: "baz" },
     ]);
     Assert.equal(impactedRecords.length, 2);
-    await adapter.loadDump([
-      {id: 1, foo: "baz"},
-      {id: 3, foo: "bab"},
-    ]);
+    await adapter.loadDump([{ id: 1, foo: "baz" }, { id: 3, foo: "bab" }]);
     records = await adapter.list();
     Assert.equal(records.length, 3);
     let newRecord1 = await adapter.get("1");
     deepEqual(newRecord1.foo, "baz");
     await sqliteHandle.close();
   });
 
   add_task(async function test_import_updates_lastModified() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
     await adapter.loadDump([
-      {id: 1, foo: "bar", last_modified: 1457896541},
-      {id: 2, foo: "baz", last_modified: 1458796542},
+      { id: 1, foo: "bar", last_modified: 1457896541 },
+      { id: 2, foo: "baz", last_modified: 1458796542 },
     ]);
     let lastModified = await adapter.getLastModified();
     Assert.equal(lastModified, 1458796542);
     await sqliteHandle.close();
   });
 
   add_task(async function test_import_preserves_older_lastModified() {
     let sqliteHandle = await do_get_kinto_connection();
     let adapter = do_get_kinto_adapter(sqliteHandle);
     await adapter.saveLastModified(1458796543);
 
     await adapter.loadDump([
-      {id: 1, foo: "bar", last_modified: 1457896541},
-      {id: 2, foo: "baz", last_modified: 1458796542},
+      { id: 1, foo: "bar", last_modified: 1457896541 },
+      { id: 2, foo: "baz", last_modified: 1458796542 },
     ]);
     let lastModified = await adapter.getLastModified();
     Assert.equal(lastModified, 1458796543);
     await sqliteHandle.close();
   });
 
   add_task(async function test_save_metadata_preserves_lastModified() {
     let sqliteHandle = await do_get_kinto_connection();
 
     let adapter = do_get_kinto_adapter(sqliteHandle);
     await adapter.saveLastModified(42);
 
-    await adapter.saveMetadata({id: "col"});
+    await adapter.saveMetadata({ id: "col" });
 
     let lastModified = await adapter.getLastModified();
     Assert.equal(lastModified, 42);
     await sqliteHandle.close();
   });
 }
 
 // test kinto db setup and operations in various scenarios
--- a/services/common/tests/unit/test_storage_adapter_shutdown.js
+++ b/services/common/tests/unit/test_storage_adapter_shutdown.js
@@ -1,19 +1,24 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {AsyncShutdown} = ChromeUtils.import("resource://gre/modules/AsyncShutdown.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { AsyncShutdown } = ChromeUtils.import(
+  "resource://gre/modules/AsyncShutdown.jsm"
+);
 
-const {FirefoxAdapter} = ChromeUtils.import("resource://services-common/kinto-storage-adapter.js");
-
+const { FirefoxAdapter } = ChromeUtils.import(
+  "resource://services-common/kinto-storage-adapter.js"
+);
 
 add_task(async function test_sqlite_shutdown() {
-  const sqliteHandle = await FirefoxAdapter.openConnection({path: "kinto.sqlite"});
+  const sqliteHandle = await FirefoxAdapter.openConnection({
+    path: "kinto.sqlite",
+  });
 
   // Shutdown Sqlite.jsm synchronously.
   Services.prefs.setBoolPref("toolkit.asyncshutdown.testing", true);
   AsyncShutdown.profileBeforeChange._trigger();
   Services.prefs.clearUserPref("toolkit.asyncshutdown.testing");
 
   try {
     sqliteHandle.execute("SELECT 1;");
--- a/services/common/tests/unit/test_tokenauthenticatedrequest.js
+++ b/services/common/tests/unit/test_tokenauthenticatedrequest.js
@@ -1,13 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {CryptoUtils} = ChromeUtils.import("resource://services-crypto/utils.js");
-const {TokenAuthenticatedRESTRequest} = ChromeUtils.import("resource://services-common/rest.js");
+const { CryptoUtils } = ChromeUtils.import(
+  "resource://services-crypto/utils.js"
+);
+const { TokenAuthenticatedRESTRequest } = ChromeUtils.import(
+  "resource://services-common/rest.js"
+);
 
 function run_test() {
   initTestLogging("Trace");
   run_next_test();
 }
 
 add_task(async function test_authenticated_request() {
   _("Ensure that sending a MAC authenticated GET request works as expected.");
@@ -17,31 +21,32 @@ add_task(async function test_authenticat
   // TODO: We use a preset key here, but use getTokenFromBrowserIDAssertion()
   // from TokenServerClient to get a real one when possible. (Bug 745800)
   let id = "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x";
   let key = "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=";
   let method = "GET";
 
   let nonce = btoa(CryptoUtils.generateRandomBytesLegacy(16));
   let ts = Math.floor(Date.now() / 1000);
-  let extra = {ts, nonce};
+  let extra = { ts, nonce };
 
   let auth;
 
-  let server = httpd_setup({"/foo": function(request, response) {
+  let server = httpd_setup({
+    "/foo": function(request, response) {
       Assert.ok(request.hasHeader("Authorization"));
       Assert.equal(auth, request.getHeader("Authorization"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(message, message.length);
     },
   });
   let uri = CommonUtils.makeURI(server.baseURI + "/foo");
   let sig = await CryptoUtils.computeHTTPMACSHA1(id, key, method, uri, extra);
   auth = sig.getHeader();
 
-  let req = new TokenAuthenticatedRESTRequest(uri, {id, key}, extra);
+  let req = new TokenAuthenticatedRESTRequest(uri, { id, key }, extra);
   await req.get();
 
   Assert.equal(message, req.response.body);
 
   await promiseStopServer(server);
 });
--- a/services/common/tests/unit/test_tokenserverclient.js
+++ b/services/common/tests/unit/test_tokenserverclient.js
@@ -1,12 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {TokenServerClient, TokenServerClientError, TokenServerClientServerError} = ChromeUtils.import("resource://services-common/tokenserverclient.js");
+const {
+  TokenServerClient,
+  TokenServerClientError,
+  TokenServerClientServerError,
+} = ChromeUtils.import("resource://services-common/tokenserverclient.js");
 
 initTestLogging("Trace");
 
 add_task(async function test_working_bid_exchange() {
   _("Ensure that working BrowserID token exchange works as expected.");
 
   let service = "http://example.com/foo";
   let duration = 300;
@@ -16,53 +20,53 @@ add_task(async function test_working_bid
       Assert.ok(request.hasHeader("accept"));
       Assert.ok(!request.hasHeader("x-conditions-accepted"));
       Assert.equal("application/json", request.getHeader("accept"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
 
       let body = JSON.stringify({
-        id:           "id",
-        key:          "key",
+        id: "id",
+        key: "key",
         api_endpoint: service,
-        uid:          "uid",
+        uid: "uid",
         duration,
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
   let result = await client.getTokenFromBrowserIDAssertion(url, "assertion");
-  Assert.equal("object", typeof(result));
+  Assert.equal("object", typeof result);
   do_check_attribute_count(result, 6);
   Assert.equal(service, result.endpoint);
   Assert.equal("id", result.id);
   Assert.equal("key", result.key);
   Assert.equal("uid", result.uid);
   Assert.equal(duration, result.duration);
   await promiseStopServer(server);
 });
 
 add_task(async function test_invalid_arguments() {
   _("Ensure invalid arguments to APIs are rejected.");
 
-  let args = [
-    [null, "assertion"],
-    ["http://example.com/", null],
-  ];
+  let args = [[null, "assertion"], ["http://example.com/", null]];
 
   for (let arg of args) {
     let client = new TokenServerClient();
-    await Assert.rejects(client.getTokenFromBrowserIDAssertion(arg[0], arg[1]), ex => {
-      Assert.ok(ex instanceof TokenServerClientError);
-      return true;
-    });
+    await Assert.rejects(
+      client.getTokenFromBrowserIDAssertion(arg[0], arg[1]),
+      ex => {
+        Assert.ok(ex instanceof TokenServerClientError);
+        return true;
+      }
+    );
   }
 });
 
 add_task(async function test_conditions_required_response_handling() {
   _("Ensure that a conditions required response is handled properly.");
 
   let description = "Need to accept conditions";
   let tosURL = "http://example.com/tos";
@@ -70,65 +74,71 @@ add_task(async function test_conditions_
   let server = httpd_setup({
     "/1.0/foo/1.0": function(request, response) {
       Assert.ok(!request.hasHeader("x-conditions-accepted"));
 
       response.setStatusLine(request.httpVersion, 403, "Forbidden");
       response.setHeader("Content-Type", "application/json");
 
       let body = JSON.stringify({
-        errors: [{description, location: "body", name: ""}],
-        urls: {tos: tosURL},
+        errors: [{ description, location: "body", name: "" }],
+        urls: { tos: tosURL },
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "conditions-required");
-    // Check a JSON.stringify works on our errors as our logging will try and use it.
-    Assert.ok(JSON.stringify(error), "JSON.stringify worked");
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "conditions-required");
+      // Check a JSON.stringify works on our errors as our logging will try and use it.
+      Assert.ok(JSON.stringify(error), "JSON.stringify worked");
 
-    Assert.equal(error.urls.tos, tosURL);
-    return true;
-  });
+      Assert.equal(error.urls.tos, tosURL);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_invalid_403_no_content_type() {
   _("Ensure that a 403 without content-type is handled properly.");
 
   let server = httpd_setup({
     "/1.0/foo/1.0": function(request, response) {
       response.setStatusLine(request.httpVersion, 403, "Forbidden");
       // No Content-Type header by design.
 
       let body = JSON.stringify({
-        errors: [{description: "irrelevant", location: "body", name: ""}],
-        urls: {foo: "http://bar"},
+        errors: [{ description: "irrelevant", location: "body", name: "" }],
+        urls: { foo: "http://bar" },
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "malformed-response");
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "malformed-response");
 
-    Assert.equal(null, error.urls);
-    return true;
-  });
+      Assert.equal(null, error.urls);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_invalid_403_bad_json() {
   _("Ensure that a 403 with JSON that isn't proper is handled properly.");
 
   let server = httpd_setup({
@@ -141,22 +151,25 @@ add_task(async function test_invalid_403
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "malformed-response");
-    Assert.equal(null, error.urls);
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "malformed-response");
+      Assert.equal(null, error.urls);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_403_no_urls() {
   _("Ensure that a 403 without a urls field is handled properly.");
 
   let server = httpd_setup({
@@ -167,21 +180,24 @@ add_task(async function test_403_no_urls
       let body = "{}";
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "malformed-response");
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "malformed-response");
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_send_extra_headers() {
   _("Ensures that the condition acceptance header is sent when asked.");
 
   let duration = 300;
@@ -192,20 +208,20 @@ add_task(async function test_send_extra_
 
       Assert.ok(request.hasHeader("x-bar"));
       Assert.equal(request.getHeader("x-bar"), "17");
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
 
       let body = JSON.stringify({
-        id:           "id",
-        key:          "key",
+        id: "id",
+        key: "key",
         api_endpoint: "http://example.com/",
-        uid:          "uid",
+        uid: "uid",
         duration,
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
@@ -224,52 +240,58 @@ add_task(async function test_send_extra_
 add_task(async function test_error_404_empty() {
   _("Ensure that 404 responses without proper response are handled properly.");
 
   let server = httpd_setup();
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/foo";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "malformed-response");
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "malformed-response");
 
-    Assert.notEqual(null, error.response);
-    return true;
-  });
+      Assert.notEqual(null, error.response);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_error_404_proper_response() {
   _("Ensure that a Cornice error report for 404 is handled properly.");
 
   let server = httpd_setup({
     "/1.0/foo/1.0": function(request, response) {
       response.setStatusLine(request.httpVersion, 404, "Not Found");
       response.setHeader("Content-Type", "application/json; charset=utf-8");
 
       let body = JSON.stringify({
         status: 404,
-        errors: [{description: "No service", location: "body", name: ""}],
+        errors: [{ description: "No service", location: "body", name: "" }],
       });
 
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.ok(error instanceof TokenServerClientServerError);
-    Assert.equal(error.cause, "unknown-service");
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.ok(error instanceof TokenServerClientServerError);
+      Assert.equal(error.cause, "unknown-service");
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_bad_json() {
   _("Ensure that malformed JSON is handled properly.");
 
   let server = httpd_setup({
@@ -280,23 +302,26 @@ add_task(async function test_bad_json() 
       let body = '{"id": "id", baz}';
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.notEqual(null, error);
-    Assert.equal("TokenServerClientServerError", error.name);
-    Assert.equal(error.cause, "malformed-response");
-    Assert.notEqual(null, error.response);
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.notEqual(null, error);
+      Assert.equal("TokenServerClientServerError", error.name);
+      Assert.equal(error.cause, "malformed-response");
+      Assert.notEqual(null, error.response);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_400_response() {
   _("Ensure HTTP 400 is converted to malformed-request.");
 
   let server = httpd_setup({
@@ -307,50 +332,56 @@ add_task(async function test_400_respons
       let body = "{}"; // Actual content may not be used.
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.notEqual(null, error);
-    Assert.equal("TokenServerClientServerError", error.name);
-    Assert.notEqual(null, error.response);
-    Assert.equal(error.cause, "malformed-request");
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.notEqual(null, error);
+      Assert.equal("TokenServerClientServerError", error.name);
+      Assert.notEqual(null, error.response);
+      Assert.equal(error.cause, "malformed-request");
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_401_with_error_cause() {
   _("Ensure 401 cause is specified in body.status");
 
   let server = httpd_setup({
     "/1.0/foo/1.0": function(request, response) {
       response.setStatusLine(request.httpVersion, 401, "Unauthorized");
       response.setHeader("Content-Type", "application/json; charset=utf-8");
 
-      let body = JSON.stringify({status: "no-soup-for-you"});
+      let body = JSON.stringify({ status: "no-soup-for-you" });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let client = new TokenServerClient();
   let url = server.baseURI + "/1.0/foo/1.0";
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.notEqual(null, error);
-    Assert.equal("TokenServerClientServerError", error.name);
-    Assert.notEqual(null, error.response);
-    Assert.equal(error.cause, "no-soup-for-you");
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.notEqual(null, error);
+      Assert.equal("TokenServerClientServerError", error.name);
+      Assert.notEqual(null, error.response);
+      Assert.equal(error.cause, "no-soup-for-you");
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_unhandled_media_type() {
   _("Ensure that unhandled media types throw an error.");
 
   let server = httpd_setup({
@@ -361,40 +392,43 @@ add_task(async function test_unhandled_m
       let body = "hello, world";
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let url = server.baseURI + "/1.0/foo/1.0";
   let client = new TokenServerClient();
 
-  await Assert.rejects(client.getTokenFromBrowserIDAssertion(url, "assertion"), error => {
-    Assert.notEqual(null, error);
-    Assert.equal("TokenServerClientServerError", error.name);
-    Assert.notEqual(null, error.response);
-    return true;
-  });
+  await Assert.rejects(
+    client.getTokenFromBrowserIDAssertion(url, "assertion"),
+    error => {
+      Assert.notEqual(null, error);
+      Assert.equal("TokenServerClientServerError", error.name);
+      Assert.notEqual(null, error.response);
+      return true;
+    }
+  );
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_rich_media_types() {
   _("Ensure that extra tokens in the media type aren't rejected.");
 
   let duration = 300;
   let server = httpd_setup({
     "/foo": function(request, response) {
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json; foo=bar; bar=foo");
 
       let body = JSON.stringify({
-        id:           "id",
-        key:          "key",
+        id: "id",
+        key: "key",
         api_endpoint: "foo",
-        uid:          "uid",
+        uid: "uid",
         duration,
       });
       response.bodyOutputStream.write(body, body.length);
     },
   });
 
   let url = server.baseURI + "/foo";
   let client = new TokenServerClient();
--- a/services/common/tests/unit/test_uptake_telemetry.js
+++ b/services/common/tests/unit/test_uptake_telemetry.js
@@ -1,17 +1,24 @@
 const { ClientID } = ChromeUtils.import("resource://gre/modules/ClientID.jsm");
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm");
-const { UptakeTelemetry } = ChromeUtils.import("resource://services-common/uptake-telemetry.js");
+const { TelemetryTestUtils } = ChromeUtils.import(
+  "resource://testing-common/TelemetryTestUtils.jsm"
+);
+const { UptakeTelemetry } = ChromeUtils.import(
+  "resource://services-common/uptake-telemetry.js"
+);
 
 const COMPONENT = "remotesettings";
 
 async function withFakeClientID(uuid, f) {
-  const module = ChromeUtils.import("resource://services-common/uptake-telemetry.js", null);
+  const module = ChromeUtils.import(
+    "resource://services-common/uptake-telemetry.js",
+    null
+  );
   const oldPolicy = module.Policy;
   module.Policy = {
     ...oldPolicy,
     _clientIDHash: null,
     getClientID: () => Promise.resolve(uuid),
   };
   try {
     return await f();
@@ -30,22 +37,30 @@ add_task(async function test_unknown_sta
   const expectedIncrements = {};
   checkUptakeTelemetry(startHistogram, endHistogram, expectedIncrements);
 });
 
 add_task(async function test_age_is_converted_to_string_and_reported() {
   const status = UptakeTelemetry.STATUS.SUCCESS;
   const age = 42;
 
-  await withFakeChannel("nightly", async () => { // no sampling.
+  await withFakeChannel("nightly", async () => {
+    // no sampling.
     await UptakeTelemetry.report(COMPONENT, status, { source: "s", age });
   });
 
-  TelemetryTestUtils.assertEvents(
-    [["uptake.remotecontent.result", "uptake", COMPONENT, status, { source: "s", age: `${age}` }]]);
+  TelemetryTestUtils.assertEvents([
+    [
+      "uptake.remotecontent.result",
+      "uptake",
+      COMPONENT,
+      status,
+      { source: "s", age: `${age}` },
+    ],
+  ]);
 });
 
 add_task(async function test_each_status_can_be_caught_in_snapshot() {
   const source = "some-source";
   const startHistogram = getUptakeTelemetrySnapshot(source);
 
   const expectedIncrements = {};
   for (const label of Object.keys(UptakeTelemetry.STATUS)) {
@@ -60,42 +75,52 @@ add_task(async function test_each_status
 
 add_task(async function test_events_are_sent_when_hash_is_mod_0() {
   const source = "some-source";
   const startSnapshot = getUptakeTelemetrySnapshot(source);
   const startSuccess = startSnapshot.events.success || 0;
   const uuid = "d81bbfad-d741-41f5-a7e6-29f6bde4972a"; // hash % 100 = 0
   await withFakeClientID(uuid, async () => {
     await withFakeChannel("release", async () => {
-      await UptakeTelemetry.report(COMPONENT, UptakeTelemetry.STATUS.SUCCESS, { source });
+      await UptakeTelemetry.report(COMPONENT, UptakeTelemetry.STATUS.SUCCESS, {
+        source,
+      });
     });
   });
   const endSnapshot = getUptakeTelemetrySnapshot(source);
   Assert.equal(endSnapshot.events.success, startSuccess + 1);
 });
 
-add_task(async function test_events_are_not_sent_when_hash_is_greater_than_pref() {
-  const source = "some-source";
-  const startSnapshot = getUptakeTelemetrySnapshot(source);
-  const startSuccess = startSnapshot.events.success || 0;
-  const uuid = "d81bbfad-d741-41f5-a7e6-29f6bde49721"; // hash % 100 = 1
-  await withFakeClientID(uuid, async () => {
-    await withFakeChannel("release", async () => {
-      await UptakeTelemetry.report(COMPONENT, UptakeTelemetry.STATUS.SUCCESS, { source });
+add_task(
+  async function test_events_are_not_sent_when_hash_is_greater_than_pref() {
+    const source = "some-source";
+    const startSnapshot = getUptakeTelemetrySnapshot(source);
+    const startSuccess = startSnapshot.events.success || 0;
+    const uuid = "d81bbfad-d741-41f5-a7e6-29f6bde49721"; // hash % 100 = 1
+    await withFakeClientID(uuid, async () => {
+      await withFakeChannel("release", async () => {
+        await UptakeTelemetry.report(
+          COMPONENT,
+          UptakeTelemetry.STATUS.SUCCESS,
+          { source }
+        );
+      });
     });
-  });
-  const endSnapshot = getUptakeTelemetrySnapshot(source);
-  Assert.equal(endSnapshot.events.success || 0, startSuccess);
-});
+    const endSnapshot = getUptakeTelemetrySnapshot(source);
+    Assert.equal(endSnapshot.events.success || 0, startSuccess);
+  }
+);
 
 add_task(async function test_events_are_sent_when_nightly() {
   const source = "some-source";
   const startSnapshot = getUptakeTelemetrySnapshot(source);
   const startSuccess = startSnapshot.events.success || 0;
   const uuid = "d81bbfad-d741-41f5-a7e6-29f6bde49721"; // hash % 100 = 1
   await withFakeClientID(uuid, async () => {
     await withFakeChannel("nightly", async () => {
-      await UptakeTelemetry.report(COMPONENT, UptakeTelemetry.STATUS.SUCCESS, { source });
+      await UptakeTelemetry.report(COMPONENT, UptakeTelemetry.STATUS.SUCCESS, {
+        source,
+      });
     });
   });
   const endSnapshot = getUptakeTelemetrySnapshot(source);
   Assert.equal(endSnapshot.events.success, startSuccess + 1);
 });
--- a/services/common/tests/unit/test_utils_convert_string.js
+++ b/services/common/tests/unit/test_utils_convert_string.js
@@ -1,31 +1,98 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // A wise line of Greek verse, and the utf-8 byte encoding.
 // N.b., Greek begins at utf-8 ce 91
 const TEST_STR = "πόλλ' οἶδ' ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα";
-const TEST_HEX = h("cf 80 cf 8c ce bb ce bb   27 20 ce bf e1 bc b6 ce" +
-                   "b4 27 20 e1 bc 80 ce bb   cf 8e cf 80 ce b7 ce be" +
-                   "2c 20 e1 bc 80 ce bb ce   bb 27 20 e1 bc 90 cf 87" +
-                   "e1 bf 96 ce bd ce bf cf   82 20 e1 bc 93 ce bd 20" +
-                   "ce bc ce ad ce b3 ce b1");
+const TEST_HEX = h(
+  "cf 80 cf 8c ce bb ce bb   27 20 ce bf e1 bc b6 ce" +
+    "b4 27 20 e1 bc 80 ce bb   cf 8e cf 80 ce b7 ce be" +
+    "2c 20 e1 bc 80 ce bb ce   bb 27 20 e1 bc 90 cf 87" +
+    "e1 bf 96 ce bd ce bf cf   82 20 e1 bc 93 ce bd 20" +
+    "ce bc ce ad ce b3 ce b1"
+);
 // Integer byte values for the above
-const TEST_BYTES = [207, 128, 207, 140, 206, 187, 206, 187,
-                     39, 32, 206, 191, 225, 188, 182, 206,
-                    180, 39, 32, 225, 188, 128, 206, 187,
-                    207, 142, 207, 128, 206, 183, 206, 190,
-                     44, 32, 225, 188, 128, 206, 187, 206,
-                    187, 39, 32, 225, 188, 144, 207, 135,
-                    225, 191, 150, 206, 189, 206, 191, 207,
-                    130, 32, 225, 188, 147, 206, 189, 32,
-                    206, 188, 206, 173, 206, 179, 206, 177];
+const TEST_BYTES = [
+  207,
+  128,
+  207,
+  140,
+  206,
+  187,
+  206,
+  187,
+  39,
+  32,
+  206,
+  191,
+  225,
+  188,
+  182,
+  206,
+  180,
+  39,
+  32,
+  225,
+  188,
+  128,
+  206,
+  187,
+  207,
+  142,
+  207,
+  128,
+  206,
+  183,
+  206,
+  190,
+  44,
+  32,
+  225,
+  188,
+  128,
+  206,
+  187,
+  206,
+  187,
+  39,
+  32,
+  225,
+  188,
+  144,
+  207,
+  135,
+  225,
+  191,
+  150,
+  206,
+  189,
+  206,
+  191,
+  207,
+  130,
+  32,
+  225,
+  188,
+  147,
+  206,
+  189,
+  32,
+  206,
+  188,
+  206,
+  173,
+  206,
+  179,
+  206,
+  177,
+];
 
 add_test(function test_compress_string() {
   const INPUT = "hello";
 
   let result = CommonUtils.convertString(INPUT, "uncompressed", "deflate");
   Assert.equal(result.length, 13);
 
   let result2 = CommonUtils.convertString(INPUT, "uncompressed", "deflate");
@@ -33,21 +100,30 @@ add_test(function test_compress_string()
 
   let result3 = CommonUtils.convertString(result, "deflate", "uncompressed");
   Assert.equal(result3, INPUT);
 
   run_next_test();
 });
 
 add_test(function test_compress_utf8() {
-  const INPUT = "Árvíztűrő tükörfúrógép いろはにほへとちりぬるを Pijamalı hasta, yağız şoföre çabucak güvendi.";
+  const INPUT =
+    "Árvíztűrő tükörfúrógép いろはにほへとちりぬるを Pijamalı hasta, yağız şoföre çabucak güvendi.";
   let inputUTF8 = CommonUtils.encodeUTF8(INPUT);
 
-  let compressed = CommonUtils.convertString(inputUTF8, "uncompressed", "deflate");
-  let uncompressed = CommonUtils.convertString(compressed, "deflate", "uncompressed");
+  let compressed = CommonUtils.convertString(
+    inputUTF8,
+    "uncompressed",
+    "deflate"
+  );
+  let uncompressed = CommonUtils.convertString(
+    compressed,
+    "deflate",
+    "uncompressed"
+  );
 
   Assert.equal(uncompressed, inputUTF8);
 
   let outputUTF8 = CommonUtils.decodeUTF8(uncompressed);
   Assert.equal(outputUTF8, INPUT);
 
   run_next_test();
 });
@@ -73,44 +149,55 @@ add_task(function test_stringAsHex() {
 add_task(function test_hexAsString() {
   Assert.equal(TEST_STR, CommonUtils.hexAsString(TEST_HEX));
 });
 
 add_task(function test_hexToBytes() {
   let bytes = CommonUtils.hexToBytes(TEST_HEX);
   Assert.equal(TEST_BYTES.length, bytes.length);
   // Ensure that the decimal values of each byte are correct
-  Assert.ok(arraysEqual(TEST_BYTES,
-      CommonUtils.stringToByteArray(bytes)));
+  Assert.ok(arraysEqual(TEST_BYTES, CommonUtils.stringToByteArray(bytes)));
 });
 
 add_task(function test_bytesToHex() {
   // Create a list of our character bytes from the reference int values
   let bytes = CommonUtils.byteArrayToString(TEST_BYTES);
   Assert.equal(TEST_HEX, CommonUtils.bytesAsHex(bytes));
 });
 
 add_task(function test_stringToBytes() {
-  Assert.ok(arraysEqual(TEST_BYTES,
-      CommonUtils.stringToByteArray(CommonUtils.stringToBytes(TEST_STR))));
+  Assert.ok(
+    arraysEqual(
+      TEST_BYTES,
+      CommonUtils.stringToByteArray(CommonUtils.stringToBytes(TEST_STR))
+    )
+  );
 });
 
 add_task(function test_stringRoundTrip() {
-  Assert.equal(TEST_STR,
-    CommonUtils.hexAsString(CommonUtils.stringAsHex(TEST_STR)));
+  Assert.equal(
+    TEST_STR,
+    CommonUtils.hexAsString(CommonUtils.stringAsHex(TEST_STR))
+  );
 });
 
 add_task(function test_hexRoundTrip() {
-  Assert.equal(TEST_HEX,
-    CommonUtils.stringAsHex(CommonUtils.hexAsString(TEST_HEX)));
+  Assert.equal(
+    TEST_HEX,
+    CommonUtils.stringAsHex(CommonUtils.hexAsString(TEST_HEX))
+  );
 });
 
 add_task(function test_byteArrayRoundTrip() {
-  Assert.ok(arraysEqual(TEST_BYTES,
-    CommonUtils.stringToByteArray(CommonUtils.byteArrayToString(TEST_BYTES))));
+  Assert.ok(
+    arraysEqual(
+      TEST_BYTES,
+      CommonUtils.stringToByteArray(CommonUtils.byteArrayToString(TEST_BYTES))
+    )
+  );
 });
 
 // turn formatted test vectors into normal hex strings
 function h(hexStr) {
   return hexStr.replace(/\s+/g, "");
 }
 
 function arraysEqual(a1, a2) {
--- a/services/common/tests/unit/test_utils_dateprefs.js
+++ b/services/common/tests/unit/test_utils_dateprefs.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
-
+const { Preferences } = ChromeUtils.import(
+  "resource://gre/modules/Preferences.jsm"
+);
 
 var prefs = new Preferences("servicescommon.tests.");
 
 function DummyLogger() {
   this.messages = [];
 }
 DummyLogger.prototype.warn = function warn(message) {
   this.messages.push(message);
--- a/services/common/tests/unit/test_utils_encodeBase32.js
+++ b/services/common/tests/unit/test_utils_encodeBase32.js
@@ -1,32 +1,38 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   // Testing byte array manipulation.
-  Assert.equal("FOOBAR", CommonUtils.byteArrayToString([70, 79, 79, 66, 65, 82]));
+  Assert.equal(
+    "FOOBAR",
+    CommonUtils.byteArrayToString([70, 79, 79, 66, 65, 82])
+  );
   Assert.equal("", CommonUtils.byteArrayToString([]));
 
   _("Testing encoding...");
   // Test vectors from RFC 4648
   Assert.equal(CommonUtils.encodeBase32(""), "");
   Assert.equal(CommonUtils.encodeBase32("f"), "MY======");
   Assert.equal(CommonUtils.encodeBase32("fo"), "MZXQ====");
   Assert.equal(CommonUtils.encodeBase32("foo"), "MZXW6===");
   Assert.equal(CommonUtils.encodeBase32("foob"), "MZXW6YQ=");
   Assert.equal(CommonUtils.encodeBase32("fooba"), "MZXW6YTB");
   Assert.equal(CommonUtils.encodeBase32("foobar"), "MZXW6YTBOI======");
 
-  Assert.equal(CommonUtils.encodeBase32("Bacon is a vegetable."),
-               "IJQWG33OEBUXGIDBEB3GKZ3FORQWE3DFFY======");
+  Assert.equal(
+    CommonUtils.encodeBase32("Bacon is a vegetable."),
+    "IJQWG33OEBUXGIDBEB3GKZ3FORQWE3DFFY======"
+  );
 
   _("Checking assumptions...");
-  for (let i = 0; i <= 255; ++i)
+  for (let i = 0; i <= 255; ++i) {
     Assert.equal(undefined | i, i);
+  }
 
   _("Testing decoding...");
   Assert.equal(CommonUtils.decodeBase32(""), "");
   Assert.equal(CommonUtils.decodeBase32("MY======"), "f");
   Assert.equal(CommonUtils.decodeBase32("MZXQ===="), "fo");
   Assert.equal(CommonUtils.decodeBase32("MZXW6YTB"), "fooba");
   Assert.equal(CommonUtils.decodeBase32("MZXW6YTBOI======"), "foobar");
 
--- a/services/common/tests/unit/test_utils_ensureMillisecondsTimestamp.js
+++ b/services/common/tests/unit/test_utils_ensureMillisecondsTimestamp.js
@@ -1,21 +1,40 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
-    Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp(null));
-    Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp(0));
-    Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp("0"));
-    Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp("000"));
+  Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp(null));
+  Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp(0));
+  Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp("0"));
+  Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp("000"));
 
-    Assert.equal(null, CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000));
+  Assert.equal(
+    null,
+    CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000)
+  );
 
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(-1); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(1.5); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000 + 0.5); });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp(-1);
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp(1);
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp(1.5);
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp(999 * 10000000000 + 0.5);
+  });
 
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("-1"); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1"); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("1.5"); });
-    do_check_throws(function err() { CommonUtils.ensureMillisecondsTimestamp("" + (999 * 10000000000 + 0.5)); });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp("-1");
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp("1");
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp("1.5");
+  });
+  do_check_throws(function err() {
+    CommonUtils.ensureMillisecondsTimestamp("" + (999 * 10000000000 + 0.5));
+  });
 }
--- a/services/common/tests/unit/test_utils_json.js
+++ b/services/common/tests/unit/test_utils_json.js
@@ -1,39 +1,37 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
+const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 function run_test() {
   initTestLogging();
   run_next_test();
 }
 
 add_test(function test_writeJSON_readJSON() {
   _("Round-trip some JSON through the promise-based JSON writer.");
 
   let contents = {
-    "a": 12345.67,
-    "b": {
-      "c": "héllö",
+    a: 12345.67,
+    b: {
+      c: "héllö",
     },
-    "d": undefined,
-    "e": null,
+    d: undefined,
+    e: null,
   };
 
   function checkJSON(json) {
     Assert.equal(contents.a, json.a);
     Assert.equal(contents.b.c, json.b.c);
     Assert.equal(contents.d, json.d);
     Assert.equal(contents.e, json.e);
     run_next_test();
   }
 
   function doRead() {
-    CommonUtils.readJSON(path)
-               .then(checkJSON, do_throw);
+    CommonUtils.readJSON(path).then(checkJSON, do_throw);
   }
 
   let path = OS.Path.join(OS.Constants.Path.profileDir, "bar.json");
-  CommonUtils.writeJSON(contents, path)
-             .then(doRead, do_throw);
+  CommonUtils.writeJSON(contents, path).then(doRead, do_throw);
 });
--- a/services/common/tests/unit/test_utils_namedTimer.js
+++ b/services/common/tests/unit/test_utils_namedTimer.js
@@ -13,51 +13,61 @@ add_test(function test_required_args() {
 });
 
 add_test(function test_simple() {
   _("Test basic properties of CommonUtils.namedTimer.");
 
   const delay = 200;
   let that = {};
   let t0 = Date.now();
-  CommonUtils.namedTimer(function callback(timer) {
-    Assert.equal(this, that);
-    Assert.equal(this._zetimer, null);
-    Assert.ok(timer instanceof Ci.nsITimer);
-    // Difference should be ~delay, but hard to predict on all platforms,
-    // particularly Windows XP.
-    Assert.ok(Date.now() > t0);
-    run_next_test();
-  }, delay, that, "_zetimer");
+  CommonUtils.namedTimer(
+    function callback(timer) {
+      Assert.equal(this, that);
+      Assert.equal(this._zetimer, null);
+      Assert.ok(timer instanceof Ci.nsITimer);
+      // Difference should be ~delay, but hard to predict on all platforms,
+      // particularly Windows XP.
+      Assert.ok(Date.now() > t0);
+      run_next_test();
+    },
+    delay,
+    that,
+    "_zetimer"
+  );
 });
 
 add_test(function test_delay() {
   _("Test delaying a timer that hasn't fired yet.");
 
   const delay = 100;
   let that = {};
   let t0 = Date.now();
   function callback(timer) {
     // Difference should be ~2*delay, but hard to predict on all platforms,
     // particularly Windows XP.
-    Assert.ok((Date.now() - t0) > delay);
+    Assert.ok(Date.now() - t0 > delay);
     run_next_test();
   }
   CommonUtils.namedTimer(callback, delay, that, "_zetimer");
   CommonUtils.namedTimer(callback, 2 * delay, that, "_zetimer");
   run_next_test();
 });
 
 add_test(function test_clear() {
   _("Test clearing a timer that hasn't fired yet.");
 
   const delay = 0;
   let that = {};
-  CommonUtils.namedTimer(function callback(timer) {
-    do_throw("Shouldn't fire!");
-  }, delay, that, "_zetimer");
+  CommonUtils.namedTimer(
+    function callback(timer) {
+      do_throw("Shouldn't fire!");
+    },
+    delay,
+    that,
+    "_zetimer"
+  );
 
   that._zetimer.clear();
   Assert.equal(that._zetimer, null);
   CommonUtils.nextTick(run_next_test);
 
   run_next_test();
 });
--- a/services/common/tokenserverclient.js
+++ b/services/common/tokenserverclient.js
@@ -6,19 +6,23 @@
 
 var EXPORTED_SYMBOLS = [
   "TokenServerClient",
   "TokenServerClientError",
   "TokenServerClientNetworkError",
   "TokenServerClientServerError",
 ];
 
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-const {RESTRequest} = ChromeUtils.import("resource://services-common/rest.js");
-const {Observers} = ChromeUtils.import("resource://services-common/observers.js");
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { RESTRequest } = ChromeUtils.import(
+  "resource://services-common/rest.js"
+);
+const { Observers } = ChromeUtils.import(
+  "resource://services-common/observers.js"
+);
 
 const PREF_LOG_LEVEL = "services.common.log.logger.tokenserverclient";
 
 /**
  * Represents a TokenServerClient error that occurred on the client.
  *
  * This is the base type for all errors raised by client operations.
  *
@@ -30,17 +34,17 @@ function TokenServerClientError(message)
   this.message = message || "Client error.";
   // Without explicitly setting .stack, all stacks from these errors will point
   // to the "new Error()" call a few lines down, which isn't helpful.
   this.stack = Error().stack;
 }
 TokenServerClientError.prototype = new Error();
 TokenServerClientError.prototype.constructor = TokenServerClientError;
 TokenServerClientError.prototype._toStringFields = function() {
-  return {message: this.message};
+  return { message: this.message };
 };
 TokenServerClientError.prototype.toString = function() {
   return this.name + "(" + JSON.stringify(this._toStringFields()) + ")";
 };
 TokenServerClientError.prototype.toJSON = function() {
   let result = this._toStringFields();
   result.name = this.name;
   return result;
@@ -53,20 +57,19 @@ TokenServerClientError.prototype.toJSON 
  *        The underlying error thrown by the network layer.
  */
 function TokenServerClientNetworkError(error) {
   this.name = "TokenServerClientNetworkError";
   this.error = error;
   this.stack = Error().stack;
 }
 TokenServerClientNetworkError.prototype = new TokenServerClientError();
-TokenServerClientNetworkError.prototype.constructor =
-  TokenServerClientNetworkError;
+TokenServerClientNetworkError.prototype.constructor = TokenServerClientNetworkError;
 TokenServerClientNetworkError.prototype._toStringFields = function() {
-  return {error: this.error};
+  return { error: this.error };
 };
 
 /**
  * Represents a TokenServerClient error that occurred on the server.
  *
  * This type will be encountered for all non-200 response codes from the
  * server. The type of error is strongly enumerated and is stored in the
  * `cause` property. This property can have the following string values:
@@ -97,18 +100,17 @@ TokenServerClientNetworkError.prototype.
 function TokenServerClientServerError(message, cause = "general") {
   this.now = new Date().toISOString(); // may be useful to diagnose time-skew issues.
   this.name = "TokenServerClientServerError";
   this.message = message || "Server error.";
   this.cause = cause;
   this.stack = Error().stack;
 }
 TokenServerClientServerError.prototype = new TokenServerClientError();
-TokenServerClientServerError.prototype.constructor =
-  TokenServerClientServerError;
+TokenServerClientServerError.prototype.constructor = TokenServerClientServerError;
 
 TokenServerClientServerError.prototype._toStringFields = function() {
   let fields = {
     now: this.now,
     message: this.message,
     cause: this.cause,
   };
   if (this.response) {
@@ -269,29 +271,33 @@ TokenServerClient.prototype = {
     // Responses should *always* be JSON, even in the case of 4xx and 5xx
     // errors. If we don't see JSON, the server is likely very unhappy.
     let ct = response.headers["content-type"] || "";
     if (ct != "application/json" && !ct.startsWith("application/json;")) {
       this._log.warn("Did not receive JSON response. Misconfigured server?");
       this._log.debug("Content-Type: " + ct);
       this._log.debug("Body: " + response.body);
 
-      let error = new TokenServerClientServerError("Non-JSON response.",
-                                                   "malformed-response");
+      let error = new TokenServerClientServerError(
+        "Non-JSON response.",
+        "malformed-response"
+      );
       error.response = response;
       throw error;
     }
 
     let result;
     try {
       result = JSON.parse(response.body);
     } catch (ex) {
       this._log.warn("Invalid JSON returned by server: " + response.body);
-      let error = new TokenServerClientServerError("Malformed JSON.",
-                                                   "malformed-response");
+      let error = new TokenServerClientServerError(
+        "Malformed JSON.",
+        "malformed-response"
+      );
       error.response = response;
       throw error;
     }
 
     // Any response status can have X-Backoff or X-Weave-Backoff headers.
     this._maybeNotifyBackoff(response, "x-weave-backoff");
     this._maybeNotifyBackoff(response, "x-backoff");
 
@@ -326,17 +332,17 @@ TokenServerClient.prototype = {
         // conditions required unless we are absolutely sure that is what the
         // server is asking for.
         if (!("urls" in result)) {
           this._log.warn("403 response without proper fields!");
           this._log.warn("Response body: " + response.body);
 
           error.message = "Missing JSON fields.";
           error.cause = "malformed-response";
-        } else if (typeof(result.urls) != "object") {
+        } else if (typeof result.urls != "object") {
           error.message = "urls field is not a map.";
           error.cause = "malformed-response";
         } else {
           error.message = "Conditions must be accepted.";
           error.cause = "conditions-required";
           error.urls = result.urls;
         }
       } else if (response.status == 404) {
@@ -348,32 +354,32 @@ TokenServerClient.prototype = {
       // we'll look for it on any error response.
       this._maybeNotifyBackoff(response, "retry-after");
 
       throw error;
     }
 
     for (let k of ["id", "key", "api_endpoint", "uid", "duration"]) {
       if (!(k in result)) {
-        let error = new TokenServerClientServerError("Expected key not " +
-                                                     " present in result: " +
-                                                     k);
+        let error = new TokenServerClientServerError(
+          "Expected key not " + " present in result: " + k
+        );
         error.cause = "malformed-response";
         error.response = response;
         throw error;
       }
     }
 
     this._log.debug("Successful token response");
     return {
-      id:             result.id,
-      key:            result.key,
-      endpoint:       result.api_endpoint,
-      uid:            result.uid,
-      duration:       result.duration,
+      id: result.id,
+      key: result.key,
+      endpoint: result.api_endpoint,
+      uid: result.uid,
+      duration: result.duration,
       hashed_fxa_uid: result.hashed_fxa_uid,
     };
   },
 
   /*
    * The prefix used for all notifications sent by this module.  This
    * allows the handler of notifications to be sure they are handling
    * notifications for the service they expect.
@@ -390,20 +396,27 @@ TokenServerClient.prototype = {
     let headerVal = response.headers[headerName];
     if (!headerVal) {
       return;
     }
     let backoffInterval;
     try {
       backoffInterval = parseInt(headerVal, 10);
     } catch (ex) {
-      this._log.error("TokenServer response had invalid backoff value in '" +
-                      headerName + "' header: " + headerVal);
+      this._log.error(
+        "TokenServer response had invalid backoff value in '" +
+          headerName +
+          "' header: " +
+          headerVal
+      );
       return;
     }
-    Observers.notify(this.observerPrefix + ":backoff:interval", backoffInterval);
+    Observers.notify(
+      this.observerPrefix + ":backoff:interval",
+      backoffInterval
+    );
   },
 
   // override points for testing.
   newRESTRequest(url) {
     return new RESTRequest(url);
   },
 };
--- a/services/common/uptake-telemetry.js
+++ b/services/common/uptake-telemetry.js
@@ -1,30 +1,48 @@
 /* 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";
 
-
 var EXPORTED_SYMBOLS = ["UptakeTelemetry"];
 
-const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "AppConstants",
-                               "resource://gre/modules/AppConstants.jsm");
-ChromeUtils.defineModuleGetter(this, "ClientID",
-                               "resource://gre/modules/ClientID.jsm");
-ChromeUtils.defineModuleGetter(this, "Services",
-                               "resource://gre/modules/Services.jsm");
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+ChromeUtils.defineModuleGetter(
+  this,
+  "AppConstants",
+  "resource://gre/modules/AppConstants.jsm"
+);
+ChromeUtils.defineModuleGetter(
+  this,
+  "ClientID",
+  "resource://gre/modules/ClientID.jsm"
+);
+ChromeUtils.defineModuleGetter(
+  this,
+  "Services",
+  "resource://gre/modules/Services.jsm"
+);
 
 XPCOMUtils.defineLazyGetter(this, "CryptoHash", () => {
-  return Components.Constructor("@mozilla.org/security/hash;1", "nsICryptoHash", "initWithString");
+  return Components.Constructor(
+    "@mozilla.org/security/hash;1",
+    "nsICryptoHash",
+    "initWithString"
+  );
 });
 
-XPCOMUtils.defineLazyPreferenceGetter(this, "gSampleRate", "services.common.uptake.sampleRate");
+XPCOMUtils.defineLazyPreferenceGetter(
+  this,
+  "gSampleRate",
+  "services.common.uptake.sampleRate"
+);
 
 // Telemetry histogram id (see Histograms.json).
 const TELEMETRY_HISTOGRAM_ID = "UPTAKE_REMOTE_CONTENT_RESULT_1";
 
 // Telemetry events id (see Events.yaml).
 const TELEMETRY_EVENTS_ID = "uptake.remotecontent.result";
 
 /**
@@ -100,40 +118,40 @@ class UptakeTelemetry {
    * - `CUSTOM_3_ERROR`: Update source specific error #3.
    * - `CUSTOM_4_ERROR`: Update source specific error #4.
    * - `CUSTOM_5_ERROR`: Update source specific error #5.
    *
    * @type {Object}
    */
   static get STATUS() {
     return {
-      UP_TO_DATE:            "up_to_date",
-      SUCCESS:               "success",
-      BACKOFF:               "backoff",
-      PREF_DISABLED:         "pref_disabled",
-      PARSE_ERROR:           "parse_error",
-      CONTENT_ERROR:         "content_error",
-      SIGNATURE_ERROR:       "sign_error",
+      UP_TO_DATE: "up_to_date",
+      SUCCESS: "success",
+      BACKOFF: "backoff",
+      PREF_DISABLED: "pref_disabled",
+      PARSE_ERROR: "parse_error",
+      CONTENT_ERROR: "content_error",
+      SIGNATURE_ERROR: "sign_error",
       SIGNATURE_RETRY_ERROR: "sign_retry_error",
-      CONFLICT_ERROR:        "conflict_error",
-      SYNC_ERROR:            "sync_error",
-      APPLY_ERROR:           "apply_error",
-      SERVER_ERROR:          "server_error",
-      CERTIFICATE_ERROR:     "certificate_error",
-      DOWNLOAD_ERROR:        "download_error",
-      TIMEOUT_ERROR:         "timeout_error",
-      NETWORK_ERROR:         "network_error",
+      CONFLICT_ERROR: "conflict_error",
+      SYNC_ERROR: "sync_error",
+      APPLY_ERROR: "apply_error",
+      SERVER_ERROR: "server_error",
+      CERTIFICATE_ERROR: "certificate_error",
+      DOWNLOAD_ERROR: "download_error",
+      TIMEOUT_ERROR: "timeout_error",
+      NETWORK_ERROR: "network_error",
       NETWORK_OFFLINE_ERROR: "offline_error",
-      CLEANUP_ERROR:         "cleanup_error",
-      UNKNOWN_ERROR:         "unknown_error",
-      CUSTOM_1_ERROR:        "custom_1_error",
-      CUSTOM_2_ERROR:        "custom_2_error",
-      CUSTOM_3_ERROR:        "custom_3_error",
-      CUSTOM_4_ERROR:        "custom_4_error",
-      CUSTOM_5_ERROR:        "custom_5_error",
+      CLEANUP_ERROR: "cleanup_error",
+      UNKNOWN_ERROR: "unknown_error",
+      CUSTOM_1_ERROR: "custom_1_error",
+      CUSTOM_2_ERROR: "custom_2_error",
+      CUSTOM_3_ERROR: "custom_3_error",
+      CUSTOM_4_ERROR: "custom_4_error",
+      CUSTOM_5_ERROR: "custom_5_error",
     };
   }
 
   /**
    * Reports the uptake status for the specified source.
    *
    * @param {string} component     the component reporting the uptake (eg. "normandy").
    * @param {string} status        the uptake status (eg. "network_error")
@@ -154,25 +172,31 @@ class UptakeTelemetry {
     // Enable them on first call to `report()`.
     if (!this._eventsEnabled) {
       Services.telemetry.setEventRecordingEnabled(TELEMETRY_EVENTS_ID, true);
       this._eventsEnabled = true;
     }
 
     const hash = await Policy.getClientIDHash();
     const channel = Policy.getChannel();
-    const shouldSendEvent = !["release", "esr"].includes(channel) || hash < gSampleRate;
+    const shouldSendEvent =
+      !["release", "esr"].includes(channel) || hash < gSampleRate;
     if (shouldSendEvent) {
       // The Event API requires `extra` values to be of type string. Force it!
-      const extraStr = Object.keys(extra).reduce(( acc, k ) => {
+      const extraStr = Object.keys(extra).reduce((acc, k) => {
         acc[k] = extra[k].toString();
         return acc;
       }, {});
-      Services.telemetry
-        .recordEvent(TELEMETRY_EVENTS_ID, "uptake", component, status, extraStr);
+      Services.telemetry.recordEvent(
+        TELEMETRY_EVENTS_ID,
+        "uptake",
+        component,
+        status,
+        extraStr
+      );
     }
 
     // Report via histogram in main ping.
     // Note: this is the legacy equivalent of the above event. We keep it for continuity.
     Services.telemetry
       .getKeyedHistogramById(TELEMETRY_HISTOGRAM_ID)
       .add(source, status);
   }
--- a/services/common/utils.js
+++ b/services/common/utils.js
@@ -1,19 +1,20 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["CommonUtils"];
 
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
-ChromeUtils.defineModuleGetter(this, "OS",
-                               "resource://gre/modules/osfile.jsm");
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
+ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 
 var CommonUtils = {
   /*
    * Set manipulation methods. These should be lifted into toolkit, or added to
    * `Set` itself.
    */
 
   /**
@@ -89,31 +90,34 @@ var CommonUtils = {
    *
    * @param bytes
    *        (string) Raw byte string to encode.
    * @param pad
    *        (bool) Whether to include padding characters (=). Defaults
    *        to true for historical reasons.
    */
   encodeBase64URL: function encodeBase64URL(bytes, pad = true) {
-    let s = btoa(bytes).replace(/\+/g, "-").replace(/\//g, "_");
+    let s = btoa(bytes)
+      .replace(/\+/g, "-")
+      .replace(/\//g, "_");
 
     if (!pad) {
       return s.replace(/=+$/, "");
     }
 
     return s;
   },
 
   /**
    * Create a nsIURI instance from a string.
    */
   makeURI: function makeURI(URIString) {
-    if (!URIString)
+    if (!URIString) {
       return null;
+    }
     try {
       return Services.io.newURI(URIString);
     } catch (e) {
       let log = Log.repository.getLogger("Common.Utils");
       log.debug("Could not create URI", e);
       return null;
     }
   },
@@ -136,44 +140,51 @@ var CommonUtils = {
   /**
    * Return a timer that is scheduled to call the callback after waiting the
    * provided time or as soon as possible. The timer will be set as a property
    * of the provided object with the given timer name.
    */
   namedTimer: function namedTimer(callback, wait, thisObj, name) {
     if (!thisObj || !name) {
       throw new Error(
-          "You must provide both an object and a property name for the timer!");
+        "You must provide both an object and a property name for the timer!"
+      );
     }
 
     // Delay an existing timer if it exists
     if (name in thisObj && thisObj[name] instanceof Ci.nsITimer) {
       thisObj[name].delay = wait;
       return thisObj[name];
     }
 
     // Create a special timer that we can add extra properties
-    let timer = Object.create(Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer));
+    let timer = Object.create(
+      Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
+    );
 
     // Provide an easy way to clear out the timer
     timer.clear = function() {
       thisObj[name] = null;
       timer.cancel();
     };
 
     // Initialize the timer with a smart callback
-    timer.initWithCallback({
-      notify: function notify() {
-        // Clear out the timer once it's been triggered
-        timer.clear();
-        callback.call(thisObj, timer);
+    timer.initWithCallback(
+      {
+        notify: function notify() {
+          // Clear out the timer once it's been triggered
+          timer.clear();
+          callback.call(thisObj, timer);
+        },
       },
-    }, wait, timer.TYPE_ONE_SHOT);
+      wait,
+      timer.TYPE_ONE_SHOT
+    );
 
-    return thisObj[name] = timer;
+    return (thisObj[name] = timer);
   },
 
   encodeUTF8: function encodeUTF8(str) {
     try {
       str = this._utf8Converter.ConvertFromUnicode(str);
       return str + this._utf8Converter.Finish();
     } catch (ex) {
       return null;
@@ -211,17 +222,19 @@ var CommonUtils = {
     return bytes;
   },
 
   arrayBufferToByteString(buffer) {
     return CommonUtils.byteArrayToString([...buffer]);
   },
 
   bufferToHex(buffer) {
-    return Array.prototype.map.call(buffer, (x) => ("00" + x.toString(16)).slice(-2)).join("");
+    return Array.prototype.map
+      .call(buffer, x => ("00" + x.toString(16)).slice(-2))
+      .join("");
   },
 
   bytesAsHex: function bytesAsHex(bytes) {
     let s = "";
     for (let i = 0, len = bytes.length; i < len; i++) {
       let c = (bytes[i].charCodeAt(0) & 0xff).toString(16);
       if (c.length == 1) {
         c = "0" + c;
@@ -260,33 +273,37 @@ var CommonUtils = {
    * Base32 encode (RFC 4648) a string
    */
   encodeBase32: function encodeBase32(bytes) {
     const key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
     let leftover = bytes.length % 5;
 
     // Pad the last quantum with zeros so the length is a multiple of 5.
     if (leftover) {
-      for (let i = leftover; i < 5; i++)
+      for (let i = leftover; i < 5; i++) {
         bytes += "\0";
+      }
     }
 
     // Chop the string into quanta of 5 bytes (40 bits). Each quantum
     // is turned into 8 characters from the 32 character base.
     let ret = "";
     for (let i = 0; i < bytes.length; i += 5) {
-      let c = Array.prototype.slice.call(bytes.slice(i, i + 5)).map(byte => byte.charCodeAt(0));
-      ret += key[c[0] >> 3]
-           + key[((c[0] << 2) & 0x1f) | (c[1] >> 6)]
-           + key[(c[1] >> 1) & 0x1f]
-           + key[((c[1] << 4) & 0x1f) | (c[2] >> 4)]
-           + key[((c[2] << 1) & 0x1f) | (c[3] >> 7)]
-           + key[(c[3] >> 2) & 0x1f]
-           + key[((c[3] << 3) & 0x1f) | (c[4] >> 5)]
-           + key[c[4] & 0x1f];
+      let c = Array.prototype.slice
+        .call(bytes.slice(i, i + 5))
+        .map(byte => byte.charCodeAt(0));
+      ret +=
+        key[c[0] >> 3] +
+        key[((c[0] << 2) & 0x1f) | (c[1] >> 6)] +
+        key[(c[1] >> 1) & 0x1f] +
+        key[((c[1] << 4) & 0x1f) | (c[2] >> 4)] +
+        key[((c[2] << 1) & 0x1f) | (c[3] >> 7)] +
+        key[(c[3] >> 2) & 0x1f] +
+        key[((c[3] << 3) & 0x1f) | (c[4] >> 5)] +
+        key[c[4] & 0x1f];
     }
 
     switch (leftover) {
       case 1:
         return ret.slice(0, -6) + "======";
       case 2:
         return ret.slice(0, -4) + "====";
       case 3:
@@ -300,39 +317,42 @@ var CommonUtils = {
 
   /**
    * Base32 decode (RFC 4648) a string.
    */
   decodeBase32: function decodeBase32(str) {
     const key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
 
     let padChar = str.indexOf("=");
-    let chars = (padChar == -1) ? str.length : padChar;
-    let bytes = Math.floor(chars * 5 / 8);
+    let chars = padChar == -1 ? str.length : padChar;
+    let bytes = Math.floor((chars * 5) / 8);
     let blocks = Math.ceil(chars / 8);
 
     // Process a chunk of 5 bytes / 8 characters.
     // The processing of this is known in advance,
     // so avoid arithmetic!
     function processBlock(ret, cOffset, rOffset) {
       let c, val;
 
       // N.B., this relies on
       //   undefined | foo == foo.
       function accumulate(val) {
         ret[rOffset] |= val;
       }
 
       function advance() {
-        c  = str[cOffset++];
-        if (!c || c == "" || c == "=") // Easier than range checking.
-          throw new Error("Done"); // Will be caught far away.
+        c = str[cOffset++];
+        if (!c || c == "" || c == "=") {
+          // Easier than range checking.
+          throw new Error("Done");
+        } // Will be caught far away.
         val = key.indexOf(c);
-        if (val == -1)
+        if (val == -1) {
           throw new Error(`Unknown character in base32: ${c}`);
+        }
       }
 
       // Handle a left shift, restricted to bytes.
       function left(octet, shift) {
         return (octet << shift) & 0xff;
       }
 
       advance();
@@ -358,28 +378,29 @@ var CommonUtils = {
       ++rOffset;
       accumulate(left(val, 5));
       advance();
       accumulate(val);
       ++rOffset;
     }
 
     // Our output. Define to be explicit (and maybe the compiler will be smart).
-    let ret  = new Array(bytes);
-    let i    = 0;
+    let ret = new Array(bytes);
+    let i = 0;
     let cOff = 0;
     let rOff = 0;
 
     for (; i < blocks; ++i) {
       try {
         processBlock(ret, cOff, rOff);
       } catch (ex) {
         // Handle the detection of padding.
-        if (ex.message == "Done")
+        if (ex.message == "Done") {
           break;
+        }
         throw ex;
       }
       cOff += 8;
       rOff += 5;
     }
 
     // Slice in case our shift overflowed to the right.
     return CommonUtils.byteArrayToString(ret.slice(0, bytes));
@@ -398,34 +419,36 @@ var CommonUtils = {
 
   /**
    * Parses a JSON file from disk using OS.File and promises.
    *
    * @param path the file to read. Will be passed to `OS.File.read()`.
    * @return a promise that resolves to the JSON contents of the named file.
    */
   readJSON(path) {
-    return OS.File.read(path, { encoding: "utf-8" }).then((data) => {
+    return OS.File.read(path, { encoding: "utf-8" }).then(data => {
       return JSON.parse(data);
     });
   },
 
   /**
    * Write a JSON object to the named file using OS.File and promises.
    *
    * @param contents a JS object. Will be serialized.
    * @param path the path of the file to write.
    * @return a promise, as produced by OS.File.writeAtomic.
    */
   writeJSON(contents, path) {
     let data = JSON.stringify(contents);
-    return OS.File.writeAtomic(path, data, {encoding: "utf-8", tmpPath: path + ".tmp"});
+    return OS.File.writeAtomic(path, data, {
+      encoding: "utf-8",
+      tmpPath: path + ".tmp",
+    });
   },
 
-
   /**
    * Ensure that the specified value is defined in integer milliseconds since
    * UNIX epoch.
    *
    * This throws an error if the value is not an integer, is negative, or looks
    * like seconds, not milliseconds.
    *
    * If the value is null or 0, no exception is raised.
@@ -440,17 +463,17 @@ var CommonUtils = {
 
     if (!/^[0-9]+$/.test(value)) {
       throw new Error("Timestamp value is not a positive integer: " + value);
     }
 
     let intValue = parseInt(value, 10);
 
     if (!intValue) {
-       return;
+      return;
     }
 
     // Catch what looks like seconds, not milliseconds.
     if (intValue < 10000000000) {
       throw new Error("Timestamp appears to be in seconds: " + intValue);
     }
   },
 
@@ -460,38 +483,39 @@ var CommonUtils = {
    * @param stream
    *        (nsIInputStream) Stream to read from.
    * @param count
    *        (number) Integer number of bytes to read. If not defined, or
    *        0, all available input is read.
    */
   readBytesFromInputStream: function readBytesFromInputStream(stream, count) {
     let BinaryInputStream = Components.Constructor(
-        "@mozilla.org/binaryinputstream;1",
-        "nsIBinaryInputStream",
-        "setInputStream");
+      "@mozilla.org/binaryinputstream;1",
+      "nsIBinaryInputStream",
+      "setInputStream"
+    );
     if (!count) {
       count = stream.available();
     }
 
     return new BinaryInputStream(stream).readBytes(count);
   },
 
   /**
    * Generate a new UUID using nsIUUIDGenerator.
    *
    * Example value: "1e00a2e2-1570-443e-bf5e-000354124234"
    *
    * @return string A hex-formatted UUID string.
    */
   generateUUID: function generateUUID() {
     let uuid = Cc["@mozilla.org/uuid-generator;1"]
-                 .getService(Ci.nsIUUIDGenerator)
-                 .generateUUID()
-                 .toString();
+      .getService(Ci.nsIUUIDGenerator)
+      .generateUUID()
+      .toString();
 
     return uuid.substring(1, uuid.length - 1);
   },
 
   /**
    * Obtain an epoch value from a preference.
    *
    * This reads a string preference and returns an integer. The string
@@ -520,18 +544,24 @@ var CommonUtils = {
     }
 
     let valueStr = branch.get(pref, null);
 
     if (valueStr !== null) {
       let valueInt = parseInt(valueStr, 10);
       if (Number.isNaN(valueInt)) {
         if (log) {
-          log.warn("Preference value is not an integer. Using default. " +
-                   pref + "=" + valueStr + " -> " + def);
+          log.warn(
+            "Preference value is not an integer. Using default. " +
+              pref +
+              "=" +
+              valueStr +
+              " -> " +
+              def
+          );
         }
 
         return def;
       }
 
       return valueInt;
     }
 
@@ -554,28 +584,39 @@ var CommonUtils = {
    * @param def
    *        (Number) The default value (in milliseconds) if the preference is
    *        not defined or invalid.
    * @param log
    *        (Log.Logger) Logger to write warnings to.
    * @param oldestYear
    *        (Number) Oldest year to accept in read values.
    */
-  getDatePref: function getDatePref(branch, pref, def = 0, log = null,
-                                    oldestYear = 2010) {
+  getDatePref: function getDatePref(
+    branch,
+    pref,
+    def = 0,
+    log = null,
+    oldestYear = 2010
+  ) {
     let valueInt = this.getEpochPref(branch, pref, def, log);
     let date = new Date(valueInt);
 
     if (valueInt == def || date.getFullYear() >= oldestYear) {
       return date;
     }
 
     if (log) {
-      log.warn("Unexpected old date seen in pref. Returning default: " +
-               pref + "=" + date + " -> " + def);
+      log.warn(
+        "Unexpected old date seen in pref. Returning default: " +
+          pref +
+          "=" +
+          date +
+          " -> " +
+          def
+      );
     }
 
     return new Date(def);
   },
 
   /**
    * Store a Date in a preference.
    *
@@ -590,19 +631,25 @@ var CommonUtils = {
    *        (string) Name of preference to write to.
    * @param date
    *        (Date) The value to save.
    * @param oldestYear
    *        (Number) The oldest year to accept for values.
    */
   setDatePref: function setDatePref(branch, pref, date, oldestYear = 2010) {
     if (date.getFullYear() < oldestYear) {
-      throw new Error("Trying to set " + pref + " to a very old time: " +
-                      date + ". The current time is " + new Date() +
-                      ". Is the system clock wrong?");
+      throw new Error(
+        "Trying to set " +
+          pref +
+          " to a very old time: " +
+          date +
+          ". The current time is " +
+          new Date() +
+          ". Is the system clock wrong?"
+      );
     }
 
     branch.set(pref, "" + date.getTime());
   },
 
   /**
    * Convert a string between two encodings.
    *
@@ -622,45 +669,58 @@ var CommonUtils = {
    *
    * @return string
    */
   convertString: function convertString(s, source, dest) {
     if (!s) {
       throw new Error("Input string must be defined.");
     }
 
-    let is = Cc["@mozilla.org/io/string-input-stream;1"]
-               .createInstance(Ci.nsIStringInputStream);
+    let is = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
+      Ci.nsIStringInputStream
+    );
     is.setData(s, s.length);
 
-    let listener = Cc["@mozilla.org/network/stream-loader;1"]
-                     .createInstance(Ci.nsIStreamLoader);
+    let listener = Cc["@mozilla.org/network/stream-loader;1"].createInstance(
+      Ci.nsIStreamLoader
+    );
 
     let result;
 
     listener.init({
-      onStreamComplete: function onStreamComplete(loader, context, status,
-                                                  length, data) {
+      onStreamComplete: function onStreamComplete(
+        loader,
+        context,
+        status,
+        length,
+        data
+      ) {
         result = String.fromCharCode.apply(this, data);
       },
     });
 
-    let converter = this._converterService.asyncConvertData(source, dest,
-                                                            listener, null);
+    let converter = this._converterService.asyncConvertData(
+      source,
+      dest,
+      listener,
+      null
+    );
     converter.onStartRequest(null, null);
     converter.onDataAvailable(null, is, 0, s.length);
     converter.onStopRequest(null, null, null);
 
     return result;
   },
 };
 
 XPCOMUtils.defineLazyGetter(CommonUtils, "_utf8Converter", function() {
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
-                    .createInstance(Ci.nsIScriptableUnicodeConverter);
+  let converter = Cc[
+    "@mozilla.org/intl/scriptableunicodeconverter"
+  ].createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   return converter;
 });
 
 XPCOMUtils.defineLazyGetter(CommonUtils, "_converterService", function() {
-  return Cc["@mozilla.org/streamConverters;1"]
-           .getService(Ci.nsIStreamConverterService);
+  return Cc["@mozilla.org/streamConverters;1"].getService(
+    Ci.nsIStreamConverterService
+  );
 });
--- a/services/crypto/modules/WeaveCrypto.js
+++ b/services/crypto/modules/WeaveCrypto.js
@@ -1,218 +1,244 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["WeaveCrypto"];
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["crypto"]);
 
-const CRYPT_ALGO        = "AES-CBC";
+const CRYPT_ALGO = "AES-CBC";
 const CRYPT_ALGO_LENGTH = 256;
-const AES_CBC_IV_SIZE   = 16;
-const OPERATIONS        = { ENCRYPT: 0, DECRYPT: 1 };
-const UTF_LABEL          = "utf-8";
+const AES_CBC_IV_SIZE = 16;
+const OPERATIONS = { ENCRYPT: 0, DECRYPT: 1 };
+const UTF_LABEL = "utf-8";
 
-const KEY_DERIVATION_ALGO         = "PBKDF2";
+const KEY_DERIVATION_ALGO = "PBKDF2";
 const KEY_DERIVATION_HASHING_ALGO = "SHA-1";
-const KEY_DERIVATION_ITERATIONS   = 4096; // PKCS#5 recommends at least 1000.
-const DERIVED_KEY_ALGO            = CRYPT_ALGO;
+const KEY_DERIVATION_ITERATIONS = 4096; // PKCS#5 recommends at least 1000.
+const DERIVED_KEY_ALGO = CRYPT_ALGO;
 
 function WeaveCrypto() {
-    this.init();
+  this.init();
 }
 
 WeaveCrypto.prototype = {
-    prefBranch: null,
-    debug: true,  // services.sync.log.cryptoDebug
+  prefBranch: null,
+  debug: true, // services.sync.log.cryptoDebug
 
-    observer: {
-        _self: null,
-
-        QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
-                                                Ci.nsISupportsWeakReference]),
+  observer: {
+    _self: null,
 
-        observe(subject, topic, data) {
-            let self = this._self;
-            self.log("Observed " + topic + " topic.");
-            if (topic == "nsPref:changed") {
-                self.debug = self.prefBranch.getBoolPref("cryptoDebug");
-            }
-        },
+    QueryInterface: ChromeUtils.generateQI([
+      Ci.nsIObserver,
+      Ci.nsISupportsWeakReference,
+    ]),
+
+    observe(subject, topic, data) {
+      let self = this._self;
+      self.log("Observed " + topic + " topic.");
+      if (topic == "nsPref:changed") {
+        self.debug = self.prefBranch.getBoolPref("cryptoDebug");
+      }
     },
+  },
 
-    init() {
-        // Preferences. Add observer so we get notified of changes.
-        this.prefBranch = Services.prefs.getBranch("services.sync.log.");
-        this.prefBranch.addObserver("cryptoDebug", this.observer);
-        this.observer._self = this;
-        this.debug = this.prefBranch.getBoolPref("cryptoDebug", false);
-        XPCOMUtils.defineLazyGetter(this, "encoder", () => new TextEncoder(UTF_LABEL));
-        XPCOMUtils.defineLazyGetter(this, "decoder", () => new TextDecoder(UTF_LABEL, { fatal: true }));
-    },
+  init() {
+    // Preferences. Add observer so we get notified of changes.
+    this.prefBranch = Services.prefs.getBranch("services.sync.log.");
+    this.prefBranch.addObserver("cryptoDebug", this.observer);
+    this.observer._self = this;
+    this.debug = this.prefBranch.getBoolPref("cryptoDebug", false);
+    XPCOMUtils.defineLazyGetter(
+      this,
+      "encoder",
+      () => new TextEncoder(UTF_LABEL)
+    );
+    XPCOMUtils.defineLazyGetter(
+      this,
+      "decoder",
+      () => new TextDecoder(UTF_LABEL, { fatal: true })
+    );
+  },
 
-    log(message) {
-        if (!this.debug) {
-            return;
-        }
-        dump("WeaveCrypto: " + message + "\n");
-        Services.console.logStringMessage("WeaveCrypto: " + message);
-    },
+  log(message) {
+    if (!this.debug) {
+      return;
+    }
+    dump("WeaveCrypto: " + message + "\n");
+    Services.console.logStringMessage("WeaveCrypto: " + message);
+  },
 
-    // /!\ Only use this for tests! /!\
-    _getCrypto() {
-        return crypto;
-    },
-
-    async encrypt(clearTextUCS2, symmetricKey, iv) {
-        this.log("encrypt() called");
-        let clearTextBuffer = this.encoder.encode(clearTextUCS2).buffer;
-        let encrypted = await this._commonCrypt(clearTextBuffer, symmetricKey, iv, OPERATIONS.ENCRYPT);
-        return this.encodeBase64(encrypted);
-    },
+  // /!\ Only use this for tests! /!\
+  _getCrypto() {
+    return crypto;
+  },
 
-    async decrypt(cipherText, symmetricKey, iv) {
-        this.log("decrypt() called");
-        if (cipherText.length) {
-            cipherText = atob(cipherText);
-        }
-        let cipherTextBuffer = this.byteCompressInts(cipherText);
-        let decrypted = await this._commonCrypt(cipherTextBuffer, symmetricKey, iv, OPERATIONS.DECRYPT);
-        return this.decoder.decode(decrypted);
-    },
+  async encrypt(clearTextUCS2, symmetricKey, iv) {
+    this.log("encrypt() called");
+    let clearTextBuffer = this.encoder.encode(clearTextUCS2).buffer;
+    let encrypted = await this._commonCrypt(
+      clearTextBuffer,
+      symmetricKey,
+      iv,
+      OPERATIONS.ENCRYPT
+    );
+    return this.encodeBase64(encrypted);
+  },
 
-    /**
-     * _commonCrypt
-     *
-     * @args
-     * data: data to encrypt/decrypt (ArrayBuffer)
-     * symKeyStr: symmetric key (Base64 String)
-     * ivStr: initialization vector (Base64 String)
-     * operation: operation to apply (either OPERATIONS.ENCRYPT or OPERATIONS.DECRYPT)
-     * @returns
-     * the encrypted/decrypted data (ArrayBuffer)
-    */
-    async _commonCrypt(data, symKeyStr, ivStr, operation) {
-        this.log("_commonCrypt() called");
-        ivStr = atob(ivStr);
+  async decrypt(cipherText, symmetricKey, iv) {
+    this.log("decrypt() called");
+    if (cipherText.length) {
+      cipherText = atob(cipherText);
+    }
+    let cipherTextBuffer = this.byteCompressInts(cipherText);
+    let decrypted = await this._commonCrypt(
+      cipherTextBuffer,
+      symmetricKey,
+      iv,
+      OPERATIONS.DECRYPT
+    );
+    return this.decoder.decode(decrypted);
+  },
 
-        if (operation !== OPERATIONS.ENCRYPT && operation !== OPERATIONS.DECRYPT) {
-            throw new Error("Unsupported operation in _commonCrypt.");
-        }
-        // We never want an IV longer than the block size, which is 16 bytes
-        // for AES, neither do we want one smaller; throw in both cases.
-        if (ivStr.length !== AES_CBC_IV_SIZE) {
-            throw new Error(
-                `Invalid IV size; must be ${AES_CBC_IV_SIZE} bytes.`);
-        }
+  /**
+   * _commonCrypt
+   *
+   * @args
+   * data: data to encrypt/decrypt (ArrayBuffer)
+   * symKeyStr: symmetric key (Base64 String)
+   * ivStr: initialization vector (Base64 String)
+   * operation: operation to apply (either OPERATIONS.ENCRYPT or OPERATIONS.DECRYPT)
+   * @returns
+   * the encrypted/decrypted data (ArrayBuffer)
+   */
+  async _commonCrypt(data, symKeyStr, ivStr, operation) {
+    this.log("_commonCrypt() called");
+    ivStr = atob(ivStr);
 
-        let iv = this.byteCompressInts(ivStr);
-        let symKey = await this.importSymKey(symKeyStr, operation);
-        let cryptMethod = (operation === OPERATIONS.ENCRYPT
-                           ? crypto.subtle.encrypt
-                           : crypto.subtle.decrypt)
-                          .bind(crypto.subtle);
-        let algo = { name: CRYPT_ALGO, iv };
-
-        let keyBytes = await cryptMethod.call(crypto.subtle, algo, symKey, data);
-        return new Uint8Array(keyBytes);
-    },
-
+    if (operation !== OPERATIONS.ENCRYPT && operation !== OPERATIONS.DECRYPT) {
+      throw new Error("Unsupported operation in _commonCrypt.");
+    }
+    // We never want an IV longer than the block size, which is 16 bytes
+    // for AES, neither do we want one smaller; throw in both cases.
+    if (ivStr.length !== AES_CBC_IV_SIZE) {
+      throw new Error(`Invalid IV size; must be ${AES_CBC_IV_SIZE} bytes.`);
+    }
 
-    async generateRandomKey() {
-        this.log("generateRandomKey() called");
-        let algo = {
-            name: CRYPT_ALGO,
-            length: CRYPT_ALGO_LENGTH,
-        };
-        let key = await crypto.subtle.generateKey(algo, true, []);
-        let keyBytes = await crypto.subtle.exportKey("raw", key);
-        return this.encodeBase64(new Uint8Array(keyBytes));
-    },
+    let iv = this.byteCompressInts(ivStr);
+    let symKey = await this.importSymKey(symKeyStr, operation);
+    let cryptMethod = (operation === OPERATIONS.ENCRYPT
+      ? crypto.subtle.encrypt
+      : crypto.subtle.decrypt
+    ).bind(crypto.subtle);
+    let algo = { name: CRYPT_ALGO, iv };
 
-    generateRandomIV() {
-      return this.generateRandomBytes(AES_CBC_IV_SIZE);
-    },
+    let keyBytes = await cryptMethod.call(crypto.subtle, algo, symKey, data);
+    return new Uint8Array(keyBytes);
+  },
 
-    generateRandomBytes(byteCount) {
-        this.log("generateRandomBytes() called");
-
-        let randBytes = new Uint8Array(byteCount);
-        crypto.getRandomValues(randBytes);
-
-        return this.encodeBase64(randBytes);
-    },
+  async generateRandomKey() {
+    this.log("generateRandomKey() called");
+    let algo = {
+      name: CRYPT_ALGO,
+      length: CRYPT_ALGO_LENGTH,
+    };
+    let key = await crypto.subtle.generateKey(algo, true, []);
+    let keyBytes = await crypto.subtle.exportKey("raw", key);
+    return this.encodeBase64(new Uint8Array(keyBytes));
+  },
 
-    //
-    // SymKey CryptoKey memoization.
-    //
+  generateRandomIV() {
+    return this.generateRandomBytes(AES_CBC_IV_SIZE);
+  },
 
-    // Memoize the import of symmetric keys. We do this by using the base64
-    // string itself as a key.
-    _encryptionSymKeyMemo: {},
-    _decryptionSymKeyMemo: {},
-    async importSymKey(encodedKeyString, operation) {
-        let memo;
+  generateRandomBytes(byteCount) {
+    this.log("generateRandomBytes() called");
+
+    let randBytes = new Uint8Array(byteCount);
+    crypto.getRandomValues(randBytes);
 
-        // We use two separate memos for thoroughness: operation is an input to
-        // key import.
-        switch (operation) {
-            case OPERATIONS.ENCRYPT:
-                memo = this._encryptionSymKeyMemo;
-                break;
-            case OPERATIONS.DECRYPT:
-                memo = this._decryptionSymKeyMemo;
-                break;
-            default:
-                throw new Error("Unsupported operation in importSymKey.");
-        }
+    return this.encodeBase64(randBytes);
+  },
+
+  //
+  // SymKey CryptoKey memoization.
+  //
+
+  // Memoize the import of symmetric keys. We do this by using the base64
+  // string itself as a key.
+  _encryptionSymKeyMemo: {},
+  _decryptionSymKeyMemo: {},
+  async importSymKey(encodedKeyString, operation) {
+    let memo;
 
-        if (encodedKeyString in memo)
-            return memo[encodedKeyString];
+    // We use two separate memos for thoroughness: operation is an input to
+    // key import.
+    switch (operation) {
+      case OPERATIONS.ENCRYPT:
+        memo = this._encryptionSymKeyMemo;
+        break;
+      case OPERATIONS.DECRYPT:
+        memo = this._decryptionSymKeyMemo;
+        break;
+      default:
+        throw new Error("Unsupported operation in importSymKey.");
+    }
 
-        let symmetricKeyBuffer = this.makeUint8Array(encodedKeyString, true);
-        let algo = { name: CRYPT_ALGO };
-        let usages = [operation === OPERATIONS.ENCRYPT ? "encrypt" : "decrypt"];
-        let symKey = await crypto.subtle.importKey("raw", symmetricKeyBuffer, algo, false, usages);
-        memo[encodedKeyString] = symKey;
-        return symKey;
-    },
+    if (encodedKeyString in memo) {
+      return memo[encodedKeyString];
+    }
 
-
-    //
-    // Utility functions
-    //
+    let symmetricKeyBuffer = this.makeUint8Array(encodedKeyString, true);
+    let algo = { name: CRYPT_ALGO };
+    let usages = [operation === OPERATIONS.ENCRYPT ? "encrypt" : "decrypt"];
+    let symKey = await crypto.subtle.importKey(
+      "raw",
+      symmetricKeyBuffer,
+      algo,
+      false,
+      usages
+    );
+    memo[encodedKeyString] = symKey;
+    return symKey;
+  },
 
-    /**
-     * Returns an Uint8Array filled with a JS string,
-     * which means we only keep utf-16 characters from 0x00 to 0xFF.
-     */
-    byteCompressInts(str) {
-        let arrayBuffer = new Uint8Array(str.length);
-        for (let i = 0; i < str.length; i++) {
-            arrayBuffer[i] = str.charCodeAt(i) & 0xFF;
-        }
-        return arrayBuffer;
-    },
+  //
+  // Utility functions
+  //
+
+  /**
+   * Returns an Uint8Array filled with a JS string,
+   * which means we only keep utf-16 characters from 0x00 to 0xFF.
+   */
+  byteCompressInts(str) {
+    let arrayBuffer = new Uint8Array(str.length);
+    for (let i = 0; i < str.length; i++) {
+      arrayBuffer[i] = str.charCodeAt(i) & 0xff;
+    }
+    return arrayBuffer;
+  },
 
-    expandData(data) {
-        let expanded = "";
-        for (let i = 0; i < data.length; i++) {
-            expanded += String.fromCharCode(data[i]);
-        }
-        return expanded;
-    },
+  expandData(data) {
+    let expanded = "";
+    for (let i = 0; i < data.length; i++) {
+      expanded += String.fromCharCode(data[i]);
+    }
+    return expanded;
+  },
 
-    encodeBase64(data) {
-        return btoa(this.expandData(data));
-    },
+  encodeBase64(data) {
+    return btoa(this.expandData(data));
+  },
 
-    makeUint8Array(input, isEncoded) {
-        if (isEncoded) {
-            input = atob(input);
-        }
-        return this.byteCompressInts(input);
-    },
+  makeUint8Array(input, isEncoded) {
+    if (isEncoded) {
+      input = atob(input);
+    }
+    return this.byteCompressInts(input);
+  },
 };
--- a/services/crypto/modules/jwcrypto.jsm
+++ b/services/crypto/modules/jwcrypto.jsm
@@ -1,39 +1,43 @@
 /* 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 {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
 
-XPCOMUtils.defineLazyServiceGetter(this,
-                                   "IdentityCryptoService",
-                                   "@mozilla.org/identity/crypto-service;1",
-                                   "nsIIdentityCryptoService");
+XPCOMUtils.defineLazyServiceGetter(
+  this,
+  "IdentityCryptoService",
+  "@mozilla.org/identity/crypto-service;1",
+  "nsIIdentityCryptoService"
+);
 XPCOMUtils.defineLazyGlobalGetters(this, ["crypto"]);
 
 const EXPORTED_SYMBOLS = ["jwcrypto"];
 
 const PREF_LOG_LEVEL = "services.crypto.jwcrypto.log.level";
 XPCOMUtils.defineLazyGetter(this, "log", function() {
   const log = Log.repository.getLogger("Services.Crypto.jwcrypto");
   // Default log level is "Error", but consumers can change this with the pref
   // "services.crypto.jwcrypto.log.level".
   log.level = Log.Level.Error;
   const appender = new Log.DumpAppender();
   log.addAppender(appender);
   try {
     const level =
-      Services.prefs.getPrefType(PREF_LOG_LEVEL) == Ci.nsIPrefBranch.PREF_STRING
-      && Services.prefs.getCharPref(PREF_LOG_LEVEL);
+      Services.prefs.getPrefType(PREF_LOG_LEVEL) ==
+        Ci.nsIPrefBranch.PREF_STRING &&
+      Services.prefs.getCharPref(PREF_LOG_LEVEL);
     log.level = Log.Level[level] || Log.Level.Error;
   } catch (e) {
     log.error(e);
   }
 
   return log;
 });
 
@@ -67,48 +71,65 @@ class JWCrypto {
    *
    * [1] https://tools.ietf.org/html/rfc7518#section-5.3
    * [2] https://tools.ietf.org/html/rfc7518#section-4.6
    *
    * @returns {Promise<String>}
    */
   async generateJWE(key, data) {
     // Generate an ephemeral key to use just for this encryption.
-    const epk = await crypto.subtle.generateKey(ECDH_PARAMS, true, ["deriveKey"]);
-    const peerPublicKey = await crypto.subtle.importKey("jwk", key, ECDH_PARAMS, false, ["deriveKey"]);
+    const epk = await crypto.subtle.generateKey(ECDH_PARAMS, true, [
+      "deriveKey",
+    ]);
+    const peerPublicKey = await crypto.subtle.importKey(
+      "jwk",
+      key,
+      ECDH_PARAMS,
+      false,
+      ["deriveKey"]
+    );
     return this._generateJWE(epk, peerPublicKey, data);
   }
 
   async _generateJWE(epk, peerPublicKey, data) {
     let iv = crypto.getRandomValues(new Uint8Array(AES_GCM_IV_SIZE));
     const ownPublicJWK = await crypto.subtle.exportKey("jwk", epk.publicKey);
     delete ownPublicJWK.key_ops;
     // Do ECDH agreement to get the content encryption key.
-    const contentKey = await deriveECDHSharedAESKey(epk.privateKey, peerPublicKey, ["encrypt"]);
-    let header = {alg: "ECDH-ES", enc: "A256GCM", epk: ownPublicJWK};
+    const contentKey = await deriveECDHSharedAESKey(
+      epk.privateKey,
+      peerPublicKey,
+      ["encrypt"]
+    );
+    let header = { alg: "ECDH-ES", enc: "A256GCM", epk: ownPublicJWK };
     // Yes, additionalData is the byte representation of the base64 representation of the stringified header.
-    const additionalData = UTF8_ENCODER.encode(ChromeUtils.base64URLEncode(UTF8_ENCODER.encode(JSON.stringify(header)), {pad: false}));
-    const encrypted = await crypto.subtle.encrypt({
+    const additionalData = UTF8_ENCODER.encode(
+      ChromeUtils.base64URLEncode(UTF8_ENCODER.encode(JSON.stringify(header)), {
+        pad: false,
+      })
+    );
+    const encrypted = await crypto.subtle.encrypt(
+      {
         name: "AES-GCM",
         iv,
         additionalData,
         tagLength: AES_TAG_LEN,
       },
       contentKey,
-      data,
+      data
     );
     const tagIdx = encrypted.byteLength - ((AES_TAG_LEN + 7) >> 3);
     let ciphertext = encrypted.slice(0, tagIdx);
     let tag = encrypted.slice(tagIdx);
     // JWE serialization.
     header = UTF8_ENCODER.encode(JSON.stringify(header));
-    header = ChromeUtils.base64URLEncode(header, {pad: false});
-    tag = ChromeUtils.base64URLEncode(tag, {pad: false});
-    ciphertext = ChromeUtils.base64URLEncode(ciphertext, {pad: false});
-    iv = ChromeUtils.base64URLEncode(iv, {pad: false});
+    header = ChromeUtils.base64URLEncode(header, { pad: false });
+    tag = ChromeUtils.base64URLEncode(tag, { pad: false });
+    ciphertext = ChromeUtils.base64URLEncode(ciphertext, { pad: false });
+    iv = ChromeUtils.base64URLEncode(iv, { pad: false });
     return `${header}..${iv}.${ciphertext}.${tag}`; // No CEK
   }
 
   /**
    * Decrypts the given JWE using AES-256-GCM content encryption into a byte array.
    * This function does the opposite of `JWCrypto.generateJWE`.
    * The only supported content encryption algorithm is enc="A256GCM" [1]
    * and the only supported key encryption algorithm is alg="ECDH-ES" [2].
@@ -119,32 +140,53 @@ class JWCrypto {
    * [1] https://tools.ietf.org/html/rfc7518#section-5.3
    * [2] https://tools.ietf.org/html/rfc7518#section-4.6
    *
    * @returns {Promise<Uint8Array>}
    */
   async decryptJWE(jwe, key) {
     let [header, cek, iv, ciphertext, authTag] = jwe.split(".");
     const additionalData = UTF8_ENCODER.encode(header);
-    header = JSON.parse(UTF8_DECODER.decode(ChromeUtils.base64URLDecode(header, {padding: "reject"})));
-    if (cek.length > 0 || header.enc !== "A256GCM" || header.alg !== "ECDH-ES") {
+    header = JSON.parse(
+      UTF8_DECODER.decode(
+        ChromeUtils.base64URLDecode(header, { padding: "reject" })
+      )
+    );
+    if (
+      cek.length > 0 ||
+      header.enc !== "A256GCM" ||
+      header.alg !== "ECDH-ES"
+    ) {
       throw new Error("Unknown algorithm.");
     }
     if ("apu" in header || "apv" in header) {
       throw new Error("apu and apv header values are not supported.");
     }
-    const peerPublicKey = await crypto.subtle.importKey("jwk", header.epk, ECDH_PARAMS, false, ["deriveKey"]);
+    const peerPublicKey = await crypto.subtle.importKey(
+      "jwk",
+      header.epk,
+      ECDH_PARAMS,
+      false,
+      ["deriveKey"]
+    );
     // Do ECDH agreement to get the content encryption key.
-    const contentKey = await deriveECDHSharedAESKey(key, peerPublicKey, ["decrypt"]);
-    iv = ChromeUtils.base64URLDecode(iv, {padding: "reject"});
-    ciphertext = new Uint8Array(ChromeUtils.base64URLDecode(ciphertext, {padding: "reject"}));
-    authTag = new Uint8Array(ChromeUtils.base64URLDecode(authTag, {padding: "reject"}));
+    const contentKey = await deriveECDHSharedAESKey(key, peerPublicKey, [
+      "decrypt",
+    ]);
+    iv = ChromeUtils.base64URLDecode(iv, { padding: "reject" });
+    ciphertext = new Uint8Array(
+      ChromeUtils.base64URLDecode(ciphertext, { padding: "reject" })
+    );
+    authTag = new Uint8Array(
+      ChromeUtils.base64URLDecode(authTag, { padding: "reject" })
+    );
     const bundle = new Uint8Array([...ciphertext, ...authTag]);
 
-    const decrypted = await crypto.subtle.decrypt({
+    const decrypted = await crypto.subtle.decrypt(
+      {
         name: "AES-GCM",
         iv,
         tagLength: AES_TAG_LEN,
         additionalData,
       },
       contentKey,
       bundle
     );
@@ -158,36 +200,36 @@ class JWCrypto {
     IdentityCryptoService.generateKeyPair(aAlgorithmName, (rv, aKeyPair) => {
       if (!Components.isSuccessCode(rv)) {
         return aCallback("key generation failed");
       }
 
       let publicKey;
 
       switch (aKeyPair.keyType) {
-       case "RS256":
-        publicKey = {
-          algorithm: "RS",
-          exponent:  aKeyPair.hexRSAPublicKeyExponent,
-          modulus:   aKeyPair.hexRSAPublicKeyModulus,
-        };
-        break;
+        case "RS256":
+          publicKey = {
+            algorithm: "RS",
+            exponent: aKeyPair.hexRSAPublicKeyExponent,
+            modulus: aKeyPair.hexRSAPublicKeyModulus,
+          };
+          break;
 
-       case "DS160":
-        publicKey = {
-          algorithm: "DS",
-          y: aKeyPair.hexDSAPublicValue,
-          p: aKeyPair.hexDSAPrime,
-          q: aKeyPair.hexDSASubPrime,
-          g: aKeyPair.hexDSAGenerator,
-        };
-        break;
+        case "DS160":
+          publicKey = {
+            algorithm: "DS",
+            y: aKeyPair.hexDSAPublicValue,
+            p: aKeyPair.hexDSAPrime,
+            q: aKeyPair.hexDSASubPrime,
+            g: aKeyPair.hexDSAGenerator,
+          };
+          break;
 
-      default:
-        return aCallback("unknown key type");
+        default:
+          return aCallback("unknown key type");
       }
 
       const keyWrapper = {
         serializedPublicKey: JSON.stringify(publicKey),
         _kp: aKeyPair,
       };
 
       return aCallback(null, keyWrapper);
@@ -221,36 +263,45 @@ class JWCrypto {
    *
    * @param aCallback
    *        Function to invoke with resulting assertion.  Assertion
    *        will be string or null on failure.
    */
   generateAssertion(aCert, aKeyPair, aAudience, aOptions, aCallback) {
     if (typeof aOptions == "function") {
       aCallback = aOptions;
-      aOptions = { };
+      aOptions = {};
     }
 
     // for now, we hack the algorithm name
     // XXX bug 769851
-    const header = {"alg": "DS128"};
+    const header = { alg: "DS128" };
     const headerBytes = IdentityCryptoService.base64UrlEncode(
-                          JSON.stringify(header));
+      JSON.stringify(header)
+    );
 
-
-    function getExpiration(duration = ASSERTION_DEFAULT_DURATION_MS, localtimeOffsetMsec = 0, now = Date.now()) {
+    function getExpiration(
+      duration = ASSERTION_DEFAULT_DURATION_MS,
+      localtimeOffsetMsec = 0,
+      now = Date.now()
+    ) {
       return now + localtimeOffsetMsec + duration;
     }
 
     const payload = {
-      exp: getExpiration(aOptions.duration, aOptions.localtimeOffsetMsec, aOptions.now),
+      exp: getExpiration(
+        aOptions.duration,
+        aOptions.localtimeOffsetMsec,
+        aOptions.now
+      ),
       aud: aAudience,
     };
     const payloadBytes = IdentityCryptoService.base64UrlEncode(
-                          JSON.stringify(payload));
+      JSON.stringify(payload)
+    );
 
     log.debug("payload", { payload, payloadBytes });
     const message = headerBytes + "." + payloadBytes;
     aKeyPair._kp.sign(message, (rv, signature) => {
       if (!Components.isSuccessCode(rv)) {
         log.error("signer.sign failed");
         aCallback("Sign failed");
         return;
@@ -269,30 +320,50 @@ class JWCrypto {
  * The raw ECDH secret is derived into a key using
  * Concat KDF, as defined in Section 5.8.1 of [NIST.800-56A].
  * @param {CryptoKey} privateKey
  * @param {CryptoKey} publicKey
  * @param {String[]} keyUsages See `SubtleCrypto.deriveKey` 5th paramater documentation.
  * @returns {Promise<CryptoKey>}
  */
 async function deriveECDHSharedAESKey(privateKey, publicKey, keyUsages) {
-  const params = {...ECDH_PARAMS, ...{public: publicKey}};
-  const sharedKey = await crypto.subtle.deriveKey(params, privateKey, AES_PARAMS, true, keyUsages);
+  const params = { ...ECDH_PARAMS, ...{ public: publicKey } };
+  const sharedKey = await crypto.subtle.deriveKey(
+    params,
+    privateKey,
+    AES_PARAMS,
+    true,
+    keyUsages
+  );
   // This is the NIST Concat KDF specialized to a specific set of parameters,
   // which basically turn it into a single application of SHA256.
   // The details are from the JWA RFC.
   let sharedKeyBytes = await crypto.subtle.exportKey("raw", sharedKey);
   sharedKeyBytes = new Uint8Array(sharedKeyBytes);
   const info = [
     "\x00\x00\x00\x07A256GCM", // 7-byte algorithm identifier
-    "\x00\x00\x00\x00",  // empty PartyUInfo
-    "\x00\x00\x00\x00",  // empty PartyVInfo
-    "\x00\x00\x01\x00",  // keylen == 256
+    "\x00\x00\x00\x00", // empty PartyUInfo
+    "\x00\x00\x00\x00", // empty PartyVInfo
+    "\x00\x00\x01\x00", // keylen == 256
   ].join("");
-  const pkcs = `\x00\x00\x00\x01${String.fromCharCode.apply(null, sharedKeyBytes)}${info}`;
-  const pkcsBuf = Uint8Array.from(Array.prototype.map.call(pkcs, (c) => c.charCodeAt(0)));
-  const derivedKeyBytes = await crypto.subtle.digest({
-    name: "SHA-256",
-  }, pkcsBuf);
-  return crypto.subtle.importKey("raw", derivedKeyBytes, AES_PARAMS, false, keyUsages);
+  const pkcs = `\x00\x00\x00\x01${String.fromCharCode.apply(
+    null,
+    sharedKeyBytes
+  )}${info}`;
+  const pkcsBuf = Uint8Array.from(
+    Array.prototype.map.call(pkcs, c => c.charCodeAt(0))
+  );
+  const derivedKeyBytes = await crypto.subtle.digest(
+    {
+      name: "SHA-256",
+    },
+    pkcsBuf
+  );
+  return crypto.subtle.importKey(
+    "raw",
+    derivedKeyBytes,
+    AES_PARAMS,
+    false,
+    keyUsages
+  );
 }
 
 const jwcrypto = new JWCrypto();
--- a/services/crypto/modules/utils.js
+++ b/services/crypto/modules/utils.js
@@ -1,34 +1,42 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["CryptoUtils"];
 
-const {Observers} = ChromeUtils.import("resource://services-common/observers.js");
-const {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const { Observers } = ChromeUtils.import(
+  "resource://services-common/observers.js"
+);
+const { CommonUtils } = ChromeUtils.import(
+  "resource://services-common/utils.js"
+);
+const { XPCOMUtils } = ChromeUtils.import(
+  "resource://gre/modules/XPCOMUtils.jsm"
+);
 XPCOMUtils.defineLazyGlobalGetters(this, ["crypto"]);
 
-XPCOMUtils.defineLazyGetter(this, "textEncoder",
-  function() { return new TextEncoder(); }
-);
+XPCOMUtils.defineLazyGetter(this, "textEncoder", function() {
+  return new TextEncoder();
+});
 
 /**
  * A number of `Legacy` suffixed functions are exposed by CryptoUtils.
  * They work with octet strings, which were used before Javascript
  * got ArrayBuffer and friends.
  */
 var CryptoUtils = {
   xor(a, b) {
     let bytes = [];
 
     if (a.length != b.length) {
-      throw new Error("can't xor unequal length strings: " + a.length + " vs " + b.length);
+      throw new Error(
+        "can't xor unequal length strings: " + a.length + " vs " + b.length
+      );
     }
 
     for (let i = 0; i < a.length; i++) {
       bytes[i] = a.charCodeAt(i) ^ b.charCodeAt(i);
     }
 
     return String.fromCharCode.apply(String, bytes);
   },
@@ -88,44 +96,47 @@ var CryptoUtils = {
    * yourself.
    */
   updateUTF8(message, hasher) {
     let bytes = this._utf8Converter.convertToByteArray(message, {});
     hasher.update(bytes, bytes.length);
   },
 
   sha256(message) {
-    let hasher = Cc["@mozilla.org/security/hash;1"]
-                 .createInstance(Ci.nsICryptoHash);
+    let hasher = Cc["@mozilla.org/security/hash;1"].createInstance(
+      Ci.nsICryptoHash
+    );
     hasher.init(hasher.SHA256);
     return CommonUtils.bytesAsHex(CryptoUtils.digestUTF8(message, hasher));
   },
 
   sha256Base64(message) {
     let data = this._utf8Converter.convertToByteArray(message, {});
-    let hasher = Cc["@mozilla.org/security/hash;1"]
-                 .createInstance(Ci.nsICryptoHash);
+    let hasher = Cc["@mozilla.org/security/hash;1"].createInstance(
+      Ci.nsICryptoHash
+    );
     hasher.init(hasher.SHA256);
     hasher.update(data, data.length);
     return hasher.finish(true);
   },
 
   /**
    * Produce an HMAC key object from a key string.
    */
   makeHMACKey: function makeHMACKey(str) {
     return Svc.KeyFactory.keyFromString(Ci.nsIKeyObject.HMAC, str);
   },
 
   /**
    * Produce an HMAC hasher and initialize it with the given HMAC key.
    */
   makeHMACHasher: function makeHMACHasher(type, key) {
-    let hasher = Cc["@mozilla.org/security/hmac;1"]
-                   .createInstance(Ci.nsICryptoHMAC);
+    let hasher = Cc["@mozilla.org/security/hmac;1"].createInstance(
+      Ci.nsICryptoHMAC
+    );
     hasher.init(type, key);
     return hasher;
   },
 
   /**
    * @param {string} alg Hash algorithm (common values are SHA-1 or SHA-256)
    * @param {string} key Key as an octet string.
    * @param {string} data Data as an octet string.
@@ -157,57 +168,83 @@ var CryptoUtils = {
   /**
    * @param {String} alg Hash algorithm (common values are SHA-1 or SHA-256)
    * @param {ArrayBuffer} key
    * @param {ArrayBuffer} data
    * @param {Number} len Desired output length in bytes.
    * @returns {Uint8Array}
    */
   async hmac(alg, key, data) {
-    const hmacKey = await crypto.subtle.importKey("raw", key, {name: "HMAC", hash: alg}, false, ["sign"]);
+    const hmacKey = await crypto.subtle.importKey(
+      "raw",
+      key,
+      { name: "HMAC", hash: alg },
+      false,
+      ["sign"]
+    );
     const result = await crypto.subtle.sign("HMAC", hmacKey, data);
     return new Uint8Array(result);
   },
 
   /**
    * @param {ArrayBuffer} ikm
    * @param {ArrayBuffer} salt
    * @param {ArrayBuffer} info
    * @param {Number} len Desired output length in bytes.
    * @returns {Uint8Array}
    */
   async hkdf(ikm, salt, info, len) {
-    const key = await crypto.subtle.importKey("raw", ikm, {name: "HKDF"}, false, ["deriveBits"]);
-    const okm = await crypto.subtle.deriveBits({
+    const key = await crypto.subtle.importKey(
+      "raw",
+      ikm,
+      { name: "HKDF" },
+      false,
+      ["deriveBits"]
+    );
+    const okm = await crypto.subtle.deriveBits(
+      {
         name: "HKDF",
         hash: "SHA-256",
         salt,
         info,
-    }, key, len * 8);
+      },
+      key,
+      len * 8
+    );
     return new Uint8Array(okm);
   },
 
   /**
    * PBKDF2 password stretching with SHA-256 hmac.
    *
    * @param {string} passphrase Passphrase as an octet string.
    * @param {string} salt Salt as an octet string.
    * @param {string} iterations Number of iterations, a positive integer.
    * @param {string} len Desired output length in bytes.
    */
   async pbkdf2Generate(passphrase, salt, iterations, len) {
     passphrase = CommonUtils.byteStringToArrayBuffer(passphrase);
     salt = CommonUtils.byteStringToArrayBuffer(salt);
-    const key = await crypto.subtle.importKey("raw", passphrase, {name: "PBKDF2"}, false, ["deriveBits"]);
-    const output = await crypto.subtle.deriveBits({
+    const key = await crypto.subtle.importKey(
+      "raw",
+      passphrase,
+      { name: "PBKDF2" },
+      false,
+      ["deriveBits"]
+    );
+    const output = await crypto.subtle.deriveBits(
+      {
         name: "PBKDF2",
         hash: "SHA-256",
         salt,
         iterations,
-    }, key, len * 8);
+      },
+      key,
+      len * 8
+    );
     return CommonUtils.arrayBufferToByteString(new Uint8Array(output));
   },
 
   /**
    * Compute the HTTP MAC SHA-1 for an HTTP request.
    *
    * @param  identifier
    *         (string) MAC Key Identifier.
@@ -239,108 +276,138 @@ var CryptoUtils = {
    *           port - (string) HTTP port number used (derived from arguments).
    *           mac - (string) Raw HMAC digest bytes.
    *           getHeader - (function) Call to obtain the string Authorization
    *             header value for this invocation.
    *           nonce - (string) Nonce value used.
    *           ts - (number) Integer seconds since Unix epoch that was used.
    */
   async computeHTTPMACSHA1(identifier, key, method, uri, extra) {
-    let ts = (extra && extra.ts) ? extra.ts : Math.floor(Date.now() / 1000);
-    let nonce_bytes = (extra && extra.nonce_bytes > 0) ? extra.nonce_bytes : 8;
+    let ts = extra && extra.ts ? extra.ts : Math.floor(Date.now() / 1000);
+    let nonce_bytes = extra && extra.nonce_bytes > 0 ? extra.nonce_bytes : 8;
 
     // We are allowed to use more than the Base64 alphabet if we want.
-    let nonce = (extra && extra.nonce)
-                ? extra.nonce
-                : btoa(CryptoUtils.generateRandomBytesLegacy(nonce_bytes));
+    let nonce =
+      extra && extra.nonce
+        ? extra.nonce
+        : btoa(CryptoUtils.generateRandomBytesLegacy(nonce_bytes));
 
     let host = uri.asciiHost;
     let port;
     let usedMethod = method.toUpperCase();
 
     if (uri.port != -1) {
       port = uri.port;
     } else if (uri.scheme == "http") {
       port = "80";
     } else if (uri.scheme == "https") {
       port = "443";
     } else {
       throw new Error("Unsupported URI scheme: " + uri.scheme);
     }
 
-    let ext = (extra && extra.ext) ? extra.ext : "";
+    let ext = extra && extra.ext ? extra.ext : "";
 
-    let requestString = ts.toString(10) + "\n" +
-                        nonce + "\n" +
-                        usedMethod + "\n" +
-                        uri.pathQueryRef + "\n" +
-                        host + "\n" +
-                        port + "\n" +
-                        ext + "\n";
+    let requestString =
+      ts.toString(10) +
+      "\n" +
+      nonce +
+      "\n" +
+      usedMethod +
+      "\n" +
+      uri.pathQueryRef +
+      "\n" +
+      host +
+      "\n" +
+      port +
+      "\n" +
+      ext +
+      "\n";
 
     const mac = await CryptoUtils.hmacLegacy("SHA-1", key, requestString);
 
     function getHeader() {
-      return CryptoUtils.getHTTPMACSHA1Header(this.identifier, this.ts,
-                                              this.nonce, this.mac, this.ext);
+      return CryptoUtils.getHTTPMACSHA1Header(
+        this.identifier,
+        this.ts,
+        this.nonce,
+        this.mac,
+        this.ext
+      );
     }
 
     return {
       identifier,
       key,
-      method:     usedMethod,
-      hostname:   host,
+      method: usedMethod,
+      hostname: host,
       port,
       mac,
       nonce,
       ts,
       ext,
       getHeader,
     };
   },
 
-
   /**
    * Obtain the HTTP MAC Authorization header value from fields.
    *
    * @param  identifier
    *         (string) MAC key identifier.
    * @param  ts
    *         (number) Integer seconds since Unix epoch.
    * @param  nonce
    *         (string) Nonce value.
    * @param  mac
    *         (string) Computed HMAC digest (raw bytes).
    * @param  ext
    *         (optional) (string) Extra string content.
    * @returns
    *         (string) Value to put in Authorization header.
    */
-  getHTTPMACSHA1Header: function getHTTPMACSHA1Header(identifier, ts, nonce,
-                                                      mac, ext) {
-    let header = 'MAC id="' + identifier + '", ' +
-                'ts="' + ts + '", ' +
-                'nonce="' + nonce + '", ' +
-                'mac="' + btoa(mac) + '"';
+  getHTTPMACSHA1Header: function getHTTPMACSHA1Header(
+    identifier,
+    ts,
+    nonce,
+    mac,
+    ext
+  ) {
+    let header =
+      'MAC id="' +
+      identifier +
+      '", ' +
+      'ts="' +
+      ts +
+      '", ' +
+      'nonce="' +
+      nonce +
+      '", ' +
+      'mac="' +
+      btoa(mac) +
+      '"';
 
     if (!ext) {
       return header;
     }
 
-    return header += ', ext="' + ext + '"';
+    return (header += ', ext="' + ext + '"');
   },
 
   /**
    * Given an HTTP header value, strip out any attributes.
    */
 
   stripHeaderAttributes(value) {
     value = value || "";
     let i = value.indexOf(";");
-    return value.substring(0, (i >= 0) ? i : undefined).trim().toLowerCase();
+    return value
+      .substring(0, i >= 0 ? i : undefined)
+      .trim()