Bug 1403956 - Enable ESLint from chrome/ directory. r=standard8
authorMithilan <mithilan91@gmail.com>
Thu, 26 Oct 2017 16:56:18 -0400
changeset 687889 3c2982568a781f6f4b673ecdb4a75945bdce451e
parent 687888 bf990261dea7d278674de8ec24ee8cbf60aa357a
child 687890 29c198c5db81b6aaed8a8b0cf8543b2948b952b1
push id86623
push usernhnt11@gmail.com
push dateFri, 27 Oct 2017 21:47:15 +0000
reviewersstandard8
bugs1403956
milestone58.0a1
Bug 1403956 - Enable ESLint from chrome/ directory. r=standard8 MozReview-Commit-ID: LHSMjEKeNAe
.eslintignore
chrome/test/.eslintrc.js
chrome/test/unit/head_crtestutils.js
chrome/test/unit/test_abi.js
chrome/test/unit/test_bug292789.js
chrome/test/unit/test_bug380398.js
chrome/test/unit/test_bug397073.js
chrome/test/unit/test_bug399707.js
chrome/test/unit/test_bug401153.js
chrome/test/unit/test_bug415367.js
chrome/test/unit/test_bug564667.js
chrome/test/unit/test_bug848297.js
chrome/test/unit/test_crlf.js
chrome/test/unit/test_data_protocol_registration.js
chrome/test/unit/test_no_remote_registration.js
chrome/test/unit/test_resolve_uris.js
chrome/test/unit_ipc/test_resolve_uris_ipc.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -6,17 +6,16 @@
 **/crashtests/**
 
 # Exclude expected objdirs.
 obj*/**
 
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
 # below.
