lib/index.js
function (browser, url, proxyURL, pacFileURL, dataDir, bypassList) {
    // Firefox pac set
    // http://www.indexdata.com/connector-platform/enginedoc/proxy-auto.html
    // http://kb.mozillazine.org/Network.proxy.autoconfig_url
    // user_pref("network.proxy.autoconfig_url", "http://us2.indexdata.com:9005/id/cf.pac");
    // user_pref("network.proxy.type", 2);

    return this.detect(browser).then(function (browserPath) {
      if (!browserPath) {
        throw Error('[Error] can not find browser ' + browser);
      } else {
        dataDir = dataDir || path.join(os.tmpdir(), 'op-browser');

        if (os.platform() === 'win32') {
          browserPath = '"' + browserPath + '"';
        }

        var commandOptions = configUtil[browser](dataDir, url, browserPath, proxyURL, pacFileURL, bypassList);

        return new Promise(function (resolve, reject) {
          var cmdStr = browserPath + ' ' + commandOptions;
          childProcess.exec(cmdStr, {maxBuffer: 50000 * 1024}, function (err) {
            if (err) {
              reject(err);
            } else {
              resolve({
                path: browserPath,
                cmdOptions: commandOptions,
                proxyURL: proxyURL,
                pacFileURL: pacFileURL
              });
            }
          });
        });
      }
    });
  }
function (browser, url, proxyURL, pacFileURL, dataDir, bypassList) {
    // Firefox pac set
    // http://www.indexdata.com/connector-platform/enginedoc/proxy-auto.html
    // http://kb.mozillazine.org/Network.proxy.autoconfig_url
    // user_pref("network.proxy.autoconfig_url", "http://us2.indexdata.com:9005/id/cf.pac");
    // user_pref("network.proxy.type", 2);

    return this.detect(browser).then(function (browserPath) {
      if (!browserPath) {
        throw Error('[Error] can not find browser ' + browser);
      } else {
        dataDir = dataDir || path.join(os.tmpdir(), 'op-browser');

        if (os.platform() === 'win32') {
          browserPath = '"' + browserPath + '"';
        }

        var commandOptions = configUtil[browser](dataDir, url, browserPath, proxyURL, pacFileURL, bypassList);

        return new Promise(function (resolve, reject) {
          var cmdStr = browserPath + ' ' + commandOptions;
          childProcess.exec(cmdStr, {maxBuffer: 50000 * 1024}, function (err) {
            if (err) {
              reject(err);
            } else {
              resolve({
                path: browserPath,
                cmdOptions: commandOptions,
                proxyURL: proxyURL,
                pacFileURL: pacFileURL
              });
            }
          });
        });
      }
    });
  }
function ( browser , url , proxyURL , pacFileURL , dataDir , bypassList ) { // Firefox pac set // http://www.indexdata.com/connector-platform/enginedoc/proxy-auto.html // http://kb.mozillazine.org/Network.proxy.autoconfig_url // user_pref("network.proxy.autoconfig_url", "http://us2.indexdata.com:9005/id/cf.pac"); // user_pref("network.proxy.type", 2); return this . detect ( browser ) . then ( function ( browserPath ) { if ( ! browserPath ) { throw Error ( '[Error] can not find browser ' + browser ) ; } else { dataDir = dataDir || path . join ( os . tmpdir ( ) , 'op-browser' ) ; if ( os . platform ( ) === 'win32' ) { browserPath = '"' + browserPath + '"' ; } var commandOptions = configUtil [ browser ] ( dataDir , url , browserPath , proxyURL , pacFileURL , bypassList ) ; return new Promise ( function ( resolve , reject ) { var cmdStr = browserPath + ' ' + commandOptions ; childProcess . exec ( cmdStr , { maxBuffer : 50000 * 1024 } , function ( err ) { if ( err ) { reject ( err ) ; } else { resolve ( { path : browserPath , cmdOptions : commandOptions , proxyURL : proxyURL , pacFileURL : pacFileURL } ) ; } } ) ; } ) ; } } ) ; }
open browser window, if the `pacFileURL` is not empty, will use `proxy auto-configuration`
@memberof op-browser
@param {String} browser the browser's name
@param {String} url     the url that to open
@param {String} proxyURL the proxy url, format: `http://<hostname>[:[port]]`
@param {String} pacFileURL the proxy url, format: `http://<hostname>[:[port]]/[pac-file-name]`
@param {String} dataDir the user data directory
@param {String} bypassList the list of hosts for whom we bypass proxy settings and use direct connections. the list of hosts for whom we bypass proxy settings and use direct connections, See: "[net/proxy/proxy_bypass_rules.h](https://cs.chromium.org/chromium/src/net/proxy_resolution/proxy_bypass_rules.h?sq=package:chromium&type=cs)" for the format of these rules
@return {Promise}
open browser window if the pacFileURL is not empty will use proxy auto - configuration