2005-03-25 06:41:33 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
#include "nsPACMan.h"
|
2015-03-26 10:11:05 +03:00
|
|
|
#include "mozIApplication.h"
|
|
|
|
#include "nsIAppsService.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2006-06-13 05:14:20 +04:00
|
|
|
#include "nsIAuthPrompt.h"
|
2010-06-17 04:06:17 +04:00
|
|
|
#include "nsIPromptFactory.h"
|
2006-06-13 05:14:20 +04:00
|
|
|
#include "nsIHttpChannel.h"
|
|
|
|
#include "nsIPrefService.h"
|
|
|
|
#include "nsIPrefBranch.h"
|
2005-03-25 06:41:33 +03:00
|
|
|
#include "nsNetUtil.h"
|
2010-08-05 06:15:55 +04:00
|
|
|
#include "nsIAsyncVerifyRedirectCallback.h"
|
2013-09-22 07:04:57 +04:00
|
|
|
#include "nsISystemProxySettings.h"
|
2015-02-17 21:09:31 +03:00
|
|
|
#include "nsContentUtils.h"
|
2013-10-15 13:43:08 +04:00
|
|
|
#ifdef MOZ_NUWA_PROCESS
|
|
|
|
#include "ipc/Nuwa.h"
|
|
|
|
#endif
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2012-09-15 00:27:46 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::net;
|
|
|
|
|
2013-11-21 02:55:44 +04:00
|
|
|
#undef LOG
|
2015-06-04 01:25:57 +03:00
|
|
|
#define LOG(args) MOZ_LOG(GetProxyLog(), mozilla::LogLevel::Debug, args)
|
2012-12-04 01:28:19 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// The PAC thread does evaluations of both PAC files and
|
|
|
|
// nsISystemProxySettings because they can both block the calling thread and we
|
|
|
|
// don't want that on the main thread
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2006-06-13 05:14:20 +04:00
|
|
|
// Check to see if the underlying request was not an error page in the case of
|
|
|
|
// a HTTP request. For other types of channels, just return true.
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool
|
2006-06-13 05:14:20 +04:00
|
|
|
HttpRequestSucceeded(nsIStreamLoader *loader)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIRequest> request;
|
|
|
|
loader->GetRequest(getter_AddRefs(request));
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool result = true; // default to assuming success
|
2006-06-13 05:14:20 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(request);
|
|
|
|
if (httpChannel)
|
|
|
|
httpChannel->GetRequestSucceeded(&result);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// The ExecuteCallback runnable is triggered by
|
|
|
|
// nsPACManCallback::OnQueryComplete on the Main thread when its completion is
|
|
|
|
// discovered on the pac thread
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class ExecuteCallback final : public nsRunnable
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
|
|
|
public:
|
2012-09-15 00:27:46 +04:00
|
|
|
ExecuteCallback(nsPACManCallback *aCallback,
|
|
|
|
nsresult status)
|
|
|
|
: mCallback(aCallback)
|
|
|
|
, mStatus(status)
|
|
|
|
{
|
|
|
|
}
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
void SetPACString(const nsCString &pacString)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
2012-09-15 00:27:46 +04:00
|
|
|
mPACString = pacString;
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
void SetPACURL(const nsCString &pacURL)
|
|
|
|
{
|
|
|
|
mPACURL = pacURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
|
|
|
mCallback->OnQueryComplete(mStatus, mPACString, mPACURL);
|
|
|
|
mCallback = nullptr;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<nsPACManCallback> mCallback;
|
2012-09-15 00:27:46 +04:00
|
|
|
nsresult mStatus;
|
|
|
|
nsCString mPACString;
|
|
|
|
nsCString mPACURL;
|
2005-03-25 06:41:33 +03:00
|
|
|
};
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
//-----------------------------------------------------------------------------
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// The PAC thread must be deleted from the main thread, this class
|
|
|
|
// acts as a proxy to do that, as the PACMan is reference counted
|
|
|
|
// and might be destroyed on either thread
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class ShutdownThread final : public nsRunnable
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
2012-09-15 00:27:46 +04:00
|
|
|
public:
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit ShutdownThread(nsIThread *thread)
|
2012-09-15 00:27:46 +04:00
|
|
|
: mThread(thread)
|
|
|
|
{
|
|
|
|
}
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
mThread->Shutdown();
|
|
|
|
return NS_OK;
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIThread> mThread;
|
|
|
|
};
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2014-08-14 09:59:00 +04:00
|
|
|
// Dispatch this to wait until the PAC thread shuts down.
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class WaitForThreadShutdown final : public nsRunnable
|
2014-08-14 09:59:00 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit WaitForThreadShutdown(nsPACMan *aPACMan)
|
|
|
|
: mPACMan(aPACMan)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2014-08-14 09:59:00 +04:00
|
|
|
if (mPACMan->mPACThread) {
|
|
|
|
mPACMan->mPACThread->Shutdown();
|
|
|
|
mPACMan->mPACThread = nullptr;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<nsPACMan> mPACMan;
|
|
|
|
};
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// PACLoadComplete allows the PAC thread to tell the main thread that
|
|
|
|
// the javascript PAC file has been installed (perhaps unsuccessfully)
|
|
|
|
// and that there is no reason to queue executions anymore
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PACLoadComplete final : public nsRunnable
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit PACLoadComplete(nsPACMan *aPACMan)
|
2012-09-15 00:27:46 +04:00
|
|
|
: mPACMan(aPACMan)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
mPACMan->mLoader = nullptr;
|
|
|
|
mPACMan->PostProcessPendingQ();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<nsPACMan> mPACMan;
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// ExecutePACThreadAction is used to proxy actions from the main
|
|
|
|
// thread onto the PAC thread. There are 3 options: process the queue,
|
|
|
|
// cancel the queue, and setup the javascript context with a new PAC file
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class ExecutePACThreadAction final : public nsRunnable
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// by default we just process the queue
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit ExecutePACThreadAction(nsPACMan *aPACMan)
|
2012-09-15 00:27:46 +04:00
|
|
|
: mPACMan(aPACMan)
|
|
|
|
, mCancel(false)
|
|
|
|
, mSetupPAC(false)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
void CancelQueue (nsresult status)
|
|
|
|
{
|
|
|
|
mCancel = true;
|
|
|
|
mCancelStatus = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetupPAC (const char *text, uint32_t datalen, nsCString &pacURI)
|
|
|
|
{
|
|
|
|
mSetupPAC = true;
|
|
|
|
mSetupPACData.Assign(text, datalen);
|
|
|
|
mSetupPACURI = pacURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP Run()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
if (mCancel) {
|
|
|
|
mPACMan->CancelPendingQ(mCancelStatus);
|
|
|
|
mCancel = false;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mSetupPAC) {
|
|
|
|
mSetupPAC = false;
|
|
|
|
|
|
|
|
mPACMan->mPAC.Init(mSetupPACURI,
|
|
|
|
mSetupPACData);
|
|
|
|
|
|
|
|
nsRefPtr<PACLoadComplete> runnable = new PACLoadComplete(mPACMan);
|
2014-05-23 23:53:17 +04:00
|
|
|
NS_DispatchToMainThread(runnable);
|
2012-09-15 00:27:46 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
mPACMan->ProcessPendingQ();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<nsPACMan> mPACMan;
|
|
|
|
|
|
|
|
bool mCancel;
|
|
|
|
nsresult mCancelStatus;
|
|
|
|
|
|
|
|
bool mSetupPAC;
|
|
|
|
nsCString mSetupPACData;
|
|
|
|
nsCString mSetupPACURI;
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
|
2015-03-26 10:11:05 +03:00
|
|
|
uint32_t appId, bool isInBrowser,
|
2012-09-15 00:27:46 +04:00
|
|
|
nsPACManCallback *callback,
|
|
|
|
bool mainThreadResponse)
|
|
|
|
: mPACMan(pacMan)
|
2015-03-26 10:11:05 +03:00
|
|
|
, mAppId(appId)
|
|
|
|
, mIsInBrowser(isInBrowser)
|
2012-09-15 00:27:46 +04:00
|
|
|
, mCallback(callback)
|
|
|
|
, mOnMainThreadOnly(mainThreadResponse)
|
|
|
|
{
|
|
|
|
uri->GetAsciiSpec(mSpec);
|
|
|
|
uri->GetAsciiHost(mHost);
|
|
|
|
uri->GetScheme(mScheme);
|
|
|
|
uri->GetPort(&mPort);
|
2015-03-26 10:11:05 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIAppsService> appsService =
|
|
|
|
do_GetService(APPS_SERVICE_CONTRACTID);
|
|
|
|
if (!appsService) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsCOMPtr<mozIApplication> mozApp;
|
|
|
|
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(mozApp));
|
|
|
|
if (NS_FAILED(rv) || !mozApp) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mozApp->GetOrigin(mAppOrigin);
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PendingPACQuery::Complete(nsresult status, const nsCString &pacString)
|
|
|
|
{
|
|
|
|
if (!mCallback)
|
|
|
|
return;
|
2012-09-15 00:27:46 +04:00
|
|
|
nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, status);
|
|
|
|
runnable->SetPACString(pacString);
|
|
|
|
if (mOnMainThreadOnly)
|
2014-05-23 23:53:17 +04:00
|
|
|
NS_DispatchToMainThread(runnable);
|
2012-09-15 00:27:46 +04:00
|
|
|
else
|
|
|
|
runnable->Run();
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
2012-09-14 01:42:29 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
void
|
|
|
|
PendingPACQuery::UseAlternatePACFile(const nsCString &pacURL)
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
2012-09-17 19:54:09 +04:00
|
|
|
if (!mCallback)
|
2012-09-15 00:27:46 +04:00
|
|
|
return;
|
2012-09-17 19:54:09 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, NS_OK);
|
|
|
|
runnable->SetPACURL(pacURL);
|
|
|
|
if (mOnMainThreadOnly)
|
2014-05-23 23:53:17 +04:00
|
|
|
NS_DispatchToMainThread(runnable);
|
2012-09-15 00:27:46 +04:00
|
|
|
else
|
|
|
|
runnable->Run();
|
|
|
|
}
|
2012-09-17 19:54:09 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PendingPACQuery::Run()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
mPACMan->PostQuery(this);
|
2005-03-25 06:41:33 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2014-08-07 19:38:41 +04:00
|
|
|
static bool sThreadLocalSetup = false;
|
|
|
|
static uint32_t sThreadLocalIndex = 0xdeadbeef; // out of range
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
nsPACMan::nsPACMan()
|
2011-10-17 18:59:28 +04:00
|
|
|
: mLoadPending(false)
|
|
|
|
, mShutdown(false)
|
2006-06-13 05:14:20 +04:00
|
|
|
, mLoadFailureCount(0)
|
2012-09-15 00:27:46 +04:00
|
|
|
, mInProgress(false)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "pacman must be created on main thread");
|
2014-08-07 19:38:41 +04:00
|
|
|
if (!sThreadLocalSetup){
|
|
|
|
sThreadLocalSetup = true;
|
|
|
|
PR_NewThreadPrivateIndex(&sThreadLocalIndex, nullptr);
|
|
|
|
}
|
|
|
|
mPAC.SetThreadLocalIndex(sThreadLocalIndex);
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsPACMan::~nsPACMan()
|
|
|
|
{
|
2012-09-15 00:27:46 +04:00
|
|
|
if (mPACThread) {
|
|
|
|
if (NS_IsMainThread()) {
|
|
|
|
mPACThread->Shutdown();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsRefPtr<ShutdownThread> runnable = new ShutdownThread(mPACThread);
|
2014-05-23 23:53:17 +04:00
|
|
|
NS_DispatchToMainThread(runnable);
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
NS_ASSERTION(mLoader == nullptr, "pac man not shutdown properly");
|
2012-09-15 00:27:46 +04:00
|
|
|
NS_ASSERTION(mPendingQ.isEmpty(), "pac man not shutdown properly");
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsPACMan::Shutdown()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "pacman must be shutdown on main thread");
|
2014-08-14 09:59:00 +04:00
|
|
|
if (mShutdown) {
|
|
|
|
return;
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
mShutdown = true;
|
2014-08-14 09:59:00 +04:00
|
|
|
CancelExistingLoad();
|
2012-09-15 00:27:46 +04:00
|
|
|
PostCancelPendingQ(NS_ERROR_ABORT);
|
2014-08-14 09:59:00 +04:00
|
|
|
|
|
|
|
nsRefPtr<WaitForThreadShutdown> runnable = new WaitForThreadShutdown(this);
|
|
|
|
NS_DispatchToMainThread(runnable);
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2015-03-26 10:11:05 +03:00
|
|
|
nsPACMan::AsyncGetProxyForURI(nsIURI *uri, uint32_t appId,
|
|
|
|
bool isInBrowser, nsPACManCallback *callback,
|
2012-09-15 00:27:46 +04:00
|
|
|
bool mainThreadResponse)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
if (mShutdown)
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
|
|
|
|
// Maybe Reload PAC
|
2012-12-04 01:28:19 +04:00
|
|
|
if (!mPACURISpec.IsEmpty() && !mScheduledReload.IsNull() &&
|
2012-09-15 00:27:46 +04:00
|
|
|
TimeStamp::Now() > mScheduledReload)
|
2012-12-04 01:28:19 +04:00
|
|
|
LoadPACFromURI(EmptyCString());
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
nsRefPtr<PendingPACQuery> query =
|
2015-03-26 10:11:05 +03:00
|
|
|
new PendingPACQuery(this, uri, appId, isInBrowser, callback,
|
|
|
|
mainThreadResponse);
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2005-07-01 00:21:34 +04:00
|
|
|
if (IsPACURI(uri)) {
|
2012-09-15 00:27:46 +04:00
|
|
|
// deal with this directly instead of queueing it
|
|
|
|
query->Complete(NS_OK, EmptyCString());
|
2005-06-25 03:58:25 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
return mPACThread->Dispatch(query, nsIEventTarget::DISPATCH_NORMAL);
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-09-15 00:27:46 +04:00
|
|
|
nsPACMan::PostQuery(PendingPACQuery *query)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
if (mShutdown) {
|
|
|
|
query->Complete(NS_ERROR_NOT_AVAILABLE, EmptyCString());
|
2005-03-25 06:41:33 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// add a reference to the query while it is in the pending list
|
|
|
|
nsRefPtr<PendingPACQuery> addref(query);
|
2014-03-15 23:00:15 +04:00
|
|
|
mPendingQ.insertBack(addref.forget().take());
|
2012-09-15 00:27:46 +04:00
|
|
|
ProcessPendingQ();
|
|
|
|
return NS_OK;
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-12-04 01:28:19 +04:00
|
|
|
nsPACMan::LoadPACFromURI(const nsCString &spec)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_STATE(!mShutdown);
|
2012-12-04 01:28:19 +04:00
|
|
|
NS_ENSURE_ARG(!spec.IsEmpty() || !mPACURISpec.IsEmpty());
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIStreamLoader> loader =
|
|
|
|
do_CreateInstance(NS_STREAMLOADER_CONTRACTID);
|
|
|
|
NS_ENSURE_STATE(loader);
|
|
|
|
|
|
|
|
// Since we might get called from nsProtocolProxyService::Init, we need to
|
|
|
|
// post an event back to the main thread before we try to use the IO service.
|
|
|
|
//
|
|
|
|
// But, we need to flag ourselves as loading, so that we queue up any PAC
|
|
|
|
// queries the enter between now and when we actually load the PAC file.
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
if (!mLoadPending) {
|
|
|
|
nsCOMPtr<nsIRunnable> event =
|
2010-04-21 03:21:35 +04:00
|
|
|
NS_NewRunnableMethod(this, &nsPACMan::StartLoading);
|
2006-05-10 21:30:15 +04:00
|
|
|
nsresult rv;
|
|
|
|
if (NS_FAILED(rv = NS_DispatchToCurrentThread(event)))
|
2005-03-25 06:41:33 +03:00
|
|
|
return rv;
|
2011-10-17 18:59:28 +04:00
|
|
|
mLoadPending = true;
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
CancelExistingLoad();
|
|
|
|
|
|
|
|
mLoader = loader;
|
2012-12-04 01:28:19 +04:00
|
|
|
if (!spec.IsEmpty()) {
|
|
|
|
mPACURISpec = spec;
|
2013-01-02 01:05:07 +04:00
|
|
|
mPACURIRedirectSpec.Truncate();
|
2013-02-12 22:29:27 +04:00
|
|
|
mNormalPACURISpec.Truncate(); // set at load time
|
2006-06-13 05:14:20 +04:00
|
|
|
mLoadFailureCount = 0; // reset
|
|
|
|
}
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
// reset to Null
|
|
|
|
mScheduledReload = TimeStamp();
|
2005-03-25 06:41:33 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
void
|
2005-03-25 06:41:33 +03:00
|
|
|
nsPACMan::StartLoading()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2011-10-17 18:59:28 +04:00
|
|
|
mLoadPending = false;
|
2006-05-10 21:30:15 +04:00
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
// CancelExistingLoad was called...
|
|
|
|
if (!mLoader) {
|
2012-09-15 00:27:46 +04:00
|
|
|
PostCancelPendingQ(NS_ERROR_ABORT);
|
2006-05-10 21:30:15 +04:00
|
|
|
return;
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
2015-05-04 17:17:47 +03:00
|
|
|
if (NS_SUCCEEDED(mLoader->Init(this, nullptr))) {
|
2006-10-25 01:47:40 +04:00
|
|
|
// Always hit the origin server when loading PAC.
|
|
|
|
nsCOMPtr<nsIIOService> ios = do_GetIOService();
|
|
|
|
if (ios) {
|
|
|
|
nsCOMPtr<nsIChannel> channel;
|
2012-12-04 01:28:19 +04:00
|
|
|
nsCOMPtr<nsIURI> pacURI;
|
|
|
|
NS_NewURI(getter_AddRefs(pacURI), mPACURISpec);
|
2006-10-25 01:47:40 +04:00
|
|
|
|
|
|
|
// NOTE: This results in GetProxyForURI being called
|
2012-12-04 01:28:19 +04:00
|
|
|
if (pacURI) {
|
2013-02-12 22:29:27 +04:00
|
|
|
pacURI->GetSpec(mNormalPACURISpec);
|
2015-02-17 21:09:31 +03:00
|
|
|
NS_NewChannel(getter_AddRefs(channel),
|
|
|
|
pacURI,
|
|
|
|
nsContentUtils::GetSystemPrincipal(),
|
|
|
|
nsILoadInfo::SEC_NORMAL,
|
|
|
|
nsIContentPolicy::TYPE_OTHER,
|
|
|
|
nullptr, // aLoadGroup
|
|
|
|
nullptr, // aCallbacks
|
|
|
|
nsIRequest::LOAD_NORMAL,
|
|
|
|
ios);
|
2012-12-04 01:28:19 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
LOG(("nsPACMan::StartLoading Failed pacspec uri conversion %s\n",
|
|
|
|
mPACURISpec.get()));
|
|
|
|
}
|
2006-10-25 01:47:40 +04:00
|
|
|
|
|
|
|
if (channel) {
|
|
|
|
channel->SetLoadFlags(nsIRequest::LOAD_BYPASS_CACHE);
|
|
|
|
channel->SetNotificationCallbacks(this);
|
2012-07-30 18:20:58 +04:00
|
|
|
if (NS_SUCCEEDED(channel->AsyncOpen(mLoader, nullptr)))
|
2006-10-25 01:47:40 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CancelExistingLoad();
|
2012-09-15 00:27:46 +04:00
|
|
|
PostCancelPendingQ(NS_ERROR_UNEXPECTED);
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
2006-06-13 05:14:20 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
nsPACMan::OnLoadFailure()
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t minInterval = 5; // 5 seconds
|
|
|
|
int32_t maxInterval = 300; // 5 minutes
|
2006-06-13 05:14:20 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
|
|
|
if (prefs) {
|
|
|
|
prefs->GetIntPref("network.proxy.autoconfig_retry_interval_min",
|
|
|
|
&minInterval);
|
|
|
|
prefs->GetIntPref("network.proxy.autoconfig_retry_interval_max",
|
|
|
|
&maxInterval);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t interval = minInterval << mLoadFailureCount++; // seconds
|
2006-06-13 05:14:20 +04:00
|
|
|
if (!interval || interval > maxInterval)
|
|
|
|
interval = maxInterval;
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
mScheduledReload = TimeStamp::Now() + TimeDuration::FromSeconds(interval);
|
2006-06-13 05:14:20 +04:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// while we wait for the retry queued members should try direct
|
|
|
|
// even if that means fast failure.
|
|
|
|
PostCancelPendingQ(NS_ERROR_NOT_AVAILABLE);
|
2006-06-13 05:14:20 +04:00
|
|
|
}
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
void
|
|
|
|
nsPACMan::CancelExistingLoad()
|
|
|
|
{
|
|
|
|
if (mLoader) {
|
|
|
|
nsCOMPtr<nsIRequest> request;
|
|
|
|
mLoader->GetRequest(getter_AddRefs(request));
|
|
|
|
if (request)
|
|
|
|
request->Cancel(NS_ERROR_ABORT);
|
2012-07-30 18:20:58 +04:00
|
|
|
mLoader = nullptr;
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-09-15 00:27:46 +04:00
|
|
|
nsPACMan::PostProcessPendingQ()
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
nsRefPtr<ExecutePACThreadAction> pending =
|
|
|
|
new ExecutePACThreadAction(this);
|
|
|
|
if (mPACThread)
|
|
|
|
mPACThread->Dispatch(pending, nsIEventTarget::DISPATCH_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsPACMan::PostCancelPendingQ(nsresult status)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
nsRefPtr<ExecutePACThreadAction> pending =
|
|
|
|
new ExecutePACThreadAction(this);
|
|
|
|
pending->CancelQueue(status);
|
|
|
|
if (mPACThread)
|
|
|
|
mPACThread->Dispatch(pending, nsIEventTarget::DISPATCH_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsPACMan::CancelPendingQ(nsresult status)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
nsRefPtr<PendingPACQuery> query;
|
|
|
|
|
|
|
|
while (!mPendingQ.isEmpty()) {
|
|
|
|
query = dont_AddRef(mPendingQ.popLast());
|
|
|
|
query->Complete(status, EmptyCString());
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
if (mShutdown)
|
|
|
|
mPAC.Shutdown();
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
void
|
|
|
|
nsPACMan::ProcessPendingQ()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
while (ProcessPending());
|
|
|
|
|
2014-08-14 09:59:00 +04:00
|
|
|
if (mShutdown) {
|
2012-09-15 00:27:46 +04:00
|
|
|
mPAC.Shutdown();
|
2014-08-14 09:59:00 +04:00
|
|
|
} else {
|
|
|
|
// do GC while the thread has nothing pending
|
|
|
|
mPAC.GC();
|
|
|
|
}
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// returns true if progress was made by shortening the queue
|
|
|
|
bool
|
|
|
|
nsPACMan::ProcessPending()
|
|
|
|
{
|
|
|
|
if (mPendingQ.isEmpty())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// queue during normal load, but if we are retrying a failed load then
|
|
|
|
// fast fail the queries
|
|
|
|
if (mInProgress || (IsLoading() && !mLoadFailureCount))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
nsRefPtr<PendingPACQuery> query(dont_AddRef(mPendingQ.popFirst()));
|
|
|
|
|
|
|
|
if (mShutdown || IsLoading()) {
|
|
|
|
query->Complete(NS_ERROR_NOT_AVAILABLE, EmptyCString());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoCString pacString;
|
|
|
|
bool completed = false;
|
|
|
|
mInProgress = true;
|
|
|
|
nsAutoCString PACURI;
|
|
|
|
|
|
|
|
// first we need to consider the system proxy changing the pac url
|
|
|
|
if (mSystemProxySettings &&
|
|
|
|
NS_SUCCEEDED(mSystemProxySettings->GetPACURI(PACURI)) &&
|
|
|
|
!PACURI.IsEmpty() &&
|
|
|
|
!PACURI.Equals(mPACURISpec)) {
|
|
|
|
query->UseAlternatePACFile(PACURI);
|
|
|
|
completed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// now try the system proxy settings for this particular url if
|
|
|
|
// PAC was not specified
|
|
|
|
if (!completed && mSystemProxySettings && PACURI.IsEmpty() &&
|
|
|
|
NS_SUCCEEDED(mSystemProxySettings->
|
|
|
|
GetProxyForURI(query->mSpec, query->mScheme,
|
|
|
|
query->mHost, query->mPort,
|
|
|
|
pacString))) {
|
|
|
|
query->Complete(NS_OK, pacString);
|
|
|
|
completed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// the systemproxysettings didn't complete the resolution. try via PAC
|
|
|
|
if (!completed) {
|
2015-03-26 10:11:05 +03:00
|
|
|
nsresult status = mPAC.GetProxyForURI(query->mSpec, query->mHost,
|
|
|
|
query->mAppId, query->mAppOrigin,
|
|
|
|
query->mIsInBrowser,
|
|
|
|
pacString);
|
2012-09-15 00:27:46 +04:00
|
|
|
query->Complete(status, pacString);
|
|
|
|
}
|
|
|
|
|
|
|
|
mInProgress = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsPACMan, nsIStreamLoaderObserver,
|
|
|
|
nsIInterfaceRequestor, nsIChannelEventSink)
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPACMan::OnStreamComplete(nsIStreamLoader *loader,
|
|
|
|
nsISupports *context,
|
|
|
|
nsresult status,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t dataLen,
|
|
|
|
const uint8_t *data)
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2005-03-25 06:41:33 +03:00
|
|
|
if (mLoader != loader) {
|
|
|
|
// If this happens, then it means that LoadPACFromURI was called more
|
|
|
|
// than once before the initial call completed. In this case, status
|
|
|
|
// should be NS_ERROR_ABORT, and if so, then we know that we can and
|
|
|
|
// should delay any processing.
|
|
|
|
if (status == NS_ERROR_ABORT)
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-13 05:14:20 +04:00
|
|
|
if (NS_SUCCEEDED(status) && HttpRequestSucceeded(loader)) {
|
2005-03-25 06:41:33 +03:00
|
|
|
// Get the URI spec used to load this PAC script.
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString pacURI;
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIRequest> request;
|
|
|
|
loader->GetRequest(getter_AddRefs(request));
|
|
|
|
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
|
|
|
if (channel) {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
channel->GetURI(getter_AddRefs(uri));
|
|
|
|
if (uri)
|
|
|
|
uri->GetAsciiSpec(pacURI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// We assume that the PAC text is ASCII (or ISO-Latin-1). We've had this
|
|
|
|
// assumption forever, and some real-world PAC scripts actually have some
|
|
|
|
// non-ASCII text in comment blocks (see bug 296163).
|
|
|
|
const char *text = (const char *) data;
|
|
|
|
|
|
|
|
// we have succeeded in loading the pac file using a bunch of interfaces that
|
|
|
|
// are main thread only, unfortunately we have to initialize the instance of
|
|
|
|
// the PAC evaluator (NS_PROXYAUTOCONFIG_CONTRACTID) on the pac thread, because
|
|
|
|
// that is where it will be used.
|
|
|
|
|
|
|
|
nsRefPtr<ExecutePACThreadAction> pending =
|
|
|
|
new ExecutePACThreadAction(this);
|
|
|
|
pending->SetupPAC(text, dataLen, pacURI);
|
|
|
|
if (mPACThread)
|
|
|
|
mPACThread->Dispatch(pending, nsIEventTarget::DISPATCH_NORMAL);
|
2006-06-13 05:14:20 +04:00
|
|
|
|
|
|
|
// Even if the PAC file could not be parsed, we did succeed in loading the
|
|
|
|
// data for it.
|
|
|
|
mLoadFailureCount = 0;
|
|
|
|
} else {
|
|
|
|
// We were unable to load the PAC file (presumably because of a network
|
|
|
|
// failure). Try again a little later.
|
|
|
|
OnLoadFailure();
|
2005-03-25 06:41:33 +03:00
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
if (NS_SUCCEEDED(status))
|
|
|
|
PostProcessPendingQ();
|
|
|
|
else
|
|
|
|
PostCancelPendingQ(status);
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPACMan::GetInterface(const nsIID &iid, void **result)
|
|
|
|
{
|
|
|
|
// In case loading the PAC file requires authentication.
|
2010-06-17 04:06:17 +04:00
|
|
|
if (iid.Equals(NS_GET_IID(nsIAuthPrompt))) {
|
|
|
|
nsCOMPtr<nsIPromptFactory> promptFac = do_GetService("@mozilla.org/prompter;1");
|
|
|
|
NS_ENSURE_TRUE(promptFac, NS_ERROR_FAILURE);
|
2012-07-30 18:20:58 +04:00
|
|
|
return promptFac->GetPrompt(nullptr, iid, reinterpret_cast<void**>(result));
|
2010-06-17 04:06:17 +04:00
|
|
|
}
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2005-07-01 00:21:34 +04:00
|
|
|
// In case loading the PAC file results in a redirect.
|
|
|
|
if (iid.Equals(NS_GET_IID(nsIChannelEventSink))) {
|
|
|
|
NS_ADDREF_THIS();
|
2007-07-08 11:08:04 +04:00
|
|
|
*result = static_cast<nsIChannelEventSink *>(this);
|
2005-07-01 00:21:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
return NS_ERROR_NO_INTERFACE;
|
|
|
|
}
|
2005-07-01 00:21:34 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-08-05 06:15:55 +04:00
|
|
|
nsPACMan::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t flags,
|
2010-08-05 06:15:55 +04:00
|
|
|
nsIAsyncVerifyRedirectCallback *callback)
|
2005-07-01 00:21:34 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
2012-12-04 01:28:19 +04:00
|
|
|
|
2010-08-05 06:15:55 +04:00
|
|
|
nsresult rv = NS_OK;
|
2012-12-04 01:28:19 +04:00
|
|
|
nsCOMPtr<nsIURI> pacURI;
|
|
|
|
if (NS_FAILED((rv = newChannel->GetURI(getter_AddRefs(pacURI)))))
|
|
|
|
return rv;
|
2013-01-02 01:05:07 +04:00
|
|
|
|
|
|
|
rv = pacURI->GetSpec(mPACURIRedirectSpec);
|
2012-12-04 01:28:19 +04:00
|
|
|
if (NS_FAILED(rv))
|
2010-08-05 06:15:55 +04:00
|
|
|
return rv;
|
|
|
|
|
2013-01-02 01:05:07 +04:00
|
|
|
LOG(("nsPACMan redirect from original %s to redirected %s\n",
|
|
|
|
mPACURISpec.get(), mPACURIRedirectSpec.get()));
|
|
|
|
|
|
|
|
// do not update mPACURISpec - that needs to stay as the
|
|
|
|
// configured URI so that we can determine when the config changes.
|
|
|
|
// However do track the most recent URI in the redirect change
|
|
|
|
// as mPACURIRedirectSpec so that URI can be allowed to bypass
|
|
|
|
// the proxy and actually fetch the pac file.
|
|
|
|
|
2010-08-05 06:15:55 +04:00
|
|
|
callback->OnRedirectVerifyCallback(NS_OK);
|
|
|
|
return NS_OK;
|
2005-07-01 00:21:34 +04:00
|
|
|
}
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
nsPACMan::NamePACThread()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
|
2012-09-15 00:27:46 +04:00
|
|
|
PR_SetCurrentThreadName("Proxy Resolution");
|
2013-10-15 13:43:08 +04:00
|
|
|
#ifdef MOZ_NUWA_PROCESS
|
|
|
|
if (IsNuwaProcess()) {
|
|
|
|
NuwaMarkCurrentThread(nullptr, nullptr);
|
|
|
|
}
|
|
|
|
#endif
|
2012-09-15 00:27:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsPACMan::Init(nsISystemProxySettings *systemProxySettings)
|
|
|
|
{
|
|
|
|
mSystemProxySettings = systemProxySettings;
|
|
|
|
|
|
|
|
nsresult rv = NS_NewThread(getter_AddRefs(mPACThread), nullptr);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &nsPACMan::NamePACThread);
|
|
|
|
// don't check return value as it is not a big deal for this to fail.
|
|
|
|
mPACThread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-11-21 02:55:44 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
PRLogModuleInfo*
|
|
|
|
GetProxyLog()
|
|
|
|
{
|
|
|
|
static PRLogModuleInfo *sLog;
|
|
|
|
if (!sLog)
|
|
|
|
sLog = PR_NewLogModule("proxy");
|
|
|
|
return sLog;
|
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|