code: function(opt_config, opt_flow) {
    var caps;
    if (opt_config instanceof Options) {
      caps = opt_config.toCapabilities();
    } else {
      caps = new webdriver.Capabilities(opt_config);
    }
  
    var binary = caps.get('firefox_binary') || new Binary();
    if (typeof binary === 'string') {
      binary = new Binary(binary);
    }
  
    var profile = caps.get('firefox_profile') || new Profile();
  
    caps.set('firefox_binary', null);
    caps.set('firefox_profile', null);
  
    var serverUrl = portprober.findFreePort().then(function(port) {
      var prepareProfile;
      if (typeof profile === 'string') {
        prepareProfile = decodeProfile(profile).then(function(dir) {
          var profile = new Profile(dir);
          profile.setPreference('webdriver_firefox_port', port);
          return profile.writeToDisk();
        });
      } else {
        profile.setPreference('webdriver_firefox_port', port);
        prepareProfile = profile.writeToDisk();
      }
  
      return prepareProfile.then(function(dir) {
        return binary.launch(dir);
      }).then(function() {
        var serverUrl = url.format({
          protocol: 'http',
          hostname: net.getLoopbackAddress(),
          port: port,
          pathname: '/hub'
        });
  
        return httpUtil.waitForServer(serverUrl, 45 * 1000).then(function() {
          return serverUrl;
        });
      });
    });
  
    var executor = executors.createExecutor(serverUrl);
    var driver = webdriver.WebDriver.createSession(executor, caps, opt_flow);
  
    webdriver.WebDriver.call(this, driver.getSession(), executor, opt_flow);
  }
docs: A WebDriver client for Firefox.
  
  @param {(Options|webdriver.Capabilities|Object)=} opt_config The
  configuration options for this driver, specified as either an
  {@link Options} or {@link webdriver.Capabilities}, or as a raw hash
  object.
  @param {webdriver.promise.ControlFlow=} opt_flow The flow to
  schedule commands through. Defaults to the active flow object.
  @constructor
  @extends {webdriver.WebDriver}