Chr*_*Noe 9 javascript firefox autoproxy pac
我正在编写一个用于Firefox的自定义.pac脚本.根据我见过的众多例子,我为了调试它而散布alert(),但是没有警报弹出,即使脚本被明确调用.(我在每次更改脚本后点击"连接设置"中的"重新加载".我甚至尝试重启Firefox.)
警报是否应该来自PAC脚本?也许这是一个仅限IE的功能?
ben*_*enc 10
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsProxyAutoConfig.js
警报功能已添加到沙箱中:
80 // add predefined functions to pac
81 this._sandBox.importFunction(myIpAddress);
82 this._sandBox.importFunction(dnsResolve);
83 this._sandBox.importFunction(proxyAlert, "alert");
Run Code Online (Sandbox Code Playgroud)
映射函数调用dump,它转到错误控制台:
108 function proxyAlert(msg) {
109 msg = XPCSafeJSObjectWrapper(msg);
110 try {
111 // It would appear that the console service is threadsafe.
112 var cns = Components.classes["@mozilla.org/consoleservice;1"]
113 .getService(Components.interfaces.nsIConsoleService);
114 cns.logStringMessage("PAC-alert: "+msg);
115 } catch (e) {
116 dump("PAC: proxyAlert ERROR: "+e+"\n");
117 }
Run Code Online (Sandbox Code Playgroud)
Mir*_*ili 10
alert在.pac文件中使用函数。
在火狐浏览器中:
工具-> Web 开发人员->浏览器控制台 (Ctrl+Shift+J) [这不是Web 控制台!!] -> 过滤输出:PAC-alert
在Chrome浏览器中:
转到chrome://net-internals/#events -> 搜索带有描述的记录:PAC_JAVASCRIPT_ALERT
(关于 Chrome,感谢这个回答)
示例.pac文件:
function FindProxyForURL(url, host) {
alert("url = " + url + " *** host = " + host + " *** Resolved IP = " + dnsResolve(host));
return "DIRECT";
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14437 次 |
| 最近记录: |