Bug 1561435 - Format chrome/, a=automatic-formatting
authorVictor Porof <vporof@mozilla.com>
Fri, 05 Jul 2019 09:58:58 +0200
changeset 544228 0bbd90cb5368ff59418cf16fcdadb2a59d61f18f
parent 544227 0513b22f434f7b18b21d73deabfb62fd3cddbb74
child 544229 a26eba0ab47dfb80481ff2e3d58a8e0a0424e642
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 chrome/, a=automatic-formatting # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35898
.eslintrc.js
.prettierignore
chrome/test/unit/head_crtestutils.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
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -39,17 +39,16 @@ module.exports = {
   "extends": [
     "plugin:mozilla/recommended"
   ],
   "plugins": [
     "mozilla"
   ],
   "overrides": [{
       "files": [
-        "chrome/**",
         "config/**",
         "devtools/**",
         "docshell/**",
         "dom/**",
         "editor/**",
         "extensions/**",
         "gfx/**",
         "gradle/**",
--- 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.
-chrome/**
 config/**
 docshell/**
 dom/**
 editor/**
 extensions/**
 gfx/**
 gradle/**
 hal/**
--- a/chrome/test/unit/head_crtestutils.js
+++ b/chrome/test/unit/head_crtestutils.js
@@ -1,10 +1,11 @@
 const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
 const XULAPPINFO_CID = Components.ID("{4ba645d3-be6f-40d6-a42a-01b2f40091b8}");
 
-var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function registerManifests(manifests) {
   var reg = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
-  for (var manifest of manifests)
+  for (var manifest of manifests) {
     reg.autoRegister(manifest);
+  }
 }
--- a/chrome/test/unit/test_bug292789.js
+++ b/chrome/test/unit/test_bug292789.js
@@ -1,30 +1,29 @@
 /* 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/.
  */
 
-const MANIFESTS = [
-  do_get_file("data/test_bug292789.manifest"),
-];
+const MANIFESTS = [do_get_file("data/test_bug292789.manifest")];
 
 registerManifests(MANIFESTS);
 
 var gCR;
 
 function check_accessibility(spec, desired) {
   var uri = Services.io.newURI(spec);
   var actual = gCR.allowContentToAccess(uri);
   Assert.equal(desired, actual);
 }
 
 function run_test() {
-  gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
-    getService(Ci.nsIXULChromeRegistry);
+  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);
   check_accessibility("chrome://test2/content/", true);
   check_accessibility("chrome://test2/content/foo.js", true);
   check_accessibility("chrome://test3/content/", false);
   check_accessibility("chrome://test3/content/foo.js", false);
--- a/chrome/test/unit/test_bug380398.js
+++ b/chrome/test/unit/test_bug380398.js
@@ -1,30 +1,28 @@
 /* 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 MANIFESTS = [
-  do_get_file("data/test_bug380398.manifest"),
-];
+var MANIFESTS = [do_get_file("data/test_bug380398.manifest")];
 
 registerManifests(MANIFESTS);
 
 ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo({
   name: "XPCShell",
   id: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
   version: "5",
   platformVersion: "1.9",
 });
 
-var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                 .getService(Ci.nsIChromeRegistry);
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIChromeRegistry
+);
 chromeReg.checkForNewChrome();
 
 var target = Services.io.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
 function test_succeeded_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
@@ -35,18 +33,17 @@ function test_succeeded_mapping(namespac
   }
 }
 
 function test_failed_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  } catch (ex) {
-  }
+  } catch (ex) {}
 }
 
 function run_test() {
   test_succeeded_mapping("test1");
   test_succeeded_mapping("test2");
   test_succeeded_mapping("test3");
   test_succeeded_mapping("test4");
   test_succeeded_mapping("test5");
--- a/chrome/test/unit/test_bug397073.js
+++ b/chrome/test/unit/test_bug397073.js
@@ -1,30 +1,28 @@
 /* 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 MANIFESTS = [
-  do_get_file("data/test_bug397073.manifest"),
-];
-
+var MANIFESTS = [do_get_file("data/test_bug397073.manifest")];
 
 registerManifests(MANIFESTS);
 
 ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo({
   name: "XPCShell",
   ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
   version: "5",
   platformVersion: "1.9",
 });
 
-var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                 .getService(Ci.nsIChromeRegistry);
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIChromeRegistry
+);
 chromeReg.checkForNewChrome();
 
 var target = Services.io.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
 function test_succeeded_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
@@ -35,18 +33,17 @@ function test_succeeded_mapping(namespac
   }
 }
 
 function test_failed_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  } catch (ex) {
-  }
+  } catch (ex) {}
 }
 
 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
@@ -1,29 +1,28 @@
 /* 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 MANIFESTS = [
-  do_get_file("data/test_bug399707.manifest"),
-];
+var MANIFESTS = [do_get_file("data/test_bug399707.manifest")];
 
 registerManifests(MANIFESTS);
 
 ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo({
   name: "XPCShell",
   ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
   version: "5",
   platformVersion: "1.9",
 });
 
-var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                 .getService(Ci.nsIChromeRegistry);
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIChromeRegistry
+);
 chromeReg.checkForNewChrome();
 
 var target = Services.io.newFileURI(do_get_file("data"));
 target = target.spec + "test/test.xul";
 
 function test_succeeded_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
@@ -34,18 +33,17 @@ function test_succeeded_mapping(namespac
   }
 }
 
 function test_failed_mapping(namespace) {
   var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
   try {
     chromeReg.convertChromeURL(uri);
     do_throw(namespace);
-  } catch (ex) {
-  }
+  } catch (ex) {}
 }
 
 function run_test() {
   test_succeeded_mapping("test1");
   test_succeeded_mapping("test2");
   test_succeeded_mapping("test3");
   test_failed_mapping("test4");
   test_failed_mapping("test5");
--- a/chrome/test/unit/test_bug401153.js
+++ b/chrome/test/unit/test_bug401153.js
@@ -1,39 +1,41 @@
 /* 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 MANIFESTS = [
-  do_get_file("data/test_bug401153.manifest"),
-];
+var MANIFESTS = [do_get_file("data/test_bug401153.manifest")];
 
 registerManifests(MANIFESTS);
 
 ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
 updateAppInfo({
   name: "XPCShell",
   ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
   version: "5",
   platformVersion: "1.9",
 });
 
-var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                 .getService(Ci.nsIChromeRegistry);
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIChromeRegistry
+);
 chromeReg.checkForNewChrome();
 
-var rph = Services.io.getProtocolHandler("resource")
-              .QueryInterface(Ci.nsIResProtocolHandler);
+var rph = Services.io
+  .getProtocolHandler("resource")
+  .QueryInterface(Ci.nsIResProtocolHandler);
 
 function test_succeeded_mapping(namespace, target) {
   try {
     Assert.ok(rph.hasSubstitution(namespace));
     var uri = Services.io.newURI("resource://" + namespace);
-    dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
+    dump(
+      "### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n"
+    );
     Assert.equal(rph.resolveURI(uri), target);
   } catch (ex) {
     dump(ex + "\n");
     do_throw(namespace);
   }
 }
 
 function test_failed_mapping(namespace) {
--- a/chrome/test/unit/test_bug415367.js
+++ b/chrome/test/unit/test_bug415367.js
@@ -14,29 +14,34 @@ function test_uri(obj) {
       message = obj.uri + " should not be accepted as a valid URI";
     }
   } catch (ex) {
     if (obj.result) {
       failed = true;
       message = obj.uri + " should be accepted as a valid URI";
     }
   }
-  if (failed)
+  if (failed) {
     do_throw(message);
+  }
   if (obj.result) {
     Assert.ok(uri != null);
     Assert.equal(uri.spec, obj.uri);
   }
 }
 
 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},
+    { 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
@@ -1,18 +1,19 @@
 /* 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/.
  */
 
 const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
 const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");
 
-var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
-          getService(Ci.nsIChromeRegistry);
+var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIChromeRegistry
+);
 
 /*
  * Checks that a mapping was added
  */
 function test_mapping(chromeURL, target) {
   var uri = Services.io.newURI(chromeURL);
 
   try {
@@ -73,10 +74,13 @@ function testManifest(manifestPath, base
   test_removed_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
 }
 
 function run_test() {
   // Test an unpackaged addon
   testManifest(UNPACKAGED_ADDON, Services.io.newFileURI(UNPACKAGED_ADDON).spec);
 
   // Test a packaged addon
-  testManifest(PACKAGED_ADDON, "jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/");
+  testManifest(
+    PACKAGED_ADDON,
+    "jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/"
+  );
 }
--- a/chrome/test/unit/test_bug848297.js
+++ b/chrome/test/unit/test_bug848297.js
@@ -1,36 +1,38 @@
 /* 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 MANIFESTS = [
-  do_get_file("data/test_bug848297.manifest"),
-];
+var MANIFESTS = [do_get_file("data/test_bug848297.manifest")];
 
 // Stub in the locale service so we can control what gets returned as the OS locale setting
 
 registerManifests(MANIFESTS);
 
 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                .getService(Ci.nsIXULChromeRegistry)
-                .QueryInterface(Ci.nsIToolkitChromeRegistry);
+  .getService(Ci.nsIXULChromeRegistry)
+  .QueryInterface(Ci.nsIToolkitChromeRegistry);
 chromeReg.checkForNewChrome();
 
 function enum_to_array(strings) {
   return Array.from(strings).sort();
 }
 
 function run_test() {
   // without override
   Services.locale.requestedLocales = ["de"];
   Assert.equal(chromeReg.getSelectedLocale("basepack"), "en-US");
   Assert.equal(chromeReg.getSelectedLocale("overpack"), "de");
-  Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
-                   ["en-US", "fr"]);
+  Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")), [
+    "en-US",
+    "fr",
+  ]);
 
   // with override
   Services.prefs.setCharPref("chrome.override_package.basepack", "overpack");
   Assert.equal(chromeReg.getSelectedLocale("basepack"), "de");
-  Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
-                   ["de", "en-US"]);
+  Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")), [
+    "de",
+    "en-US",
+  ]);
 }
--- a/chrome/test/unit/test_crlf.js
+++ b/chrome/test/unit/test_crlf.js
@@ -1,12 +1,13 @@
 registerManifests([do_get_file("data/test_crlf.manifest")]);
 
 function run_test() {
-  let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
-    getService(Ci.nsIChromeRegistry);
+  let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+    Ci.nsIChromeRegistry
+  );
 
   let sourceURI = Services.io.newURI("chrome://test_crlf/content/");
   // this throws for packages that are not registered
   let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;
 
   Assert.ok(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
@@ -1,38 +1,42 @@
 /* -*- 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/. */
 
-var manifests = [
-  do_get_file("data/test_data_protocol_registration.manifest"),
-];
+var manifests = [do_get_file("data/test_data_protocol_registration.manifest")];
 registerManifests(manifests);
 
 function run_test() {
-  const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
+  const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(
+    Ci.nsIUUIDGenerator
+  );
 
-  let newAppInfo = ChromeUtils.import("resource://testing-common/AppInfo.jsm", {}).newAppInfo;
+  let newAppInfo = ChromeUtils.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(outer, iid) {
-      if (outer != null)
+      if (outer != null) {
         throw Cr.NS_ERROR_NO_AGGREGATION;
+      }
       return XULAppInfo.QueryInterface(iid);
     },
   };
 
   // Add our XULAppInfo factory
   let factories = [XULAppInfoFactory];
   let old_factories = [];
   let old_factories_inds = [];
@@ -44,37 +48,49 @@ function run_test() {
     let factory = factories[i];
 
     // Make sure the class ID has not already been registered
     if (!registrar.isCIDRegistered(factory.CID)) {
       // 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(factory.contractID)) {
-        dump(factory.scheme + " is already registered. Storing currently registered object for restoration later.");
+        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),
+          factory: Components.manager.getClassObject(
+            Cc[factory.contractID],
+            Ci.nsIFactory
+          ),
         });
         old_factories_inds.push(true);
       } else {
         dump(factory.scheme + " has never been registered. Registering...");
-        old_factories.push({CID: "", factory: null});
+        old_factories.push({ CID: "", factory: null });
         old_factories_inds.push(false);
       }
 
-      registrar.registerFactory(factory.CID, "test-" + factory.scheme, factory.contractID, factory);
+      registrar.registerFactory(
+        factory.CID,
+        "test-" + factory.scheme,
+        factory.contractID,
+        factory
+      );
     } 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);
+  let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+    Ci.nsIChromeRegistry
+  );
   cr.checkForNewChrome();
 
   // Check that our override worked
   let expectedURI = "data:application/vnd.mozilla.xul+xml,";
   let sourceURI = "chrome://good-package/content/test.xul";
   try {
     sourceURI = Services.io.newURI(sourceURI);
     // this throws for packages that are not registered
@@ -89,12 +105,17 @@ function run_test() {
   // 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];
     registrar.unregisterFactory(factory.CID, factory);
 
     if (ind) {
       let old_factory = old_factories[i];
-      registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, null);
+      registrar.registerFactory(
+        old_factory.CID,
+        factory.scheme,
+        factory.contractID,
+        null
+      );
     }
   }
 }
