docs: function normalizeBinary (binaryPath, platform, arch) {
    return when.promise(function(resolve, reject) {
      platform = platform || os.platform();
      arch = arch || os.arch();
      binaryPath = binaryPath || process.env.JPM_FIREFOX_BINARY || "firefox";
  
      arch = /64/.test(arch) ? "(64)" : "";
      platform = /darwin/i.test(platform) ? "osx" :
                 /win/i.test(platform) ? "windows" + arch :
                 /linux/i.test(platform) ? "linux" + arch :
                 platform;
  
      var app = binaryPath.toLowerCase();
  
      if (platform === "osx") {
        var result = null;
        var channelNames = [
          "firefox", "firefoxdeveloperedition", "beta", "nightly", "aurora"
        ];
  
        if (channelNames.indexOf(binaryPath) !== -1) {
          result = findMacAppByChannel(binaryPath);
        }
        binaryPath = result ||
                     normalizeBinary.paths[app + " on " + platform] ||
                     binaryPath;
        var isAppPath = path.extname(binaryPath) === ".app";
  
        // On OSX, if given the app path, resolve to the actual binary
        binaryPath = isAppPath ? path.join(binaryPath, "Contents/MacOS/firefox-bin") :
                     binaryPath;
  
        return resolve(binaryPath);
      }
      // Return the path if it contains at least two segments
      else if (binaryPath.indexOf(path.sep) !== -1) {
        return resolve(binaryPath);
      }
      // On linux but no path yet, use which to try and find the binary
      else if (platform.indexOf("linux") !== -1) {
          binaryPath = normalizeBinary.appNames[binaryPath + " on linux"] || binaryPath;
          return resolve(which(binaryPath));
      }
      // No action needed on windows if it's an executable already
      else if (path.extname(binaryPath) === ".exe") {
        return resolve(binaryPath);
      }
      // Windows binary finding
      var appName = normalizeBinary.appNames[app + " on windows"];
  
      // this is used when reading the registry goes wrong.
      function fallBack () {
        var programFilesVar = "ProgramFiles";
        if (arch === "(64)") {
          console.warn("You are using 32-bit version of Firefox on 64-bit versions of the Windows.\nSome features may not work correctly in this version. You should upgrade Firefox to the latest 64-bit version now!")
          programFilesVar = "ProgramFiles(x86)";
        }
        resolve(path.join(process.env[programFilesVar], appName, "firefox.exe"));
      }
  
      var rootKey = "\\Software\\Mozilla\\";
      rootKey = path.join(rootKey, appName);
  
      return when.promise(function(resolve, reject) {
        var versionKey = new Winreg({
          hive: Winreg.HKLM,
          key: rootKey
        });
        versionKey.get("CurrentVersion", function(err, key) {
          var isOk = key && !err;
          return isOk ? resolve(key.value) : reject();
        });
      }).then(function(version) {
        var mainKey = new Winreg({
          hive: Winreg.HKLM,
          key: path.join(rootKey, version, "Main")
        });
        mainKey.get("PathToExe", function(err, key) {
          if (err) {
            fallBack();
            return;
          }
          resolve(key.value);
        });
      }, fallBack);
    });
  }