Bug 1561435 - Format toolkit/xre/, a=automatic-formatting
authorVictor Porof <vporof@mozilla.com>
Fri, 05 Jul 2019 11:17:37 +0200
changeset 544283 d8d9a53c4c13fe5cb4c6a865590f40633a12a27d
parent 544282 8be6c7ab9d2793c8d085c6868f6bb7591e3cd6bb
child 544284 aaadca9b31255590a2df9c0fa01dd2f25ac0f808
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 toolkit/xre/, a=automatic-formatting # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D36059
toolkit/xre/test/browser_checkdllblockliststate.js
toolkit/xre/test/show_hash.js
toolkit/xre/test/test_install_hash.js
toolkit/xre/test/test_launch_without_hang.js
--- a/toolkit/xre/test/browser_checkdllblockliststate.js
+++ b/toolkit/xre/test/browser_checkdllblockliststate.js
@@ -1,12 +1,16 @@
 // Any copyright is dedicated to the Public Domain.
 // http://creativecommons.org/publicdomain/zero/1.0/
 
 // Tests that the dll blocklist initializes correctly during test runs.
 add_task(async function test() {
-  await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank" }, function(browser) {
-    ok(Services.appinfo.windowsDLLBlocklistStatus,
-       "Windows dll blocklist status should be true, indicating it is " +
-       "running properly. A failure in this test is considered a " +
-       "release blocker.");
+  await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function(
+    browser
+  ) {
+    ok(
+      Services.appinfo.windowsDLLBlocklistStatus,
+      "Windows dll blocklist status should be true, indicating it is " +
+        "running properly. A failure in this test is considered a " +
+        "release blocker."
+    );
   });
 });
--- a/toolkit/xre/test/show_hash.js
+++ b/toolkit/xre/test/show_hash.js
@@ -1,2 +1,4 @@
-const xre = Cc["@mozilla.org/xre/directory-provider;1"].getService(Ci.nsIXREDirProvider);
+const xre = Cc["@mozilla.org/xre/directory-provider;1"].getService(
+  Ci.nsIXREDirProvider
+);
 dump(`${xre.getInstallHash(false)}\n`);
--- a/toolkit/xre/test/test_install_hash.js
+++ b/toolkit/xre/test/test_install_hash.js
@@ -2,19 +2,23 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This runs the xpcshell binary with different cases for the executable path.
  * They should all result in the same installation hash.
  */
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const { Subprocess } = ChromeUtils.import("resource://gre/modules/Subprocess.jsm");
+const { Subprocess } = ChromeUtils.import(
+  "resource://gre/modules/Subprocess.jsm"
+);
 