--- a/chrome/test/unit/test_no_remote_registration.js
+++ b/chrome/test/unit/test_no_remote_registration.js
@@ -1,179 +1,201 @@
 /* -*- 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"),
-];
+var manifests = [do_get_file("data/test_no_remote_registration.manifest")];
 registerManifests(manifests);
 
 function ProtocolHandler(aScheme, aFlags) {
   this.scheme = aScheme;
   this.protocolFlags = aFlags;
   this.contractID = "@mozilla.org/network/protocol;1?name=" + aScheme;
 }
 
-ProtocolHandler.prototype =
-{
+ProtocolHandler.prototype = {
   defaultPort: -1,
   allowPort: () => false,
-  newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
-  QueryInterface: ChromeUtils.generateQI([
-    Ci.nsIProtocolHandler,
-  ]),
+  newChannel() {
+    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+  },
+  QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
 };
 
 var testProtocols = [
   // It doesn't matter if it has this flag - the only flag we accept is
   // URI_IS_LOCAL_RESOURCE.
-  {scheme: "moz-protocol-ui-resource",
-   flags: Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE,
-   CID: Components.ID("{d6dedc93-558f-44fe-90f4-3b4bba8a0b14}"),
-   shouldRegister: false,
+  {
+    scheme: "moz-protocol-ui-resource",
+    flags: Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE,
+    CID: Components.ID("{d6dedc93-558f-44fe-90f4-3b4bba8a0b14}"),
+    shouldRegister: false,
   },
   // It doesn't matter if it has this flag - the only flag we accept is
   // URI_IS_LOCAL_RESOURCE.
-  {scheme: "moz-protocol-local-file",
-   flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_FILE,
-   CID: Components.ID("{ee30d594-0a2d-4f47-89cc-d4cde320ab69}"),
-   shouldRegister: false,
+  {
+    scheme: "moz-protocol-local-file",
+    flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_FILE,
+    CID: Components.ID("{ee30d594-0a2d-4f47-89cc-d4cde320ab69}"),
+    shouldRegister: false,
   },
   // This clearly is non-local
-  {scheme: "moz-protocol-loadable-by-anyone",
-   flags: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
-   CID: Components.ID("{c3735f23-3b0c-4a33-bfa0-79436dcd40b2}"),
-   shouldRegister: false,
+  {
+    scheme: "moz-protocol-loadable-by-anyone",
+    flags: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
+    CID: Components.ID("{c3735f23-3b0c-4a33-bfa0-79436dcd40b2}"),
+    shouldRegister: false,
   },
   // 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,
+  {
+    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() {
   ChromeUtils.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);
+  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(outer, iid) {
-      if (outer != null)
+      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,
+      contractID:
+        "@mozilla.org/network/protocol;1?name=" + testProtocols[i].scheme,
       createInstance(aOuter, aIID) {
-        if (aOuter != null)
+        if (aOuter != null) {
           throw Cr.NS_ERROR_NO_AGGREGATION;
+        }
         let handler = new ProtocolHandler(this.scheme, this.flags, this.CID);
         return handler.QueryInterface(aIID);
       },
     };
   }
 
   // Register our factories
   for (let i = 0; i < factories.length; i++) {
     let factory = factories[i];
-    registrar.registerFactory(factory.CID, "test-" + factory.scheme,
-                               factory.contractID, factory);
+    registrar.registerFactory(
+      factory.CID,
+      "test-" + factory.scheme,
+      factory.contractID,
+      factory
+    );
   }
 
   // Register the XULAppInfoFactory
   // Make sure the class ID has not already been registered
-  let old_factory = {CID: "", factory: null};
+  let old_factory = { CID: "", factory: null };
   if (!registrar.isCIDRegistered(XULAppInfoFactory.CID)) {
     // 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.");
+      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);
+      old_factory.factory = Components.manager.getClassObject(
+        Cc[XULAppInfoFactory.contractID],
+        Ci.nsIFactory
+      );
     } else {
-      dump(XULAppInfoFactory.scheme + " has never been registered. Registering...");
+      dump(
+        XULAppInfoFactory.scheme + " has never been registered. Registering..."
+      );
     }
 
-    registrar.registerFactory(XULAppInfoFactory.CID, "test-" + XULAppInfoFactory.scheme, XULAppInfoFactory.contractID, XULAppInfoFactory);
+    registrar.registerFactory(
+      XULAppInfoFactory.CID,
+      "test-" + XULAppInfoFactory.scheme,
+      XULAppInfoFactory.contractID,
+      XULAppInfoFactory
+    );
   } 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);
+  let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+    Ci.nsIChromeRegistry
+  );
   cr.checkForNewChrome();
 
   // See if our various things were able to register
-  let registrationTypes = [
-    "content",
-    "locale",
-    "skin",
-    "override",
-    "resource",
-  ];
+  let registrationTypes = ["content", "locale", "skin", "override", "resource"];
   for (let i = 0; i < testProtocols.length; i++) {
     let protocol = testProtocols[i];
     for (let j = 0; j < registrationTypes.length; j++) {
       let type = registrationTypes[j];
-      dump("Testing protocol '" + protocol.scheme + "' with type '" + type +
-           "'\n");
+      dump(
+        "Testing protocol '" + protocol.scheme + "' with type '" + type + "'\n"
+      );
       let expectedURI = protocol.scheme + "://foo/";
       let sourceURI = "chrome://" + protocol.scheme + "/" + type + "/";
       switch (type) {
         case "content":
           expectedURI += protocol.scheme + ".xul";
           break;
         case "locale":
           expectedURI += protocol.scheme + ".dtd";
           break;
         case "skin":
           expectedURI += protocol.scheme + ".css";
           break;
         case "override":
-          sourceURI = "chrome://good-package/content/override-" +
-                      protocol.scheme + ".xul";
+          sourceURI =
+            "chrome://good-package/content/override-" +
+            protocol.scheme +
+            ".xul";
           break;
         case "resource":
           sourceURI = "resource://" + protocol.scheme + "/";
           break;
       }
       try {
         sourceURI = Services.io.newURI(sourceURI);
         let uri;
         if (type == "resource") {
           // resources go about a slightly different way than everything else
-          let rph = Services.io.getProtocolHandler("resource").
-                    QueryInterface(Ci.nsIResProtocolHandler);
+          let rph = Services.io
+            .getProtocolHandler("resource")
+            .QueryInterface(Ci.nsIResProtocolHandler);
           // this throws for packages that are not registered
           uri = rph.resolveURI(sourceURI);
         } else {
           // this throws for packages that are not registered
           uri = cr.convertChromeURL(sourceURI).spec;
         }
 
         if (protocol.shouldRegister) {
@@ -181,27 +203,33 @@ function run_test() {
         } 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.
           Assert.notEqual(expectedURI, uri);
         }
       } catch (e) {
         if (protocol.shouldRegister) {
           dump(e + "\n");
-          do_throw("Should have registered our URI for protocol " +
-                   protocol.scheme);
+          do_throw(
+            "Should have registered our URI for protocol " + protocol.scheme
+          );
         }
       }
     }
   }
 
   // Unregister our factories so we do not leak
   for (let i = 0; i < factories.length; i++) {
     let factory = factories[i];
     registrar.unregisterFactory(factory.CID, factory);
   }
 
   // Unregister XULAppInfoFactory
   registrar.unregisterFactory(XULAppInfoFactory.CID, XULAppInfoFactory);
   if (old_factory.factory != null) {
-    registrar.registerFactory(old_factory.CID, "", XULAppInfoFactory.contractID, null);
+    registrar.registerFactory(
+      old_factory.CID,
+      "",
+      XULAppInfoFactory.contractID,
+      null
+    );
   }
 }
--- a/chrome/test/unit/test_resolve_uris.js
+++ b/chrome/test/unit/test_resolve_uris.js
@@ -5,41 +5,38 @@
 
 // head_crtestutils.js doesn't get included in the child by default
 if (typeof registerManifests === "undefined") {
   load("../unit/head_crtestutils.js");
 }
 
 var manifestFile = do_get_file("../unit/data/test_resolve_uris.manifest");
 
-var manifests = [ manifestFile ];
+var manifests = [manifestFile];
 registerManifests(manifests);
 
 function do_run_test() {
-  let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
-           getService(Ci.nsIChromeRegistry);
+  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 ||
-      // eslint-disable-next-line mozilla/use-services
-      (appInfo.getService(Ci.nsIXULRuntime).processType ==
-       Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT)) {
+  if (
+    !appInfo ||
+    // eslint-disable-next-line mozilla/use-services
+    appInfo.getService(Ci.nsIXULRuntime).processType ==
+      Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
+  ) {
     cr.checkForNewChrome();
   }
 
   // See if our various things were able to register
-  let registrationTypes = [
-      "content",
-      "locale",
-      "skin",
-      "override",
-      "resource",
-  ];
+  let registrationTypes = ["content", "locale", "skin", "override", "resource"];
 
   for (let j = 0; j < registrationTypes.length; j++) {
     let type = registrationTypes[j];
     dump("Testing type '" + type + "'\n");
     let expectedURI = "resource://foo/foo-" + type + "/";
     let sourceURI = "chrome://foo/" + type + "/";
     switch (type) {
       case "content":
@@ -60,28 +57,28 @@ function do_run_test() {
         sourceURI = "resource://foo/";
         break;
     }
     try {
       sourceURI = Services.io.newURI(sourceURI);
       let uri;
       if (type == "resource") {
         // resources go about a slightly different way than everything else
-        let rph = Services.io.getProtocolHandler("resource").
-            QueryInterface(Ci.nsIResProtocolHandler);
+        let rph = Services.io
+          .getProtocolHandler("resource")
+          .QueryInterface(Ci.nsIResProtocolHandler);
         uri = rph.resolveURI(sourceURI);
       } else {
         uri = cr.convertChromeURL(sourceURI).spec;
       }
 
       Assert.equal(expectedURI, uri);
     } catch (e) {
       dump(e + "\n");
-      do_throw("Should have registered a handler for type '" +
-               type + "'\n");
+      do_throw("Should have registered a handler for type '" + type + "'\n");
     }
   }
 }
 
 if (typeof run_test === "undefined") {
   // eslint-disable-next-line no-global-assign
   run_test = function() {
     do_run_test();