I am writing a custom .pac script for use with Firefox. Following numerous examples I've seen, I intersperse alert()s in order to debug it, but no alerts popup, even though the script is clearly being invoked. (I am clicking "Reload" in the "Connection settings" after each change to my script. I have even tried restarting Firefox.)
Are alerts supposed to work from PAC scripts? Maybe this is an IE-only feature?
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsProxyAutoConfig.js
The alert function is added to the sandbox:
And the mapped function calls dump, which goes to the Error Console:
You might need to disable "EnableAutoproxyResultCache" in the Windows registry . . .
Use
alert
function in your.pac
file.In Firefox Browser:
Tools -> Web Developer -> Browser Console (Ctrl+Shift+J) [This is not Web Console!!] -> Filter output:
PAC-alert
In Chrome Browser:
Go to
chrome://net-internals/#events
-> Search for a record with description:PAC_JAVASCRIPT_ALERT
(About Chrome thanks for this answer: https://serverfault.com/a/738871)
Sample
.pac
file:Ah Ha! The alert messages are getting logged to the console. I actually prefer that to alert popups anyway.