Bug 1367235 - Enable eslint on testing/xpcshell - mechanical updates; r=Standard8
authorGeoff Brown <gbrown@mozilla.com>
Thu, 25 May 2017 07:32:42 -0600
changeset 360672 5cd8e5586752152702761ecd5d989f180e3e2bed
parent 360671 e8d2fe983c62ff24968247a37bde80746f3d5f70
child 360673 0d7a8241dfb085cd94c8911eeffbbad8be514a00
push id31891
push userryanvm@gmail.com
push dateThu, 25 May 2017 20:34:24 +0000
treeherdermozilla-central@55e5723b1e62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1367235
milestone55.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 1367235 - Enable eslint on testing/xpcshell - mechanical updates; r=Standard8
.eslintignore
testing/xpcshell/dbg-actors.js
testing/xpcshell/example/unit/.eslintrc.js
testing/xpcshell/example/unit/check_profile.js
testing/xpcshell/example/unit/test_check_nsIException.js
testing/xpcshell/example/unit/test_check_nsIException_failing.js
testing/xpcshell/example/unit/test_do_check_matches.js
testing/xpcshell/example/unit/test_do_check_matches_failing.js
testing/xpcshell/example/unit/test_import_module.js
testing/xpcshell/example/unit/test_load.js
testing/xpcshell/example/unit/test_profile.js
testing/xpcshell/example/unit/test_profile_afterChange.js
testing/xpcshell/example/unit/test_sample.js
testing/xpcshell/head.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -32,17 +32,16 @@ netwerk/**
 nsprpub/**
 other-licenses/**
 parser/**
 probes/**
 python/**
 rdf/**
 servo/**
 startupcache/**
-testing/**
 tools/update-packaging/**
 uriloader/**
 view/**
 widget/**
 xpcom/**
 xpfe/**
 xulrunner/**
 
@@ -290,16 +289,29 @@ security/manager/ssl/security-prefs.js
 security/nss/**
 
 # services/ exclusions
 
 # Uses `#filter substitution`
 services/sync/modules/constants.js
 services/sync/services-sync.js
 
+# testing/ exclusions
+testing/firefox-ui/**
+testing/marionette/**
+testing/mochitest/**
+testing/modules/**
+testing/mozbase/**
+testing/profiles/**
+testing/specialpowers/**
+testing/talos/**
+testing/web-platform/**
+testing/xpcshell/moz-http2/**
+testing/xpcshell/node-http2/**
+
 # Third party services
 services/common/kinto-http-client.js
 services/common/kinto-offline-client.js
 services/sync/tps/extensions/mozmill
 
 # toolkit/ exclusions
 
 # Not part of the default build
--- a/testing/xpcshell/dbg-actors.js
+++ b/testing/xpcshell/dbg-actors.js
@@ -1,49 +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';
+"use strict";
 
 const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
 var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { RootActor } = devtools.require("devtools/server/actors/root");
 const { BrowserTabList } = devtools.require("devtools/server/actors/webbrowser");
 
 /**
  * xpcshell-test (XPCST) specific actors.
  *
  */
 
 /**
  * Construct a root actor appropriate for use in a server running xpcshell
  * tests. <snip boilerplate> :)
  */
