bug 795905 call proxyservice::asyncresolve() when direct in case of filters r=biesi

--HG--
extra : rebase_source : c0d97222a8c5bad3ed8120c5a5a9cfdb7d3b8d6f
This commit is contained in:
Patrick McManus 2012-10-04 15:08:26 -04:00
parent 9de23bad9e
commit e3e41e365c
3 changed files with 21 additions and 13 deletions

View File

@ -1768,13 +1768,10 @@ nsFtpState::Init(nsFtpChannel *channel)
// Lookup Proxy information asynchronously if it isn't already set
// on the channel and if we aren't configured explicitly to go directly
uint32_t proxyConfigType;
nsCOMPtr<nsIProtocolProxyService> pps =
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID);
if (pps && !mChannel->ProxyInfo() &&
NS_SUCCEEDED(pps->GetProxyConfigType(&proxyConfigType)) &&
proxyConfigType != nsIProtocolProxyService::PROXYCONFIG_DIRECT) {
if (pps && !mChannel->ProxyInfo()) {
pps->AsyncResolve(mChannel->URI(), 0, this,
getter_AddRefs(mProxyRequest));
}

View File

@ -1727,14 +1727,6 @@ nsHttpChannel::ResolveProxy()
if (NS_FAILED(rv))
return rv;
// Check if we are configured to directly connect. This will save us
// a round trip through the event dispatch system
uint32_t proxyConfigType;
if (NS_SUCCEEDED(pps->GetProxyConfigType(&proxyConfigType)) &&
proxyConfigType == nsIProtocolProxyService::PROXYCONFIG_DIRECT) {
return NS_ERROR_FAILURE;
}
return pps->AsyncResolve(mProxyURI ? mProxyURI : mURI, mProxyResolveFlags,
this, getter_AddRefs(mProxyRequest));
}

View File

@ -616,15 +616,34 @@ function run_failed_script_test()
var req = pps.asyncResolve(uri, 0, cb);
}
var directFilter;
function failed_script_callback(pi)
{
// we should go direct
do_check_eq(pi, null);
// test that we honor filters when configured to go direct
prefs.setIntPref("network.proxy.type", 0);
do_test_finished();
directFilter = new TestFilter("http", "127.0.0.1", 7246, 0, 0);
pps.registerFilter(directFilter, 10);
var chan = ios.newChannel("http://127.0.0.1:7247", "", null);
chan.asyncOpen(directFilterListener, chan);
}
var directFilterListener = {
onStartRequest: function test_onStart(request, ctx) { },
onDataAvailable: function test_OnData() { },
onStopRequest: function test_onStop(request, ctx, status) {
ctx.QueryInterface(Components.interfaces.nsIProxiedChannel);
check_proxy(ctx.proxyInfo, "http", "127.0.0.1", 7246, 0, 0, false);
pps.unregisterFilter(directFilter);
do_test_finished();
},
};
function run_deprecated_sync_test()
{
var uri = ios.newURI("http://www.mozilla.org/", null, null);