PAC-K001 · es2015-syntax

ES2015 to ES2017 syntax (let, const, arrow functions, template literals)

medium · Compatibility across engines

Chrome, Firefox and Windows accept ES2015 to ES2017 syntax such as let, const and arrow functions, but older engines (pactester builds up to 1.4, engines embedded in appliances and agents) fail to parse the whole file, and their traffic goes DIRECT.

Why it matters

A PAC is parsed by whatever JavaScript engine the consuming client embeds. Chromium (V8) and Firefox (SpiderMonkey) accept current ECMAScript. Older pactester (pacparser) builds and engines embedded in appliances and agents may not; for them const, let, => or back-tick strings are parse errors, which means mechanism (b) of the silent-DIRECT family for every client that uses such an engine. Nothing in a PAC needs ES2015; var and function declarations express everything.

Windows is not one of those engines. In the lab on Windows 11 (2026-10-11) let, const, arrow functions, classes, template strings, array spread, destructuring, async functions and generators all worked. Windows fails only on syntax newer than ES2017, such as ?., ?? or object spread; that is a separate and more serious finding (JavaScript syntax newer than ES2017).

The finding therefore lowers the compatibility score but does not cap the grade. Plain ES5 costs nothing and keeps the file working on every engine.

How to fix

Use var instead of let/const, function expressions instead of arrows, and string concatenation instead of template literals.

Examples

Bad

const PROXY_A = "PROXY proxy.corp.example:8080";
const isCorp = (h) => dnsDomainIs(h, ".corp.example");
function FindProxyForURL(url, host) {
  if (isCorp(host)) {
    return `DIRECT`;
  }
  return PROXY_A;
}
Open bad example in checker

Good

var PROXY_A = "PROXY proxy.corp.example:8080";
function isCorp(h) {
  return dnsDomainIs(h, ".corp.example");
}
function FindProxyForURL(url, host) {
  if (isCorp(host)) {
    return "DIRECT";
  }
  return PROXY_A;
}
Open good example in checker

Engine behaviour

EngineBehaviourSource
chromiumV8; current ECMAScript syntax parses.code, verified 2026-10-04 · ref
firefoxSpiderMonkey; current ECMAScript syntax parses.expert, unverified
pacparserDepends on the version. pacparser 1.5.0 and newer (QuickJS engine) accept ES2015 syntax such as let and arrow functions; 1.4.x (SpiderMonkey 1.7) rejects it, and the file does not load (lab, 1.5.3 and 1.4.6).lab, verified 2026-10-04
winhttpAbout ES2017. let, const, arrow functions, classes, template strings, destructuring, array spread, async functions and generators work; optional chaining (?.), ??, object spread, BigInt literals, regular-expression lookbehind and named groups are syntax errors, and then the whole file fails to load.lab, verified 2026-10-11

Source: code = read in the engine's source, doc = vendor documentation, lab = observed in a lab run, expert = practitioner knowledge, not yet verified.

Related rules

References

Last updated: