From a3486db352acce98b2ca5ea73ea5a62cdc1aaeac Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Mon, 15 Oct 2001 22:26:19 +0000 Subject: [PATCH] fixes bug 103979 "Crash if autoconfig proxies prefs enabled by the default" r=gagan,dougt sr=rpotts --- netwerk/base/src/nsProtocolProxyService.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp index cb16fce1586b..c49e5707ffd5 100644 --- a/netwerk/base/src/nsProtocolProxyService.cpp +++ b/netwerk/base/src/nsProtocolProxyService.cpp @@ -260,8 +260,11 @@ void PR_CALLBACK nsProtocolProxyService::HandlePACLoadEvent(PLEvent* aEvent) NS_ERROR("HandlePACLoadEvent owner is null"); return; } - if (!pps->mPAC) { - NS_ERROR("HandlePACLoadEvent: js PAC component is null"); + + // create pac js component + pps->mPAC = do_CreateInstance(NS_PROXY_AUTO_CONFIG_CONTRACTID, &rv); + if (!pps->mPAC || NS_FAILED(rv)) { + NS_ERROR("Cannot load PAC js component"); return; } @@ -382,9 +385,9 @@ nsProtocolProxyService::ExamineForProxy(nsIURI *aURI, nsIProxyInfo* *aResult) { if (2 == mUseProxy) { if (!mPAC) { - NS_ERROR("ERROR: PAC js component is null"); + NS_ERROR("ERROR: PAC js component is null, assuming DIRECT"); delete proxyInfo; - return NS_ERROR_NULL_POINTER; + return NS_OK; // assume DIRECT connection for now } rv = mPAC->ProxyForURL(aURI, @@ -490,13 +493,6 @@ nsProtocolProxyService::ConfigureFromPAC(const char *url) nsresult rv = NS_OK; mPACURL.Adopt(nsCRT::strdup(url)); - // create pac js component - mPAC = do_CreateInstance(NS_PROXY_AUTO_CONFIG_CONTRACTID, &rv); - if (!mPAC || NS_FAILED(rv)) { - NS_ERROR("Cannot load PAC js component"); - return rv; - } - /* now we need to setup a callback from the main ui thread in which we will load the pac file from the specified url. loading it now, in the current thread results in a