PAC-E007 · evaluation-timeout

Evaluation did not finish within the time limit

critical · Errors and robustness

A test evaluation ran into the sandbox timeout. Real engines have no comparable guard; a loop that never ends hangs proxy resolution for the browser.

Why it matters

Browsers evaluate the PAC for every connection on a dedicated resolver thread. A loop that never terminates (or a pathological regular expression) blocks that thread. Requests queue behind it and the browser appears to hang on “resolving proxy”. There is no recovery other than restarting the browser or changing the PAC. Nothing in the PAC function model needs loops that depend on external state; every loop should iterate over a fixed list.

How to fix

Remove the loop or make it iterate over a bounded array; never loop on a condition that the loop body does not change.

Examples

Bad

function FindProxyForURL(url, host) {
  var i = 0;
  while (i < 10) {
    if (shExpMatch(host, "*.corp.example")) {
      return "DIRECT";
    }
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

var directPatterns = ["*.corp.example", "*.test"];
function FindProxyForURL(url, host) {
  for (var i = 0; i < directPatterns.length; i++) {
    if (shExpMatch(host, directPatterns[i])) {
      return "DIRECT";
    }
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

The bad example never increments i.

Related rules