PAC-E017 · pac-function-wrong-arity

PAC helper called with the wrong number of arguments

high · Errors and robustness

A built-in PAC helper is called with too few or too many arguments. Missing arguments are undefined, which makes the helper return false or an unexpected value for every host.

Why it matters

The helpers are plain JavaScript functions, so a wrong argument count is not an error at call time. isInNet(host, "10.0.0.0") compares against an undefined mask, dnsDomainIs(host) compares against undefined, and shExpMatch(host, "a", "b") ignores the third argument. In every case the branch is silently wrong rather than loudly broken.

How to fix

Check the helper signature (isInNet needs host, network, mask; dnsDomainIs and shExpMatch need host and pattern).

Examples

Bad

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Related rules

References