-const XRE = Cc["@mozilla.org/xre/directory-provider;1"].getService(Ci.nsIXREDirProvider);
+const XRE = Cc["@mozilla.org/xre/directory-provider;1"].getService(
+  Ci.nsIXREDirProvider
+);
 const HASH = XRE.getInstallHash(false);
 const EXE = Services.dirsvc.get("XREExeF", Ci.nsIFile);
 const SCRIPT = do_get_file("show_hash.js", false);
 
 async function getHash(bin) {
   try {
     let proc = await Subprocess.call({
       command: bin.path,
@@ -61,51 +65,75 @@ function countParts(path) {
     index++;
   }
   return index;
 }
 
 add_task(async function testSameBinary() {
   // Running with the same binary path should definitely work and give the same
   // hash.
-  Assert.equal(await getHash(EXE), HASH, "Should have the same hash when running the same binary.");
+  Assert.equal(
+    await getHash(EXE),
+    HASH,
+    "Should have the same hash when running the same binary."
+  );
 });
 
 add_task(async function testUpperCase() {
   let upper = mutatePath(EXE, p => p.toLocaleUpperCase());
   let hash = await getHash(upper);
 
   // We may not get a hash if any part of the filesystem is case sensitive.
   if (hash) {
-    Assert.equal(hash, HASH, `Should have seen the same hash from ${upper.path}.`);
+    Assert.equal(
+      hash,
+      HASH,
+      `Should have seen the same hash from ${upper.path}.`
+    );
   }
 });
 
 add_task(async function testLowerCase() {
   let lower = mutatePath(EXE, p => p.toLocaleLowerCase());
   let hash = await getHash(lower);
 
   // We may not get a hash if any part of the filesystem is case sensitive.
   if (hash) {
-    Assert.equal(hash, HASH, `Should have seen the same hash from ${lower.path}.`);
+    Assert.equal(
+      hash,
+      HASH,
+      `Should have seen the same hash from ${lower.path}.`
+    );
   }
 });
 
 add_task(async function testEachPart() {
   // We need to check the case where only some of the directories in the path
   // are case insensitive.
 
   let count = countParts(EXE);
   for (let i = 0; i < count; i++) {
-    let upper = mutatePath(EXE, (p, index) => index == i ? p.toLocaleUpperCase() : p);
-    let lower = mutatePath(EXE, (p, index) => index == i ? p.toLocaleLowerCase() : p);
+    let upper = mutatePath(EXE, (p, index) =>
+      index == i ? p.toLocaleUpperCase() : p
+    );
+    let lower = mutatePath(EXE, (p, index) =>
+      index == i ? p.toLocaleLowerCase() : p
+    );
 
     let upperHash = await getHash(upper);
     if (upperHash) {
-      Assert.equal(upperHash, HASH, `Should have seen the same hash from ${upper.path}.`);
+      Assert.equal(
+        upperHash,
+        HASH,
+        `Should have seen the same hash from ${upper.path}.`
+      );
     }
 
     let lowerHash = await getHash(lower);
     if (lowerHash) {
-      Assert.equal(lowerHash, HASH, `Should have seen the same hash from ${lower.path}.`);
+      Assert.equal(
+        lowerHash,
+        HASH,
+        `Should have seen the same hash from ${lower.path}.`
+      );
     }
   }
 });
--- a/toolkit/xre/test/test_launch_without_hang.js
+++ b/toolkit/xre/test/test_launch_without_hang.js
@@ -5,87 +5,88 @@
 // bug 1360493
 // Launch the browser a number of times, testing startup hangs.
 
 "use strict";
 
 const Cm = Components.manager;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm", this);
-const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-
+const { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 
 const APP_TIMER_TIMEOUT_MS = 1000 * 15;
 const TRY_COUNT = 50;
 
-
 // Sets a group of environment variables, returning the old values.
 // newVals AND return value is an array of { key: "", value: "" }
 function setEnvironmentVariables(newVals) {
   let oldVals = [];
-  let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
+  let env = Cc["@mozilla.org/process/environment;1"].getService(
+    Ci.nsIEnvironment
+  );
   for (let i = 0; i < newVals.length; ++i) {
     let key = newVals[i].key;
     let value = newVals[i].value;
     let oldObj = { key };
     if (env.exists(key)) {
       oldObj.value = env.get(key);
     } else {
       oldObj.value = null;
     }
 
     env.set(key, value);
     oldVals.push(oldObj);
   }
   return oldVals;
 }
 
-
 function getFirefoxExecutableFilename() {
   if (AppConstants.platform === "win") {
-      return AppConstants.MOZ_APP_NAME + ".exe";
+    return AppConstants.MOZ_APP_NAME + ".exe";
   }
   return AppConstants.MOZ_APP_NAME;
 }
 
-
 // Returns a nsIFile to the firefox.exe executable file
 function getFirefoxExecutableFile() {
   let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
   file = Services.dirsvc.get("GreBinD", Ci.nsIFile);
 
   file.append(getFirefoxExecutableFilename());
   return file;
 }
 
-
 // Takes an executable and arguments, and wraps it in a call to the system shell.
 // Technique adapted from \toolkit\mozapps\update\tests\unit_service_updater\xpcshellUtilsAUS.js
 // to avoid child process console output polluting the xpcshell log.
 // returns { file: (nsIFile), args: [] }
 function wrapLaunchInShell(file, args) {
-  let ret = { };
+  let ret = {};
 
   if (AppConstants.platform === "win") {
     ret.file = Services.dirsvc.get("WinD", Ci.nsIFile);
     ret.file.append("System32");
     ret.file.append("cmd.exe");
     ret.args = ["/D", "/Q", "/C", file.path].concat(args).concat([">nul"]);
   } else {
     ret.file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
     ret.file.initWithPath("/usr/bin/env");
     ret.args = [file.path].concat(args).concat(["> /dev/null"]);
   }
 
-  Assert.ok(ret.file.exists(), "Executable file should exist: " + ret.file.path);
+  Assert.ok(
+    ret.file.exists(),
+    "Executable file should exist: " + ret.file.path
+  );
 
   return ret;
 }
 
-
 // Needed because process.kill() kills the console, not its child process, firefox.
 function terminateFirefox(completion) {
   let executableName = getFirefoxExecutableFilename();
   let file;
   let args;
 
   if (AppConstants.platform === "win") {
     file = Services.dirsvc.get("WinD", Ci.nsIFile);
@@ -103,64 +104,75 @@ function terminateFirefox(completion) {
 
   let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
   process.init(file);
 
   let processObserver = {
     observe: function PO_observe(aSubject, aTopic, aData) {
       info("topic: " + aTopic + ", process exitValue: " + process.exitValue);
 
-      Assert.equal(process.exitValue, 0,
-                   "Terminate firefox process exit value should be 0");
-      Assert.equal(aTopic, "process-finished",
-                   "Terminate firefox observer topic should be " +
-                   "process-finished");
+      Assert.equal(
+        process.exitValue,
+        0,
+        "Terminate firefox process exit value should be 0"
+      );
+      Assert.equal(
+        aTopic,
+        "process-finished",
+        "Terminate firefox observer topic should be " + "process-finished"
+      );
 
       if (completion) {
         completion();
       }
     },
     QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
   };
 
   process.runAsync(args, args.length, processObserver);
 
   info("             with pid: " + process.pid);
 }
 
-
 // Launches file with args asynchronously, failing if the process did not
 // exit within timeoutMS milliseconds. If a timeout occurs, handler()
 // is called.
 function launchProcess(file, args, env, timeoutMS, handler, attemptCount) {
-  let state = { };
+  let state = {};
 
   state.attempt = attemptCount;
 
   state.processObserver = {
     observe: function PO_observe(aSubject, aTopic, aData) {
       if (!state.appTimer) {
         // the app timer has been canceled; this process has timed out already so don't process further.
         handler(false);
         return;
       }
 
-      info("topic: " + aTopic + ", process exitValue: " + state.process.exitValue);
+      info(
+        "topic: " + aTopic + ", process exitValue: " + state.process.exitValue
+      );
 
       info("Restoring environment variables");
       setEnvironmentVariables(state.oldEnv);
 
       state.appTimer.cancel();
       state.appTimer = null;
 
-      Assert.equal(state.process.exitValue, 0,
-                   "the application process exit value should be 0");
-      Assert.equal(aTopic, "process-finished",
-                   "the application process observer topic should be " +
-                   "process-finished");
+      Assert.equal(
+        state.process.exitValue,
+        0,
+        "the application process exit value should be 0"
+      );
+      Assert.equal(
+        aTopic,
+        "process-finished",
+        "the application process observer topic should be " + "process-finished"
+      );
 
       handler(true);
     },
     QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
   };
 
   // The timer callback to kill the process if it takes too long.
   state.appTimerCallback = {
@@ -184,53 +196,67 @@ function launchProcess(file, args, env, 
 
   info("launching application: " + file.path);
   info("            with args: " + args.join(" "));
   info("     with environment: ");
   for (let i = 0; i < env.length; ++i) {
     info("             " + env[i].key + "=" + env[i].value);
   }
 
-  state.process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
+  state.process = Cc["@mozilla.org/process/util;1"].createInstance(
+    Ci.nsIProcess
+  );
   state.process.init(file);
 
   state.appTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-  state.appTimer.initWithCallback(state.appTimerCallback, timeoutMS, Ci.nsITimer.TYPE_ONE_SHOT);
+  state.appTimer.initWithCallback(
+    state.appTimerCallback,
+    timeoutMS,
+    Ci.nsITimer.TYPE_ONE_SHOT
+  );
 
   state.oldEnv = setEnvironmentVariables(env);
 
   state.process.runAsync(args, args.length, state.processObserver);
 
   info("             with pid: " + state.process.pid);
 }
 
-
 function run_test() {
   do_test_pending();
 
   let env = [
     { key: "MOZ_CRASHREPORTER_DISABLE", value: null },
     { key: "MOZ_CRASHREPORTER", value: "1" },
     { key: "MOZ_CRASHREPORTER_NO_REPORT", value: "1" },
     { key: "MOZ_CRASHREPORTER_SHUTDOWN", value: "1" },
     { key: "XPCOM_DEBUG_BREAK", value: "stack-and-abort" },
   ];
 
   let triesStarted = 1;
 
   let handler = function launchFirefoxHandler(okToContinue) {
     triesStarted++;
-    if ((triesStarted <= TRY_COUNT) && okToContinue) {
+    if (triesStarted <= TRY_COUNT && okToContinue) {
       testTry();
     } else {
       do_test_finished();
     }
   };
 
   let testTry = function testTry() {
-    let shell = wrapLaunchInShell(getFirefoxExecutableFile(), ["-no-remote", "-test-launch-without-hang"]);
+    let shell = wrapLaunchInShell(getFirefoxExecutableFile(), [
+      "-no-remote",
+      "-test-launch-without-hang",
+    ]);
     info("Try attempt #" + triesStarted);
-    launchProcess(shell.file, shell.args, env, APP_TIMER_TIMEOUT_MS, handler, triesStarted);
+    launchProcess(
+      shell.file,
+      shell.args,
+      env,
+      APP_TIMER_TIMEOUT_MS,
+      handler,
+      triesStarted
+    );
   };
 
   testTry();
 }
-