mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
bug 829646 PAC mIPAddress() problem outside of FindProxyForURL() r=biesi
This commit is contained in:
parent
6a5e7ea70a
commit
0342bdd3c7
@ -586,6 +586,7 @@ ProxyAutoConfig::SetupJS()
|
||||
|
||||
JSAutoRequest ar(mJSRuntime->Context());
|
||||
|
||||
sRunning = this;
|
||||
JSScript *script = JS_CompileScript(mJSRuntime->Context(),
|
||||
mJSRuntime->Global(),
|
||||
mPACScript.get(), mPACScript.Length(),
|
||||
@ -595,8 +596,10 @@ ProxyAutoConfig::SetupJS()
|
||||
nsString alertMessage(NS_LITERAL_STRING("PAC file failed to install from "));
|
||||
alertMessage += NS_ConvertUTF8toUTF16(mPACURI);
|
||||
PACLogToConsole(alertMessage);
|
||||
sRunning = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
sRunning = nullptr;
|
||||
|
||||
mJSRuntime->SetOK();
|
||||
nsString alertMessage(NS_LITERAL_STRING("PAC file installed from "));
|
||||
|
@ -597,7 +597,41 @@ function myipaddress_callback(pi)
|
||||
do_check_neq(pi.host, null);
|
||||
do_check_neq(pi.host, "127.0.0.1");
|
||||
do_check_neq(pi.host, "::1");
|
||||
|
||||
run_myipaddress_test_2();
|
||||
}
|
||||
|
||||
function run_myipaddress_test_2()
|
||||
{
|
||||
// test that myIPAddress() can be used outside of the scope of
|
||||
// FindProxyForURL(). bug 829646.
|
||||
|
||||
var pac = 'data:text/plain,' +
|
||||
'var myaddr = myIpAddress(); ' +
|
||||
'function FindProxyForURL(url, host) {' +
|
||||
' return "PROXY " + myaddr + ":5678";' +
|
||||
'}';
|
||||
|
||||
var uri = ios.newURI("http://www.mozilla.org/", null, null);
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = myipaddress2_callback;
|
||||
var req = pps.asyncResolve(uri, 0, cb);
|
||||
}
|
||||
|
||||
function myipaddress2_callback(pi)
|
||||
{
|
||||
do_check_neq(pi, null);
|
||||
do_check_eq(pi.type, "http");
|
||||
do_check_eq(pi.port, 5678);
|
||||
|
||||
// make sure we didn't return localhost
|
||||
do_check_neq(pi.host, null);
|
||||
do_check_neq(pi.host, "127.0.0.1");
|
||||
do_check_neq(pi.host, "::1");
|
||||
|
||||
run_failed_script_test();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user