FindProxyForURL declared more than once
high
Two or more function declarations named FindProxyForURL. JavaScript keeps the last one; the others are dead code that still looks authoritative to a reader.
Why it matters
Function declarations are hoisted and later declarations overwrite earlier ones. When a
PAC contains two FindProxyForURL bodies (usually after merging two files or keeping an
old version “for reference”), the engine runs only the last one. Whoever edits the first
body sees no effect and may conclude the PAC is broken or cached.
How to fix
Keep exactly one FindProxyForURL; move alternative versions out of the file or into version control.
Examples
Bad
function FindProxyForURL(url, host) {
return "PROXY old-proxy.corp.example:8080";
}
function FindProxyForURL(url, host) {
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- No FindProxyForURL function PAC-E002