-chrome/**
 docshell/**
 editor/**
 extensions/cookie/**
 extensions/spellcheck/**
 extensions/universalchardet/**
 gfx/**
 image/**
 intl/**
new file mode 100644
--- /dev/null
+++ b/chrome/test/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/xpcshell-test"
+  ]
+};
\ No newline at end of file
--- a/chrome/test/unit/head_crtestutils.js
+++ b/chrome/test/unit/head_crtestutils.js
@@ -1,14 +1,13 @@
 const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
 const XULAPPINFO_CID = Components.ID("{4ba645d3-be6f-40d6-a42a-01b2f40091b8}");
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 
 
-function registerManifests(manifests)
-{
+function registerManifests(manifests) {
   var reg = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
   for (var manifest of manifests)
     reg.autoRegister(manifest);
 }
--- a/chrome/test/unit/test_abi.js
+++ b/chrome/test/unit/test_abi.js
@@ -10,18 +10,17 @@ registerManifests([do_get_file("data/tes
 
 const catman = Components.classes["@mozilla.org/categorymanager;1"].
   getService(Components.interfaces.nsICategoryManager);
 
 function is_registered(name) {
   try {
     var d = catman.getCategoryEntry("abitest", name);
     return d == "found";
-  }
-  catch (e) {
+  } catch (e) {
     return false;
   }
 }
 
 function run_test() {
   do_check_true(is_registered("test1"));
   do_check_false(is_registered("test2"));
   do_check_true(is_registered("test3"));
--- a/chrome/test/unit/test_bug292789.js
+++ b/chrome/test/unit/test_bug292789.js
@@ -7,25 +7,23 @@ const MANIFESTS = [
   do_get_file("data/test_bug292789.manifest")
 ];
 
 registerManifests(MANIFESTS);
 
 var gIOS;
 var gCR;
 
-function check_accessibility(spec, desired)
-{
+function check_accessibility(spec, desired) {
   var uri = gIOS.newURI(spec);
   var actual = gCR.allowContentToAccess(uri);
   do_check_eq(desired, actual);
 }
 
-function run_test()
-{
+function run_test() {
   gIOS = Cc["@mozilla.org/network/io-service;1"].
     getService(Ci.nsIIOService);
   gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
     getService(Ci.nsIXULChromeRegistry);
   gCR.checkForNewChrome();
 
   check_accessibility("chrome://test1/content/", false);
   check_accessibility("chrome://test1/content/foo.js", false);
--- a/chrome/test/unit/test_bug380398.js
+++ b/chrome/test/unit/test_bug380398.js
@@ -22,41 +22,36 @@ var gIOS = Cc["@mozilla.org/network/io-s
             .getService(Ci.nsIIOService);
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
                  .getService(Ci.nsIChromeRegistry);
 chromeReg.checkForNewChrome();
 
 var target = gIOS.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
-function test_succeeded_mapping(namespace)
-{
+function test_succeeded_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     var result = chromeReg.convertChromeURL(uri);
     do_check_eq(result.spec, target);
-  }
-  catch (ex) {
+  } catch (ex) {
     do_throw(namespace);
   }
 }
 
-function test_failed_mapping(namespace)
-{
+function test_failed_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
-    var result = chromeReg.convertChromeURL(uri);
+    chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  }
-  catch (ex) {
+  } catch (ex) {
   }
 }
 
-function run_test()
-{
+function run_test() {
   test_succeeded_mapping("test1");
   test_succeeded_mapping("test2");
   test_succeeded_mapping("test3");
   test_succeeded_mapping("test4");
   test_succeeded_mapping("test5");
   test_failed_mapping("test6");
   test_failed_mapping("test7");
   test_failed_mapping("test8");
--- a/chrome/test/unit/test_bug397073.js
+++ b/chrome/test/unit/test_bug397073.js
@@ -22,38 +22,33 @@ var gIOS = Cc["@mozilla.org/network/io-s
             .getService(Ci.nsIIOService);
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
                  .getService(Ci.nsIChromeRegistry);
 chromeReg.checkForNewChrome();
 
 var target = gIOS.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
-function test_succeeded_mapping(namespace)
-{
+function test_succeeded_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     var result = chromeReg.convertChromeURL(uri);
     do_check_eq(result.spec, target);
-  }
-  catch (ex) {
+  } catch (ex) {
     do_throw(namespace);
   }
 }
 
-function test_failed_mapping(namespace)
-{
+function test_failed_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
-    var result = chromeReg.convertChromeURL(uri);
+    chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  }
-  catch (ex) {
+  } catch (ex) {
   }
 }
 
-function run_test()
-{
+function run_test() {
   test_succeeded_mapping("test1");
   test_succeeded_mapping("test2");
 
   test_failed_mapping("test3");
 }
--- a/chrome/test/unit/test_bug399707.js
+++ b/chrome/test/unit/test_bug399707.js
@@ -21,41 +21,36 @@ var gIOS = Cc["@mozilla.org/network/io-s
             .getService(Ci.nsIIOService);
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
                  .getService(Ci.nsIChromeRegistry);
 chromeReg.checkForNewChrome();
 
 var target = gIOS.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
-function test_succeeded_mapping(namespace)
-{
+function test_succeeded_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     var result = chromeReg.convertChromeURL(uri);
     do_check_eq(result.spec, target);
-  }
-  catch (ex) {
+  } catch (ex) {
     do_throw(namespace);
   }
 }
 
-function test_failed_mapping(namespace)
-{
+function test_failed_mapping(namespace) {
   var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
   try {
-    var result = chromeReg.convertChromeURL(uri);
+    chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  }
-  catch (ex) {
+  } catch (ex) {
   }
 }
 
-function run_test()
-{
+function run_test() {
   test_succeeded_mapping("test1");
   test_succeeded_mapping("test2");
   test_succeeded_mapping("test3");
   test_failed_mapping("test4");
   test_failed_mapping("test5");
   test_failed_mapping("test6");
   test_failed_mapping("test7");
   test_failed_mapping("test8");
--- a/chrome/test/unit/test_bug401153.js
+++ b/chrome/test/unit/test_bug401153.js
@@ -21,35 +21,31 @@ var gIOS = Cc["@mozilla.org/network/io-s
             .getService(Ci.nsIIOService);
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
                  .getService(Ci.nsIChromeRegistry);
 chromeReg.checkForNewChrome();
 
 var rph = gIOS.getProtocolHandler("resource")
               .QueryInterface(Ci.nsIResProtocolHandler);
 
-function test_succeeded_mapping(namespace, target)
-{
+function test_succeeded_mapping(namespace, target) {
   try {
     do_check_true(rph.hasSubstitution(namespace));
     var uri = gIOS.newURI("resource://" + namespace);
     dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
     do_check_eq(rph.resolveURI(uri), target);
-  }
-  catch (ex) {
+  } catch (ex) {
     dump(ex + "\n");
     do_throw(namespace);
   }
 }
 
-function test_failed_mapping(namespace)
-{
+function test_failed_mapping(namespace) {
   do_check_false(rph.hasSubstitution(namespace));
 }
 
-function run_test()
-{
+function run_test() {
   var data = gIOS.newFileURI(do_get_file("data")).spec;
   test_succeeded_mapping("test1", data + "test1/");
   test_succeeded_mapping("test3", "jar:" + data + "test3.jar!/resources/");
   test_failed_mapping("test4");
   test_succeeded_mapping("test5", data + "test5/");
 }
--- a/chrome/test/unit/test_bug415367.js
+++ b/chrome/test/unit/test_bug415367.js
@@ -1,48 +1,45 @@
 /* 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 gIOS = Cc["@mozilla.org/network/io-service;1"]
             .getService(Ci.nsIIOService);
 
-function test_uri(obj)
-{
+function test_uri(obj) {
   var uri = null;
   var failed = false;
   var message = "";
   try {
     uri = gIOS.newURI(obj.uri);
     if (!obj.result) {
       failed = true;
       message = obj.uri + " should not be accepted as a valid URI";
     }
-  }
-  catch (ex) {
+  } catch (ex) {
     if (obj.result) {
       failed = true;
       message = obj.uri + " should be accepted as a valid URI";
     }
   }
   if (failed)
     do_throw(message);
   if (obj.result) {
     do_check_true(uri != null);
     do_check_eq(uri.spec, obj.uri);
   }
 }
 
-function run_test()
-{
+function run_test() {
   var tests = [
     {uri: "chrome://blah/content/blah.xul", result: true},
     {uri: "chrome://blah/content/:/blah/blah.xul", result: false},
     {uri: "chrome://blah/content/%252e./blah/blah.xul", result: false},
     {uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: false},
     {uri: "chrome://blah/content/blah.xul?param=%252e./blah/", result: true},
     {uri: "chrome://blah/content/blah.xul?param=:/blah/", result: true},
     {uri: "chrome://blah/content/blah.xul?param=%252e%252e/blah/", result: true},
   ];
-  for (var i = 0; i < tests.length; ++ i)
+  for (var i = 0; i < tests.length; ++i)
     test_uri(tests[i]);
 }
--- a/chrome/test/unit/test_bug564667.js
+++ b/chrome/test/unit/test_bug564667.js
@@ -17,47 +17,42 @@ var gCR = Cc["@mozilla.org/chrome/chrome
  * Checks that a mapping was added
  */
 function test_mapping(chromeURL, target) {
   var uri = gIOS.newURI(chromeURL);
 
   try {
     var result = gCR.convertChromeURL(uri);
     do_check_eq(result.spec, target);
-  }
-  catch (ex) {
+  } catch (ex) {
     do_throw(chromeURL + " not Registered");
   }
 }
 
 /*
  * Checks that a mapping was removed
  */
 function test_removed_mapping(chromeURL, target) {
   var uri = gIOS.newURI(chromeURL);
   try {
-    var result = gCR.convertChromeURL(uri);
+    gCR.convertChromeURL(uri);
     do_throw(chromeURL + " not removed");
-  }
-  catch (ex) {
+  } catch (ex) {
     // This should throw
   }
 }
 
 /*
  * Checks if any overlay was added after loading
  * the manifest files
  *
  * @param type The type of overlay: overlay|style
  */
-function test_no_overlays(chromeURL, target, type) {
-  var type = type || "overlay";
+function test_no_overlays(chromeURL, target, type = "overlay") {
   var uri = gIOS.newURI(chromeURL);
-  var present = false, elem;
-
   var overlays = (type == "overlay") ?
       gCR.getXULOverlays(uri) : gCR.getStyleOverlays(uri);
 
   // We shouldn't be allowed to register overlays nor styles
   if (overlays.hasMoreElements()) {
     if (type == "styles")
       do_throw("Style Registered: " + chromeURL);
     else
@@ -79,17 +74,17 @@ function testManifest(manifestPath, base
   // Test Adding Skin URL
   test_mapping("chrome://test1/skin", baseURI + "test/test1.css");
 
   // Test Adding Manifest URL
   test_mapping("chrome://test2/content", baseURI + "test/test2.xul");
   test_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
 
   // Test Adding Override
-  test_mapping("chrome://testOverride/content", 'file:///test1/override')
+  test_mapping("chrome://testOverride/content", "file:///test1/override")
 
   // Test Not-Adding Overlays
   test_no_overlays("chrome://test1/content/overlay.xul",
                    "chrome://test1/content/test1.xul");
 
   // Test Not-Adding Styles
   test_no_overlays("chrome://test1/content/style.xul",
                    "chrome://test1/content/test1.css", "styles");
--- a/chrome/test/unit/test_bug848297.js
+++ b/chrome/test/unit/test_bug848297.js
@@ -32,17 +32,17 @@ function enum_to_array(strings) {
 
 function run_test() {
 
   // without override
   prefService.setCharPref("general.useragent.locale", "de");
   do_check_eq(chromeReg.getSelectedLocale("basepack"), "en-US");
   do_check_eq(chromeReg.getSelectedLocale("overpack"), "de");
   do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
-                   ['en-US', 'fr']);
+                   ["en-US", "fr"]);
 
   // with override
   prefService.setCharPref("chrome.override_package.basepack", "overpack");
   do_check_eq(chromeReg.getSelectedLocale("basepack"), "de");
   do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
-                   ['de', 'en-US']);
+                   ["de", "en-US"]);
 
 }
--- a/chrome/test/unit/test_crlf.js
+++ b/chrome/test/unit/test_crlf.js
@@ -1,15 +1,14 @@
 registerManifests([do_get_file("data/test_crlf.manifest")]);
 
-function run_test()
-{
+function run_test() {
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
     getService(Ci.nsIChromeRegistry);
 
   let ios = Cc["@mozilla.org/network/io-service;1"].
     getService(Ci.nsIIOService);
   let sourceURI = ios.newURI("chrome://test_crlf/content/");
   // this throws for packages that are not registered
   let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;
-  
+
   do_check_true(file.equals(do_get_file("data/test_crlf.xul", true)));
 }
--- a/chrome/test/unit/test_data_protocol_registration.js
+++ b/chrome/test/unit/test_data_protocol_registration.js
@@ -4,34 +4,33 @@
  * 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 manifests = [
   do_get_file("data/test_data_protocol_registration.manifest"),
 ];
 registerManifests(manifests);
 
-function run_test()
-{
+function run_test() {
   const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 
-  Components.utils.import("resource://testing-common/AppInfo.jsm", this);
+  let newAppInfo = Components.utils.import("resource://testing-common/AppInfo.jsm", {}).newAppInfo;
   let XULAppInfo = newAppInfo({
     name: "XPCShell",
     ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
     version: "5",
     platformVersion: "1.9",
   });
 
   let XULAppInfoFactory = {
     // These two are used when we register all our factories (and unregister)
     CID: uuidGenerator.generateUUID(),
     scheme: "XULAppInfo",
     contractID: XULAPPINFO_CONTRACTID,
-    createInstance: function (outer, iid) {
+    createInstance(outer, iid) {
       if (outer != null)
         throw Cr.NS_ERROR_NO_AGGREGATION;
       return XULAppInfo.QueryInterface(iid);
     }
   };
 
   // Add our XULAppInfo factory
   let factories = [XULAppInfoFactory];
@@ -53,27 +52,25 @@ function run_test()
       if (registrar.isContractIDRegistered(factory.contractID)) {
         dump(factory.scheme + " is already registered. Storing currently registered object for restoration later.")
         old_factories.push({
           CID: registrar.contractIDToCID(factory.contractID),
           factory: Components.manager.getClassObject(Cc[factory.contractID], Ci.nsIFactory)
         });
         old_factories_inds.push(true);
         registrar.unregisterFactory(old_factories[i].CID, old_factories[i].factory);
-      }
-      else {
+      } else {
         dump(factory.scheme + " has never been registered. Registering...")
         old_factories.push({CID: "", factory: null});
         old_factories_inds.push(false);
       }
 
       registrar.registerFactory(factory.CID, "test-" + factory.scheme, factory.contractID, factory);
-    }
-    else {
-      do_throw("CID " + factory.CID +  " has already been registered!");
+    } else {
+      do_throw("CID " + factory.CID + " has already been registered!");
     }
   }
 
   // Check for new chrome
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
            getService(Ci.nsIChromeRegistry);
   cr.checkForNewChrome();
 
@@ -83,18 +80,17 @@ function run_test()
   try {
     let ios = Cc["@mozilla.org/network/io-service;1"].
               getService(Ci.nsIIOService);
     sourceURI = ios.newURI(sourceURI);
     // this throws for packages that are not registered
     let uri = cr.convertChromeURL(sourceURI).spec;
 
     do_check_eq(expectedURI, uri);
-  }
-  catch (e) {
+  } catch (e) {
     dump(e + "\n");
     do_throw("Should have registered our URI!");
   }
 
   // Unregister our factories so we do not leak
   for (let i = 0; i < factories.length; i++) {
     let factory = factories[i];
     let ind = old_factories_inds[i];
--- a/chrome/test/unit/test_no_remote_registration.js
+++ b/chrome/test/unit/test_no_remote_registration.js
@@ -1,45 +1,44 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
  * vim: sw=2 ts=2 sts=2 tw=78 expandtab :
  * 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/. */
+/* globals newAppInfo */
 
 var manifests = [
   do_get_file("data/test_no_remote_registration.manifest"),
 ];
 registerManifests(manifests);
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-function ProtocolHandler(aScheme, aFlags)
-{
+function ProtocolHandler(aScheme, aFlags) {
   this.scheme = aScheme;
   this.protocolFlags = aFlags;
   this.contractID = "@mozilla.org/network/protocol;1?name=" + aScheme;
 }
 
 ProtocolHandler.prototype =
 {
   defaultPort: -1,
   allowPort: () => false,
-  newURI: function(aSpec, aCharset, aBaseURI)
-  {
+  newURI(aSpec, aCharset, aBaseURI) {
     let uri = Cc["@mozilla.org/network/standard-url;1"].
               createInstance(Ci.nsIURI);
     uri.spec = aSpec;
     if (!uri.scheme) {
       // We got a partial uri, so let's resolve it with the base one
       uri.spec = aBaseURI.resolve(aSpec);
     }
     return uri;
   },
-  newChannel2: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
-  newChannel: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
+  newChannel2() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
+  newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIProtocolHandler
   ])
 };
 
 var testProtocols = [
   // It doesn't matter if it has this flag - the only flag we accept is
   // URI_IS_LOCAL_RESOURCE.
@@ -63,52 +62,50 @@ var testProtocols = [
   },
   // This should always be last (unless we add more flags that are OK)
   {scheme: "moz-protocol-local-resource",
    flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE,
    CID: Components.ID("{b79e977c-f840-469a-b413-0125cc1b62a5}"),
    shouldRegister: true
   },
 ];
-function run_test()
-{
+function run_test() {
   Components.utils.import("resource://testing-common/AppInfo.jsm", this);
   let XULAppInfo = newAppInfo({
     name: "XPCShell",
     ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
     version: "5",
     platformVersion: "1.9",
   });
 
   const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 
   let XULAppInfoFactory = {
     // These two are used when we register all our factories (and unregister)
     CID: uuidGenerator.generateUUID(),
     scheme: "XULAppInfo",
     contractID: "@mozilla.org/xre/app-info;1",
-    createInstance: function (outer, iid) {
+    createInstance(outer, iid) {
       if (outer != null)
         throw Cr.NS_ERROR_NO_AGGREGATION;
       return XULAppInfo.QueryInterface(iid);
     }
   };
 
   let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
 
   // Create factories
   let factories = [];
   for (let i = 0; i < testProtocols.length; i++) {
     factories[i] = {
       scheme: testProtocols[i].scheme,
       flags: testProtocols[i].flags,
       CID: testProtocols[i].CID,
       contractID: "@mozilla.org/network/protocol;1?name=" + testProtocols[i].scheme,
-      createInstance: function(aOuter, aIID)
-      {
+      createInstance(aOuter, aIID) {
         if (aOuter != null)
           throw Cr.NS_ERROR_NO_AGGREGATION;
         let handler = new ProtocolHandler(this.scheme, this.flags, this.CID);
         return handler.QueryInterface(aIID);
       }
     };
   }
 
@@ -127,25 +124,23 @@ function run_test()
     // Check to see if a contract was already registered and
     // register it if it is not. Otherwise, store the previous one
     // to be restored later and register the new one.
     if (registrar.isContractIDRegistered(XULAppInfoFactory.contractID)) {
       dump(XULAppInfoFactory.scheme + " is already registered. Storing currently registered object for restoration later.")
       old_factory.CID = registrar.contractIDToCID(XULAppInfoFactory.contractID);
       old_factory.factory = Components.manager.getClassObject(Cc[XULAppInfoFactory.contractID], Ci.nsIFactory);
       registrar.unregisterFactory(old_factory.CID, old_factory.factory);
-    }
-    else {
+    } else {
       dump(XULAppInfoFactory.scheme + " has never been registered. Registering...")
     }
 
     registrar.registerFactory(XULAppInfoFactory.CID, "test-" + XULAppInfoFactory.scheme, XULAppInfoFactory.contractID, XULAppInfoFactory);
-  }
-  else {
-    do_throw("CID " + XULAppInfoFactory.CID +  " has already been registered!");
+  } else {
+    do_throw("CID " + XULAppInfoFactory.CID + " has already been registered!");
   }
 
   // Check for new chrome
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
            getService(Ci.nsIChromeRegistry);
   cr.checkForNewChrome();
 
   // See if our various things were able to register
@@ -176,44 +171,41 @@ function run_test()
           break;
         case "override":
           sourceURI = "chrome://good-package/content/override-" +
                       protocol.scheme + ".xul";
           break;
         case "resource":
           sourceURI = "resource://" + protocol.scheme + "/";
           break;
-      };
+      }
       try {
         let ios = Cc["@mozilla.org/network/io-service;1"].
                   getService(Ci.nsIIOService);
         sourceURI = ios.newURI(sourceURI);
         let uri;
         if (type == "resource") {
           // resources go about a slightly different way than everything else
           let rph = ios.getProtocolHandler("resource").
                     QueryInterface(Ci.nsIResProtocolHandler);
           // this throws for packages that are not registered
           uri = rph.resolveURI(sourceURI);
-        }
-        else {
+        } else {
           // this throws for packages that are not registered
           uri = cr.convertChromeURL(sourceURI).spec;
         }
 
         if (protocol.shouldRegister) {
           do_check_eq(expectedURI, uri);
-        }
-        else {
+        } else {
           // Overrides will not throw, so we'll get to here.  We want to make
           // sure that the two strings are not the same in this situation.
           do_check_neq(expectedURI, uri);
         }
-      }
-      catch (e) {
+      } catch (e) {
         if (protocol.shouldRegister) {
           dump(e + "\n");
           do_throw("Should have registered our URI for protocol " +
                    protocol.scheme);
         }
       }
     }
   }
--- a/chrome/test/unit/test_resolve_uris.js
+++ b/chrome/test/unit/test_resolve_uris.js
@@ -11,18 +11,17 @@ if (typeof registerManifests === "undefi
 var manifestFile = do_get_file("../unit/data/test_resolve_uris.manifest");
 
 var manifests = [ manifestFile ];
 registerManifests(manifests);
 
 var ios = Cc["@mozilla.org/network/io-service;1"].
           getService(Ci.nsIIOService);
 
-function do_run_test()
-{
+function do_run_test() {
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
            getService(Ci.nsIChromeRegistry);
 
   // If we don't have libxul or e10s then we don't have process separation, so
   // we don't need to worry about checking for new chrome.
   var appInfo = Cc["@mozilla.org/xre/app-info;1"];
   if (!appInfo ||
       (appInfo.getService(Ci.nsIXULRuntime).processType ==
@@ -57,37 +56,36 @@ function do_run_test()
       case "override":
         sourceURI = "chrome://good-package/content/override-me.xul";
         expectedURI += "override-me.xul";
         break;
       case "resource":
         expectedURI = ios.newFileURI(manifestFile.parent).spec;
         sourceURI = "resource://foo/";
         break;
-    };
+    }
     try {
       sourceURI = ios.newURI(sourceURI);
       let uri;
       if (type == "resource") {
         // resources go about a slightly different way than everything else
         let rph = ios.getProtocolHandler("resource").
             QueryInterface(Ci.nsIResProtocolHandler);
         uri = rph.resolveURI(sourceURI);
-      }
-      else {
+      } else {
         uri = cr.convertChromeURL(sourceURI).spec;
       }
-      
+
       do_check_eq(expectedURI, uri);
-    }
-    catch (e) {
+    } catch (e) {
       dump(e + "\n");
       do_throw("Should have registered a handler for type '" +
                type + "'\n");
     }
   }
 }
 
 if (typeof run_test === "undefined") {
+  // eslint-disable-next-line no-native-reassign
   run_test = function() {
     do_run_test();
   };
 }
--- a/chrome/test/unit_ipc/test_resolve_uris_ipc.js
+++ b/chrome/test/unit_ipc/test_resolve_uris_ipc.js
@@ -1,9 +1,9 @@
 //
 // Run test script in content process instead of chrome (xpcshell's default)
 //
-
 function run_test() {
+  /* globals do_run_test */
   load("../unit/test_resolve_uris.js");
   do_run_test();
   run_test_in_child("../unit/test_resolve_uris.js");
 }