code: function installExtensions(extensions, dir, opt_excludeWebDriverExt) {
    var hasWebDriver = !!opt_excludeWebDriverExt;
    var next = 0;
    var extensionDir = path.join(dir, 'extensions');
    var done = promise.defer();
  
    return io.exists(extensionDir).then(function(exists) {
      if (!exists) {
        return promise.checkedNodeCall(fs.mkdir, extensionDir);
      }
    }).then(function() {
      installNext();
      return done.promise;
    });
  
    function installNext() {
      if (!done.isPending()) {
        return;
      }
  
      if (next >= extensions.length) {
        if (hasWebDriver) {
          done.fulfill(dir);
        } else {
          install(WEBDRIVER_EXTENSION_PATH);
        }
      } else {
        install(extensions[next++]);
      }
    }
  
    function install(ext) {
      extension.install(ext, extensionDir).then(function(id) {
        hasWebDriver = hasWebDriver || (id === WEBDRIVER_EXTENSION_NAME);
        installNext();
      }, done.reject);
   }
  }
docs: Installs a group of extensions in the given profile directory. If the
  WebDriver extension is not included in this set, the default version
  bundled with this package will be installed.
  @param {!Array.<string>} extensions The extensions to install, as a
  path to an unpacked extension directory or a path to a xpi file.
  @param {string} dir The profile directory to install to.
  @param {boolean=} opt_excludeWebDriverExt Whether to skip installation of
  the default WebDriver extension.
  @return {!promise.Promise.<string>} A promise for the main profile directory
  once all extensions have been installed.