-function createRootActor(connection)
-{
+function createRootActor(connection) {
   let parameters = {
     tabList: new XPCSTTabList(connection),
     globalActorFactories: DebuggerServer.globalActorFactories,
     onShutdown() {
       // If the user never switches to the "debugger" tab we might get a
       // shutdown before we've attached.
       Services.obs.notifyObservers(null, "xpcshell-test-devtools-shutdown");
     }
   };
   return new RootActor(connection, parameters);
 }
 
 /**
  * A "stub" TabList implementation that provides no tabs.
  */
 
-function XPCSTTabList(connection)
-{
+function XPCSTTabList(connection) {
   BrowserTabList.call(this, connection);
 }
 
 XPCSTTabList.prototype = Object.create(BrowserTabList.prototype);
 
 XPCSTTabList.prototype.constructor = XPCSTTabList;
 
 XPCSTTabList.prototype.getList = function() {
new file mode 100644
--- /dev/null
+++ b/testing/xpcshell/example/unit/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/xpcshell-test"
+  ]
+};
--- a/testing/xpcshell/example/unit/check_profile.js
+++ b/testing/xpcshell/example/unit/check_profile.js
@@ -1,38 +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/. */
 
 var {classes: Cc, interfaces: Ci} = Components;
 
-function check_profile_dir(profd)
-{
+function check_profile_dir(profd) {
   Assert.ok(profd.exists());
   Assert.ok(profd.isDirectory());
   let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
                  .getService(Ci.nsIProperties);
   let profd2 = dirSvc.get("ProfD", Ci.nsILocalFile);
   Assert.ok(profd2.exists());
   Assert.ok(profd2.isDirectory());
   // make sure we got the same thing back...
   Assert.ok(profd.equals(profd2));
 }
 
-function check_do_get_profile(fireProfileAfterChange)
-{
+function check_do_get_profile(fireProfileAfterChange) {
   const observedTopics = new Map([
     ["profile-do-change", 0],
     ["profile-after-change", 0],
   ]);
   const expectedTopics = new Map(observedTopics);
 
   const obs = Cc["@mozilla.org/observer-service;1"]
                    .getService(Ci.nsIObserverService);
-  for (let [topic,] of observedTopics) {
+  for (let [topic, ] of observedTopics) {
     obs.addObserver(() => {
       let val = observedTopics.get(topic) + 1;
       observedTopics.set(topic, val);
     }, topic);
   }
 
   // Trigger profile creation.
   let profd = do_get_profile();
--- a/testing/xpcshell/example/unit/test_check_nsIException.js
+++ b/testing/xpcshell/example/unit/test_check_nsIException.js
@@ -1,11 +1,11 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   let env = Components.classes["@mozilla.org/process/environment;1"]
                       .getService(Components.interfaces.nsIEnvironment);
-  do_check_throws_nsIException(function () {
+  do_check_throws_nsIException(function() {
     env.QueryInterface(Components.interfaces.nsIFile);
   }, "NS_NOINTERFACE");
 }
 
--- a/testing/xpcshell/example/unit/test_check_nsIException_failing.js
+++ b/testing/xpcshell/example/unit/test_check_nsIException_failing.js
@@ -1,9 +1,9 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
-  do_check_throws_nsIException(function () {
+  do_check_throws_nsIException(function() {
     throw Error("I find your relaxed dishabille unpalatable");
   }, "NS_NOINTERFACE");
 }
 
--- a/testing/xpcshell/example/unit/test_do_check_matches.js
+++ b/testing/xpcshell/example/unit/test_do_check_matches.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
-  do_check_matches({x:1}, {x:1});
+  do_check_matches({x: 1}, {x: 1});
 
   // Property order is irrelevant.
-  do_check_matches({x:"foo", y:"bar"}, {y:"bar", x:"foo"});// pass
+  do_check_matches({x: "foo", y: "bar"}, {y: "bar", x: "foo"});// pass
 
   // Patterns nest.
-  do_check_matches({a:1, b:{c:2,d:3}}, {a:1, b:{c:2,d:3}});
+  do_check_matches({a: 1, b: {c: 2, d: 3}}, {a: 1, b: {c: 2, d: 3}});
 
-  do_check_matches([3,4,5], [3,4,5]);
+  do_check_matches([3, 4, 5], [3, 4, 5]);
 }
--- a/testing/xpcshell/example/unit/test_do_check_matches_failing.js
+++ b/testing/xpcshell/example/unit/test_do_check_matches_failing.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
-  do_check_matches({x:1}, {});         // fail: all pattern props required
-  do_check_matches({x:1}, {x:2});      // fail: values must match
-  do_check_matches({x:undefined}, {});
+  do_check_matches({x: 1}, {});         // fail: all pattern props required
+  do_check_matches({x: 1}, {x: 2});      // fail: values must match
+  do_check_matches({x: undefined}, {});
 
   // 'length' property counts, even if non-enumerable.
-  do_check_matches([3,4,5], [3,5,5]);  // fail; value doesn't match
-  do_check_matches([3,4,5], [3,4,5,6]);// fail; length doesn't match
+  do_check_matches([3, 4, 5], [3, 5, 5]);  // fail; value doesn't match
+  do_check_matches([3, 4, 5], [3, 4, 5, 6]);// fail; length doesn't match
 }
--- a/testing/xpcshell/example/unit/test_import_module.js
+++ b/testing/xpcshell/example/unit/test_import_module.js
@@ -5,18 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Ensures that tests can import a module in the same folder through:
  * Components.utils.import("resource://test/module.jsm");
  */
 
 function run_test() {
-  do_check_true(typeof(this['MODULE_IMPORTED']) == "undefined");
-  do_check_true(typeof(this['MODULE_URI']) == "undefined");
+  do_check_true(typeof(this["MODULE_IMPORTED"]) == "undefined");
+  do_check_true(typeof(this["MODULE_URI"]) == "undefined");
   let uri = "resource://test/import_module.jsm";
   Components.utils.import(uri);
   do_check_true(MODULE_URI == uri);
   do_check_true(MODULE_IMPORTED);
   do_check_true(SUBMODULE_IMPORTED);
   do_check_true(same_scope);
   do_check_true(SUBMODULE_IMPORTED_TO_SCOPE);
 }
--- a/testing/xpcshell/example/unit/test_load.js
+++ b/testing/xpcshell/example/unit/test_load.js
@@ -8,14 +8,13 @@ var subscriptLoaded = false;
 
 function run_test() {
   load("load_subscript.js");
   do_check_true(subscriptLoaded);
   subscriptLoaded = false;
   try {
     load("file_that_does_not_exist.js");
     subscriptLoaded = true;
-  }
-  catch (ex) {
-    do_check_eq(ex.message.substring(0,16), "cannot open file");
+  } catch (ex) {
+    do_check_eq(ex.message.substring(0, 16), "cannot open file");
   }
   do_check_false(subscriptLoaded, "load() should throw an error");
 }
--- a/testing/xpcshell/example/unit/test_profile.js
+++ b/testing/xpcshell/example/unit/test_profile.js
@@ -1,11 +1,10 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-function run_test()
-{
+function run_test() {
   load("check_profile.js");
   check_do_get_profile(false);
 }
--- a/testing/xpcshell/example/unit/test_profile_afterChange.js
+++ b/testing/xpcshell/example/unit/test_profile_afterChange.js
@@ -1,11 +1,10 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-function run_test()
-{
+function run_test() {
   load("check_profile.js");
   check_do_get_profile(true);
 }
--- a/testing/xpcshell/example/unit/test_sample.js
+++ b/testing/xpcshell/example/unit/test_sample.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* 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/. */
 
-/* This is the most basic testcase.  It makes some trivial assertions, 
- * then sets a timeout, and exits the test harness when that timeout 
- * fires. This is meant to demonstrate that there is a complete event 
+/* This is the most basic testcase.  It makes some trivial assertions,
+ * then sets a timeout, and exits the test harness when that timeout
+ * fires. This is meant to demonstrate that there is a complete event
  * system available to test scripts.
  * Available functions are described at:
  * http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
  */
 function run_test() {
   do_check_eq(57, 57)
   do_check_neq(1, 2)
   do_check_true(true);
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -33,23 +33,23 @@ var Assert = new AssertCls(function(err,
   if (err) {
     do_report_result(false, err.message, err.stack);
   } else {
     do_report_result(true, message, stack);
   }
 });
 
 
-var _add_params = function (params) {
+var _add_params = function(params) {
   if (typeof _XPCSHELL_PROCESS != "undefined") {
     params.xpcshell_process = _XPCSHELL_PROCESS;
   }
 };
 
-var _dumpLog = function (raw_msg) {
+var _dumpLog = function(raw_msg) {
   dump("\n" + JSON.stringify(raw_msg) + "\n");
 }
 
 var _LoggerClass = Components.utils.import("resource://testing-common/StructuredLog.jsm", null).StructuredLogger;
 var _testLogger = new _LoggerClass("xpcshell/head.js", _dumpLog, [_add_params]);
 
 // Disable automatic network detection, so tests work correctly when
 // not connected to a network.
@@ -61,18 +61,17 @@ var _testLogger = new _LoggerClass("xpcs
 }
 
 // Determine if we're running on parent or child
 var runningInParent = true;
 try {
   runningInParent = Components.classes["@mozilla.org/xre/runtime;1"].
                     getService(Components.interfaces.nsIXULRuntime).processType
                     == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
-}
-catch (e) { }
+} catch (e) { }
 
 // Only if building of places is enabled.
 if (runningInParent &&
     "mozIAsyncHistory" in Components.interfaces) {
   // Ensure places history is enabled for xpcshell-tests as some non-FF
   // apps disable it.
   let prefs = Components.classes["@mozilla.org/preferences-service;1"]
               .getService(Components.interfaces.nsIPrefBranch);
@@ -88,53 +87,51 @@ try {
     // docshells needed to pass them
     prefs.setBoolPref("network.disable.ipc.security", true);
 
     // Disable IPv6 lookups for 'localhost' on windows.
     if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
       prefs.setCharPref("network.dns.ipv4OnlyDomains", "localhost");
     }
   }
-}
-catch (e) { }
+} catch (e) { }
 
 // Configure crash reporting, if possible
 // We rely on the Python harness to set MOZ_CRASHREPORTER,
 // MOZ_CRASHREPORTER_NO_REPORT, and handle checking for minidumps.
 // Note that if we're in a child process, we don't want to init the
 // crashreporter component.
 try {
   if (runningInParent &&
       "@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
     let crashReporter =
           Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
           .getService(Components.interfaces.nsICrashReporter);
     crashReporter.UpdateCrashEventsDir();
     crashReporter.minidumpPath = do_get_minidumpdir();
   }
-}
-catch (e) { }
+} catch (e) { }
 
 // Configure a console listener so messages sent to it are logged as part
 // of the test.
 try {
   let levelNames = {}
   for (let level of ["debug", "info", "warn", "error"]) {
     levelNames[Components.interfaces.nsIConsoleMessage[level]] = level;
   }
 
   let listener = {
-    QueryInterface : function(iid) {
+    QueryInterface: function(iid) {
       if (!iid.equals(Components.interfaces.nsISupports) &&
           !iid.equals(Components.interfaces.nsIConsoleListener)) {
         throw Components.results.NS_NOINTERFACE;
       }
       return this;
     },
-    observe : function (msg) {
+    observe: function(msg) {
       if (typeof do_print === "function")
         do_print("CONSOLE_MESSAGE: (" + levelNames[msg.logLevel] + ") " + msg.toString());
     }
   };
   Components.classes["@mozilla.org/consoleservice;1"]
             .getService(Components.interfaces.nsIConsoleService)
             .registerListener(listener);
 } catch (e) {}
@@ -235,71 +232,68 @@ var _fakeIdleService = {
     return this.registrar =
       Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
   },
   contractID: "@mozilla.org/widget/idleservice;1",
   get CID() {
     return this.registrar.contractIDToCID(this.contractID);
   },
 
-  activate: function FIS_activate()
-  {
+  activate: function FIS_activate() {
     if (!this.originalFactory) {
       // Save original factory.
       this.originalFactory =
         Components.manager.getClassObject(Components.classes[this.contractID],
                                           Components.interfaces.nsIFactory);
       // Unregister original factory.
       this.registrar.unregisterFactory(this.CID, this.originalFactory);
       // Replace with the mock.
       this.registrar.registerFactory(this.CID, "Fake Idle Service",
                                      this.contractID, this.factory
       );
     }
   },
 
-  deactivate: function FIS_deactivate()
-  {
+  deactivate: function FIS_deactivate() {
     if (this.originalFactory) {
       // Unregister the mock.
       this.registrar.unregisterFactory(this.CID, this.factory);
       // Restore original factory.
       this.registrar.registerFactory(this.CID, "Idle Service",
                                      this.contractID, this.originalFactory);
       delete this.originalFactory;
     }
   },
 
   factory: {
     // nsIFactory
-    createInstance: function (aOuter, aIID)
-    {
+    createInstance: function(aOuter, aIID) {
       if (aOuter) {
         throw Components.results.NS_ERROR_NO_AGGREGATION;
       }
       return _fakeIdleService.QueryInterface(aIID);
     },
-    lockFactory: function (aLock) {
+    lockFactory: function(aLock) {
       throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
     },
     QueryInterface: function(aIID) {
       if (aIID.equals(Components.interfaces.nsIFactory) ||
           aIID.equals(Components.interfaces.nsISupports)) {
         return this;
       }
       throw Components.results.NS_ERROR_NO_INTERFACE;
     }
   },
 
   // nsIIdleService
   get idleTime() {
     return 0;
   },
-  addIdleObserver: function () {},
-  removeIdleObserver: function () {},
+  addIdleObserver: function() {},
+  removeIdleObserver: function() {},
 
   QueryInterface: function(aIID) {
     // Useful for testing purposes, see test_get_idle.js.
     if (aIID.equals(Components.interfaces.nsIFactory)) {
       return this.factory;
     }
     if (aIID.equals(Components.interfaces.nsIIdleService) ||
         aIID.equals(Components.interfaces.nsISupports)) {
@@ -443,17 +437,17 @@ function _setupDebuggerServer(breakpoint
   for (let topic of TOPICS) {
     obsSvc.addObserver(observe, topic);
   }
   return DebuggerServer;
 }
 
 function _initDebugging(port) {
   let initialized = false;
-  let DebuggerServer = _setupDebuggerServer(_TEST_FILE, () => {initialized = true;});
+  let DebuggerServer = _setupDebuggerServer(_TEST_FILE, () => { initialized = true; });
 
   do_print("");
   do_print("*******************************************************************");
   do_print("Waiting for the debugger to connect on port " + port)
   do_print("")
   do_print("To connect the debugger, open a Firefox instance, select 'Connect'");
   do_print("from the Developer menu and specify the port as " + port);
   do_print("*******************************************************************");
@@ -500,34 +494,34 @@ function _execute_test() {
   // Override idle service by default.
   // Call do_get_idle() to restore the factory and get the service.
   _fakeIdleService.activate();
 
   _PromiseTestUtils.init();
   _PromiseTestUtils.Assert = Assert;
 
   let coverageCollector = null;
-  if (typeof _JSCOV_DIR === 'string') {
+  if (typeof _JSCOV_DIR === "string") {
     let _CoverageCollector = Components.utils.import("resource://testing-common/CoverageUtils.jsm", {}).CoverageCollector;
     coverageCollector = new _CoverageCollector(_JSCOV_DIR);
   }
 
   // _HEAD_FILES is dynamically defined by <runxpcshelltests.py>.
   _load_files(_HEAD_FILES);
   // _TEST_FILE is dynamically defined by <runxpcshelltests.py>.
   _load_files(_TEST_FILE);
 
   // Tack Assert.jsm methods to the current scope.
   this.Assert = Assert;
   for (let func in Assert) {
     this[func] = Assert[func].bind(Assert);
   }
 
   if (_gTestHasOnly) {
-    _gTests = _gTests.filter(([props,]) => {
+    _gTests = _gTests.filter(([props, ]) => {
       return ("_only" in props) && props._only;
     });
   }
 
   try {
     do_test_pending("MAIN run_test");
     // Check if run_test() is defined. If defined, run it.
     // Else, call run_next_test() directly to invoke tests
@@ -661,17 +655,17 @@ function _load_files(aFiles) {
 
   aFiles.forEach(load_file);
 }
 
 function _wrap_with_quotes_if_necessary(val) {
   return typeof val == "string" ? '"' + val + '"' : val;
 }
 
-/************** Functions to be used from the tests **************/
+/* ************* Functions to be used from the tests ************* */
 
 /**
  * Prints a message to the output log.
  */
 function do_print(msg, data) {
   msg = _wrap_with_quotes_if_necessary(msg);
   data = data ? data : null;
   _testLogger.info(msg, data);
@@ -706,24 +700,23 @@ function do_execute_soon(callback, aName
         // NS_ERROR_ABORT. If both of those are true it is likely this exception
         // has already been logged so there is no need to log it again. It's
         // possible that this will mask an NS_ERROR_ABORT that happens after a
         // do_check failure though.
         if (!_quit || e != Components.results.NS_ERROR_ABORT) {
           let stack = e.stack ? _format_stack(e.stack) : null;
           _testLogger.testStatus(_TEST_NAME,
                                  funcName,
-                                 'FAIL',
-                                 'PASS',
+                                 "FAIL",
+                                 "PASS",
                                  _exception_message(e),
                                  stack);
           _do_quit();
         }
-      }
-      finally {
+      } finally {
         do_test_finished(funcName);
       }
     }
   });
 }
 
 /**
  * Shows an error message and the current stack and aborts the test.
@@ -925,30 +918,29 @@ function todo_check_false(condition, sta
 
   todo_check_eq(condition, false, stack);
 }
 
 function do_check_null(condition, stack) {
   Assert.equal(condition, null);
 }
 
-function todo_check_null(condition, stack=Components.stack.caller) {
+function todo_check_null(condition, stack = Components.stack.caller) {
   todo_check_eq(condition, null, stack);
 }
 function do_check_matches(pattern, value) {
   Assert.deepEqual(pattern, value);
 }
 
 // Check that |func| throws an nsIException that has
 // |Components.results[resultName]| as the value of its 'result' property.
 function do_check_throws_nsIException(func, resultName,
-                                      stack=Components.stack.caller, todo=false)
-{
+                                      stack = Components.stack.caller, todo = false) {
   let expected = Components.results[resultName];
-  if (typeof expected !== 'number') {
+  if (typeof expected !== "number") {
     do_throw("do_check_throws_nsIException requires a Components.results" +
              " property name, not " + uneval(resultName), stack);
   }
 
   let msg = ("do_check_throws_nsIException: func should throw" +
              " an nsIException whose 'result' is Components.results." +
              resultName);
 
@@ -967,47 +959,46 @@ function do_check_throws_nsIException(fu
 
   // Call this here, not in the 'try' clause, so do_report_result's own
   // throw doesn't get caught by our 'catch' clause.
   do_report_result(false, msg + ", but returned normally", stack, todo);
 }
 
 // Produce a human-readable form of |exception|. This looks up
 // Components.results values, tries toString methods, and so on.
-function legible_exception(exception)
-{
+function legible_exception(exception) {
   switch (typeof exception) {
-    case 'object':
+    case "object":
     if (exception instanceof Components.interfaces.nsIException) {
       return "nsIException instance: " + uneval(exception.toString());
     }
     return exception.toString();
 
-    case 'number':
+    case "number":
     for (let name in Components.results) {
       if (exception === Components.results[name]) {
         return "Components.results." + name;
       }
     }
 
     // Fall through.
     default:
     return uneval(exception);
   }
 }
 
 function do_check_instanceof(value, constructor,
-                             stack=Components.stack.caller, todo=false) {
+                             stack = Components.stack.caller, todo = false) {
   do_report_result(value instanceof constructor,
                    "value should be an instance of " + constructor.name,
                    stack, todo);
 }
 
 function todo_check_instanceof(value, constructor,
-                             stack=Components.stack.caller) {
+                             stack = Components.stack.caller) {
   do_check_instanceof(value, constructor, stack, true);
 }
 
 function do_test_pending(aName) {
   ++_tests_pending;
 
   _testLogger.info("(xpcshell/head.js) | test" +
                    (aName ? " " + aName : "") +
@@ -1042,18 +1033,17 @@ function do_get_file(path, allowNonexist
       // Not using do_throw(): caller will continue.
       _passed = false;
       var stack = Components.stack.caller;
       _testLogger.error("[" + stack.name + " : " + stack.lineNumber + "] " +
                         lf.path + " does not exist");
     }
 
     return lf;
-  }
-  catch (ex) {
+  } catch (ex) {
     do_throw(ex.toString(), Components.stack.caller);
   }
 
   return null;
 }
 
 // do_get_cwd() isn't exactly self-explanatory, so provide a helper
 function do_get_cwd() {
@@ -1085,17 +1075,17 @@ function do_parse_document(aPath, aType)
 
     default:
       do_throw("type: expected application/xhtml+xml, application/xml or text/xml," +
                  " got '" + aType + "'",
                Components.stack.caller);
   }
 
   let file = do_get_file(aPath),
-      ios = Components.classes['@mozilla.org/network/io-service;1']
+      ios = Components.classes["@mozilla.org/network/io-service;1"]
             .getService(Components.interfaces.nsIIOService),
       url = ios.newFileURI(file).spec;
   file = null;
   return new Promise((resolve, reject) => {
     let xhr = new XMLHttpRequest();
     xhr.open("GET", url);
     xhr.responseType = "document";
     xhr.onerror = reject;
@@ -1108,18 +1098,17 @@ function do_parse_document(aPath, aType)
 
 /**
  * Registers a function that will run when the test harness is done running all
  * tests.
  *
  * @param aFunction
  *        The function to be called when the test harness has finished running.
  */
-function do_register_cleanup(aFunction)
-{
+function do_register_cleanup(aFunction) {
   _cleanupFunctions.push(aFunction);
 }
 
 /**
  * Returns the directory for a temp dir, which is created by the
  * test harness. Every test gets its own temp dir.
  *
  * @return nsILocalFile of the temporary directory
@@ -1231,18 +1220,17 @@ function do_get_profile(notifyProfileAft
 /**
  * This function loads head.js (this file) in the child process, so that all
  * functions defined in this file (do_throw, etc) are available to subsequent
  * sendCommand calls.  It also sets various constants used by these functions.
  *
  * (Note that you may use sendCommand without calling this function first;  you
  * simply won't have any of the functions in this file available.)
  */
-function do_load_child_test_harness()
-{
+function do_load_child_test_harness() {
   // Make sure this isn't called from child process
   if (!runningInParent) {
     do_throw("run_test_in_child cannot be called from child!");
   }
 
   // Allow to be called multiple times, but only run once
   if (typeof do_load_child_test_harness.alreadyRun != "undefined")
     return;
@@ -1254,17 +1242,17 @@ function do_load_child_test_harness()
         "const _HEAD_JS_PATH=" + uneval(_HEAD_JS_PATH) + "; "
       + "const _HEAD_FILES=" + uneval(_HEAD_FILES) + "; "
       + "const _MOZINFO_JS_PATH=" + uneval(_MOZINFO_JS_PATH) + "; "
       + "const _TEST_NAME=" + uneval(_TEST_NAME) + "; "
       // We'll need more magic to get the debugger working in the child
       + "const _JSDEBUGGER_PORT=0; "
       + "const _XPCSHELL_PROCESS='child';";
 
-  if (typeof _JSCOV_DIR === 'string') {
+  if (typeof _JSCOV_DIR === "string") {
     command += " const _JSCOV_DIR=" + uneval(_JSCOV_DIR) + ";";
   }
 
   if (_TESTING_MODULES_DIR) {
     command += " const _TESTING_MODULES_DIR=" + uneval(_TESTING_MODULES_DIR) + ";";
   }
 
   command += " load(_HEAD_JS_PATH);";
@@ -1279,22 +1267,21 @@ function do_load_child_test_harness()
  *
  * @param testFile
  *        The name of the script to run.  Path format same as load().
  * @param optionalCallback.
  *        Optional function to be called (in parent) when test on child is
  *        complete.  If provided, the function must call do_test_finished();
  * @return Promise Resolved when the test in the child is complete.
  */
-function run_test_in_child(testFile, optionalCallback)
-{
+function run_test_in_child(testFile, optionalCallback) {
   return new Promise((resolve) => {
     var callback = () => {
       resolve();
-      if (typeof optionalCallback == 'undefined') {
+      if (typeof optionalCallback == "undefined") {
         do_test_finished();
       } else {
         optionalCallback();
       }
     };
 
     do_load_child_test_harness();
 
@@ -1312,18 +1299,17 @@ function run_test_in_child(testFile, opt
  * Execute a given function as soon as a particular cross-process message is received.
  * Must be paired with do_send_remote_message or equivalent ProcessMessageManager calls.
  *
  * @param optionalCallback
  *        Optional callback that is invoked when the message is received.  If provided,
  *        the function must call do_test_finished().
  * @return Promise Promise that is resolved when the message is received.
  */
-function do_await_remote_message(name, optionalCallback)
-{
+function do_await_remote_message(name, optionalCallback) {
   return new Promise((resolve) => {
     var listener = {
       receiveMessage: function(message) {
         if (message.name == name) {
           mm.removeMessageListener(name, listener);
           resolve();
           if (optionalCallback) {
             optionalCallback();
@@ -1349,20 +1335,20 @@ function do_await_remote_message(name, o
  * Asynchronously send a message to all remote processes. Pairs with do_await_remote_message
  * or equivalent ProcessMessageManager listeners.
  */
 function do_send_remote_message(name) {
   var mm;
   var sender;
   if (runningInParent) {
     mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIMessageBroadcaster);
-    sender = 'broadcastAsyncMessage';
+    sender = "broadcastAsyncMessage";
   } else {
     mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
-    sender = 'sendAsyncMessage';
+    sender = "sendAsyncMessage";
   }
   mm[sender](name);
 }
 
 /**
  * Helper function to add the _only property to add_task/add_test function when
  * running it as add_task.only(...).
  *
@@ -1513,31 +1499,29 @@ add_task.skip = _add_skip.bind(undefined
 
 /**
  * Runs the next test function from the list of async tests.
  */
 var _gRunningTest = null;
 var _gTestIndex = 0; // The index of the currently running test.
 var _gTaskRunning = false;
 var _gTestHasOnly = false;
-function run_next_test()
-{
+function run_next_test() {
   if (_gTaskRunning) {
     throw new Error("run_next_test() called from an add_task() test function. " +
                     "run_next_test() should not be called from inside add_task() " +
                     "under any circumstances!");
   }
 
-  function _run_next_test()
-  {
+  function _run_next_test() {
     if (_gTestIndex < _gTests.length) {
       // Check for uncaught rejections as early and often as possible.
       _PromiseTestUtils.assertNoUncaughtRejections();
       let _properties;
-      [_properties, _gRunningTest,] = _gTests[_gTestIndex++];
+      [_properties, _gRunningTest, ] = _gTests[_gTestIndex++];
       if (typeof(_properties.skip_if) == "function" && _properties.skip_if()) {
         let _condition = _properties.skip_if.toSource().replace(/\(\)\s*=>\s*/, "");
         let _message = _gRunningTest.name
           + " skipped because the following conditions were"
           + " met: (" + _condition + ")";
         _testLogger.testStatus(_TEST_NAME,
                                _gRunningTest.name,
                                "SKIP",