Bug 1274376 - more mozilla::net namespaces r=dragana

--HG--
extra : rebase_source : 914d48f23a4a5db052a789b9e21c1ff922533d35
This commit is contained in:
Patrick McManus 2016-05-18 22:02:57 -04:00
parent e013fac160
commit 2cd574f25f
79 changed files with 517 additions and 241 deletions

View File

@ -76,7 +76,7 @@ nsChromeProtocolHandler::NewURI(const nsACString &aSpec,
// Chrome: URLs (currently) have no additional structure beyond that provided
// by standard URLs, so there is no "outer" given to CreateInstance
RefPtr<nsStandardURL> surl = new nsStandardURL();
RefPtr<mozilla::net::nsStandardURL> surl = new mozilla::net::nsStandardURL();
nsresult rv = surl->Init(nsIStandardURL::URLTYPE_STANDARD, -1, aSpec,
aCharset, aBaseURI);

View File

@ -24,7 +24,7 @@
using mozilla::dom::BlobImpl;
using mozilla::ErrorResult;
using mozilla::LoadInfo;
using mozilla::net::LoadInfo;
// -----------------------------------------------------------------------
// Hash table
@ -720,7 +720,7 @@ nsFontTableProtocolHandler::NewURI(const nsACString& aSpec,
// fonttable: scheme.
// If aSpec is a relative URI -other- than a bare #ref,
// this will leave uri empty, and we'll return a failure code below.
uri = new nsSimpleURI();
uri = new mozilla::net::nsSimpleURI();
uri->SetSpec(aSpec);
}

View File

@ -18,8 +18,8 @@ static NS_DEFINE_CID(kHOSTOBJECTURICID, NS_HOSTOBJECTURI_CID);
static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
NS_IMPL_ADDREF_INHERITED(nsHostObjectURI, nsSimpleURI)
NS_IMPL_RELEASE_INHERITED(nsHostObjectURI, nsSimpleURI)
NS_IMPL_ADDREF_INHERITED(nsHostObjectURI, mozilla::net::nsSimpleURI)
NS_IMPL_RELEASE_INHERITED(nsHostObjectURI, mozilla::net::nsSimpleURI)
NS_INTERFACE_MAP_BEGIN(nsHostObjectURI)
NS_INTERFACE_MAP_ENTRY(nsIURIWithPrincipal)
@ -33,7 +33,7 @@ NS_INTERFACE_MAP_BEGIN(nsHostObjectURI)
return NS_NOINTERFACE;
}
else
NS_INTERFACE_MAP_END_INHERITING(nsSimpleURI)
NS_INTERFACE_MAP_END_INHERITING(mozilla::net::nsSimpleURI)
// nsIURIWithPrincipal methods:
@ -63,7 +63,7 @@ nsHostObjectURI::GetPrincipalUri(nsIURI** aUri)
NS_IMETHODIMP
nsHostObjectURI::Read(nsIObjectInputStream* aStream)
{
nsresult rv = nsSimpleURI::Read(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Read(aStream);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> supports;
@ -77,7 +77,7 @@ nsHostObjectURI::Read(nsIObjectInputStream* aStream)
NS_IMETHODIMP
nsHostObjectURI::Write(nsIObjectOutputStream* aStream)
{
nsresult rv = nsSimpleURI::Write(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Write(aStream);
NS_ENSURE_SUCCESS(rv, rv);
return NS_WriteOptionalCompoundObject(aStream, mPrincipal,
@ -94,7 +94,7 @@ nsHostObjectURI::Serialize(mozilla::ipc::URIParams& aParams)
HostObjectURIParams hostParams;
URIParams simpleParams;
nsSimpleURI::Serialize(simpleParams);
mozilla::net::nsSimpleURI::Serialize(simpleParams);
hostParams.simpleParams() = simpleParams;
if (mPrincipal) {
@ -124,7 +124,7 @@ nsHostObjectURI::Deserialize(const mozilla::ipc::URIParams& aParams)
const HostObjectURIParams& hostParams = aParams.get_HostObjectURIParams();
if (!nsSimpleURI::Deserialize(hostParams.simpleParams())) {
if (!mozilla::net::nsSimpleURI::Deserialize(hostParams.simpleParams())) {
return false;
}
if (hostParams.principal().type() == OptionalPrincipalInfo::Tvoid_t) {
@ -146,12 +146,12 @@ nsHostObjectURI::SetScheme(const nsACString& aScheme)
// nsIURI methods:
nsresult
nsHostObjectURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode,
nsHostObjectURI::CloneInternal(mozilla::net::nsSimpleURI::RefHandlingEnum aRefHandlingMode,
nsIURI** aClone)
{
nsCOMPtr<nsIURI> simpleClone;
nsresult rv =
nsSimpleURI::CloneInternal(aRefHandlingMode, getter_AddRefs(simpleClone));
mozilla::net::nsSimpleURI::CloneInternal(aRefHandlingMode, getter_AddRefs(simpleClone));
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG
@ -170,7 +170,7 @@ nsHostObjectURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode,
/* virtual */ nsresult
nsHostObjectURI::EqualsInternal(nsIURI* aOther,
nsSimpleURI::RefHandlingEnum aRefHandlingMode,
mozilla::net::nsSimpleURI::RefHandlingEnum aRefHandlingMode,
bool* aResult)
{
if (!aOther) {
@ -186,7 +186,7 @@ nsHostObjectURI::EqualsInternal(nsIURI* aOther,
}
// Compare the member data that our base class knows about.
if (!nsSimpleURI::EqualsInternal(otherUri, aRefHandlingMode)) {
if (!mozilla::net::nsSimpleURI::EqualsInternal(otherUri, aRefHandlingMode)) {
*aResult = false;
return NS_OK;
}

View File

@ -21,16 +21,16 @@
* MediaStreams, with scheme "mediastream", and MediaSources, with scheme
* "mediasource".
*/
class nsHostObjectURI : public nsSimpleURI,
class nsHostObjectURI : public mozilla::net::nsSimpleURI,
public nsIURIWithPrincipal
{
public:
explicit nsHostObjectURI(nsIPrincipal* aPrincipal) :
nsSimpleURI(), mPrincipal(aPrincipal)
mozilla::net::nsSimpleURI(), mPrincipal(aPrincipal)
{}
// For use only from deserialization
nsHostObjectURI() : nsSimpleURI() {}
nsHostObjectURI() : mozilla::net::nsSimpleURI() {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIURIWITHPRINCIPAL
@ -48,7 +48,7 @@ public:
bool* aResult) override;
// Override StartClone to hand back a nsHostObjectURI
virtual nsSimpleURI* StartClone(RefHandlingEnum /* unused */) override
virtual mozilla::net::nsSimpleURI* StartClone(RefHandlingEnum /* unused */) override
{ return new nsHostObjectURI(); }
nsCOMPtr<nsIPrincipal> mPrincipal;

View File

@ -112,6 +112,7 @@ static const char *kPrefBlockURIs = "browser.safebrowsing.blockedURIs.enabled";
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::net;
static LogModule*
GetObjectLog()

View File

@ -1265,8 +1265,8 @@ static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
NS_IMPL_ADDREF_INHERITED(nsJSURI, nsSimpleURI)
NS_IMPL_RELEASE_INHERITED(nsJSURI, nsSimpleURI)
NS_IMPL_ADDREF_INHERITED(nsJSURI, mozilla::net::nsSimpleURI)
NS_IMPL_RELEASE_INHERITED(nsJSURI, mozilla::net::nsSimpleURI)
NS_INTERFACE_MAP_BEGIN(nsJSURI)
if (aIID.Equals(kJSURICID))
@ -1279,14 +1279,14 @@ NS_INTERFACE_MAP_BEGIN(nsJSURI)
return NS_NOINTERFACE;
}
else
NS_INTERFACE_MAP_END_INHERITING(nsSimpleURI)
NS_INTERFACE_MAP_END_INHERITING(mozilla::net::nsSimpleURI)
// nsISerializable methods:
NS_IMETHODIMP
nsJSURI::Read(nsIObjectInputStream* aStream)
{
nsresult rv = nsSimpleURI::Read(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Read(aStream);
if (NS_FAILED(rv)) return rv;
bool haveBase;
@ -1306,7 +1306,7 @@ nsJSURI::Read(nsIObjectInputStream* aStream)
NS_IMETHODIMP
nsJSURI::Write(nsIObjectOutputStream* aStream)
{
nsresult rv = nsSimpleURI::Write(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Write(aStream);
if (NS_FAILED(rv)) return rv;
rv = aStream->WriteBoolean(mBaseURI != nullptr);
@ -1329,7 +1329,7 @@ nsJSURI::Serialize(mozilla::ipc::URIParams& aParams)
JSURIParams jsParams;
URIParams simpleParams;
nsSimpleURI::Serialize(simpleParams);
mozilla::net::nsSimpleURI::Serialize(simpleParams);
jsParams.simpleParams() = simpleParams;
if (mBaseURI) {
@ -1352,7 +1352,7 @@ nsJSURI::Deserialize(const mozilla::ipc::URIParams& aParams)
}
const JSURIParams& jsParams = aParams.get_JSURIParams();
nsSimpleURI::Deserialize(jsParams.simpleParams());
mozilla::net::nsSimpleURI::Deserialize(jsParams.simpleParams());
if (jsParams.baseURI().type() != OptionalURIParams::Tvoid_t) {
mBaseURI = DeserializeURI(jsParams.baseURI().get_URIParams());
@ -1363,8 +1363,8 @@ nsJSURI::Deserialize(const mozilla::ipc::URIParams& aParams)
}
// nsSimpleURI methods:
/* virtual */ nsSimpleURI*
nsJSURI::StartClone(nsSimpleURI::RefHandlingEnum /* ignored */)
/* virtual */ mozilla::net::nsSimpleURI*
nsJSURI::StartClone(mozilla::net::nsSimpleURI::RefHandlingEnum /* ignored */)
{
nsCOMPtr<nsIURI> baseClone;
if (mBaseURI) {
@ -1380,7 +1380,7 @@ nsJSURI::StartClone(nsSimpleURI::RefHandlingEnum /* ignored */)
/* virtual */ nsresult
nsJSURI::EqualsInternal(nsIURI* aOther,
nsSimpleURI::RefHandlingEnum aRefHandlingMode,
mozilla::net::nsSimpleURI::RefHandlingEnum aRefHandlingMode,
bool* aResult)
{
NS_ENSURE_ARG_POINTER(aOther);
@ -1395,7 +1395,7 @@ nsJSURI::EqualsInternal(nsIURI* aOther,
}
// Compare the member data that our base class knows about.
if (!nsSimpleURI::EqualsInternal(otherJSURI, aRefHandlingMode)) {
if (!mozilla::net::nsSimpleURI::EqualsInternal(otherJSURI, aRefHandlingMode)) {
*aResult = false;
return NS_OK;
}

View File

@ -61,11 +61,11 @@ protected:
};
class nsJSURI : public nsSimpleURI
class nsJSURI : public mozilla::net::nsSimpleURI
{
public:
using nsSimpleURI::Read;
using nsSimpleURI::Write;
using mozilla::net::nsSimpleURI::Read;
using mozilla::net::nsSimpleURI::Write;
nsJSURI() {}
@ -79,7 +79,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIURI overrides
virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode) override;
virtual mozilla::net::nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode) override;
// nsISerializable overrides
NS_IMETHOD Read(nsIObjectInputStream* aStream) override;

View File

@ -21,13 +21,6 @@
#include "nsIScriptSecurityManager.h"
#include "nsNetUtil.h"
//
// set NSPR_LOG_MODULES=TCPSocket:5
//
extern mozilla::LazyLogModule gTCPSocketLog;
#define TCPSOCKET_LOG(args) MOZ_LOG(gTCPSocketLog, mozilla::LogLevel::Debug, args)
#define TCPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gTCPSocketLog, mozilla::LogLevel::Debug)
namespace IPC {
//Defined in TCPSocketChild.cpp
@ -39,6 +32,16 @@ DeserializeArrayBuffer(JSContext* aCx,
} // namespace IPC
namespace mozilla {
namespace net {
//
// set NSPR_LOG_MODULES=TCPSocket:5
//
extern LazyLogModule gTCPSocketLog;
#define TCPSOCKET_LOG(args) MOZ_LOG(gTCPSocketLog, LogLevel::Debug, args)
#define TCPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gTCPSocketLog, LogLevel::Debug)
} // namespace net
namespace dom {
static void

View File

@ -21,11 +21,14 @@ struct JSContext;
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)
namespace mozilla {
namespace net {
extern LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, LogLevel::Debug)
} // namespace net
namespace dom {
struct UDPOptions;

View File

@ -17,13 +17,6 @@
using mozilla::net::gNeckoChild;
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)
namespace mozilla {
namespace dom {

View File

@ -23,13 +23,6 @@
#include "mozilla/ipc/PBackgroundParent.h"
#include "mtransport/runnable_utils.h"
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)
namespace mozilla {
namespace dom {

View File

@ -246,7 +246,7 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
uint32_t flags,
nsIAsyncVerifyRedirectCallback *callback)
{
nsAsyncRedirectAutoCallback autoCallback(callback);
net::nsAsyncRedirectAutoCallback autoCallback(callback);
nsCOMPtr<nsIURI> newUri;
nsresult rv = newChannel->GetURI(getter_AddRefs(newUri));

View File

@ -10,7 +10,7 @@
#include "nsIPrincipal.h"
#include "mozilla/LoadInfo.h"
using mozilla::LoadInfo;
using mozilla::net::LoadInfo;
/**
* URIUtils

View File

@ -24,6 +24,7 @@
using namespace mozilla::dom;
namespace mozilla {
namespace net {
static void
InheritOriginAttributes(nsIPrincipal* aLoadingPrincipal, NeckoOriginAttributes& aAttrs)
@ -725,4 +726,5 @@ LoadInfo::MaybeIncreaseTainting(uint32_t aTainting)
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -33,6 +33,8 @@ LoadInfoArgsToLoadInfo(const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
nsILoadInfo** outLoadInfo);
} // namespace ipc
namespace net {
/**
* Class that provides an nsILoadInfo implementation.
*
@ -135,6 +137,7 @@ private:
bool mIsPreflight;
};
} // namespace net
} // namespace mozilla
#endif // mozilla_LoadInfo_h

View File

@ -14,15 +14,18 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsILoadInfo.h"
static mozilla::LazyLogModule gRedirectLog("nsRedirect");
namespace mozilla {
namespace net {
static LazyLogModule gRedirectLog("nsRedirect");
#undef LOG
#define LOG(args) MOZ_LOG(gRedirectLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gRedirectLog, LogLevel::Debug, args)
NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper,
nsIAsyncVerifyRedirectCallback,
nsIRunnable)
class nsAsyncVerifyRedirectCallbackEvent : public mozilla::Runnable {
class nsAsyncVerifyRedirectCallbackEvent : public Runnable {
public:
nsAsyncVerifyRedirectCallbackEvent(nsIAsyncVerifyRedirectCallback *cb,
nsresult result)
@ -272,3 +275,6 @@ nsAsyncRedirectVerifyHelper::IsOldChannelCanceled()
return false;
}
} // namespace net
} // namespace mozilla

View File

@ -18,6 +18,9 @@
class nsIChannel;
namespace mozilla {
namespace net {
/**
* This class simplifies call of OnChannelRedirect of IOService and
* the sink bound with the channel being redirected while the result of
@ -121,4 +124,6 @@ private:
nsresult mResult;
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -35,17 +35,17 @@
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
using mozilla::ArrayLength;
using mozilla::Preferences;
namespace mozilla {
namespace net {
//
// NSPR_LOG_MODULES=nsChannelClassifier:5
//
static mozilla::LazyLogModule gChannelClassifierLog("nsChannelClassifier");
static LazyLogModule gChannelClassifierLog("nsChannelClassifier");
#undef LOG
#define LOG(args) MOZ_LOG(gChannelClassifierLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gChannelClassifierLog, mozilla::LogLevel::Debug)
#define LOG(args) MOZ_LOG(gChannelClassifierLog, LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gChannelClassifierLog, LogLevel::Debug)
NS_IMPL_ISUPPORTS(nsChannelClassifier,
nsIURIClassifierCallback)
@ -424,7 +424,7 @@ nsChannelClassifier::MarkEntryClassified(nsresult status)
if (LOG_ENABLED()) {
nsAutoCString errorName;
mozilla::GetErrorName(status, errorName);
GetErrorName(status, errorName);
nsCOMPtr<nsIURI> uri;
mChannel->GetURI(getter_AddRefs(uri));
nsAutoCString spec;
@ -666,7 +666,7 @@ nsChannelClassifier::OnClassifyComplete(nsresult aErrorCode)
if (mSuspendedChannel) {
nsAutoCString errorName;
if (LOG_ENABLED()) {
mozilla::GetErrorName(aErrorCode, errorName);
GetErrorName(aErrorCode, errorName);
LOG(("nsChannelClassifier[%p]:OnClassifyComplete %s (suspended channel)",
this, errorName.get()));
}
@ -701,3 +701,6 @@ nsChannelClassifier::OnClassifyComplete(nsresult aErrorCode)
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -13,6 +13,9 @@ class nsIChannel;
class nsIHttpChannelInternal;
class nsIDocument;
namespace mozilla {
namespace net {
class nsChannelClassifier final : public nsIURIClassifierCallback
{
public:
@ -56,4 +59,7 @@ public:
static nsresult NotifyTrackingProtectionDisabled(nsIChannel *aChannel);
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -62,9 +62,8 @@
#include "nsINetworkInterface.h"
#endif
using namespace mozilla;
using mozilla::net::IsNeckoChild;
using mozilla::net::CaptivePortalService;
namespace mozilla {
namespace net {
#define PORT_PREF_PREFIX "network.security.ports."
#define PORT_PREF(x) PORT_PREF_PREFIX x
@ -84,9 +83,9 @@ using mozilla::net::CaptivePortalService;
nsIOService* gIOService = nullptr;
static bool gHasWarnedUploadChannel2;
static mozilla::LazyLogModule gIOServiceLog("nsIOService");
static LazyLogModule gIOServiceLog("nsIOService");
#undef LOG
#define LOG(args) MOZ_LOG(gIOServiceLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gIOServiceLog, LogLevel::Debug, args)
// A general port blacklist. Connections to these ports will not be allowed
// unless the protocol overrides.
@ -241,8 +240,7 @@ nsIOService::Init()
}
// Register for profile change notifications
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (observerService) {
observerService->AddObserver(this, kProfileChangeNetTeardownTopic, true);
observerService->AddObserver(this, kProfileChangeNetRestoreTopic, true);
@ -407,7 +405,7 @@ nsIOService::RecheckCaptivePortalIfLocalRedirect(nsIChannel* newChan)
return NS_OK;
}
mozilla::net::NetAddr netAddr;
NetAddr netAddr;
PRNetAddrToNetAddr(&prAddr, &netAddr);
if (IsIPAddrLocal(&netAddr)) {
// Redirects to local IP addresses are probably captive portals
@ -880,11 +878,11 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
if (aLoadingNode || aLoadingPrincipal ||
aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) {
nsCOMPtr<nsINode> loadingNode(do_QueryInterface(aLoadingNode));
loadInfo = new mozilla::LoadInfo(aLoadingPrincipal,
aTriggeringPrincipal,
loadingNode,
aSecurityFlags,
aContentPolicyType);
loadInfo = new LoadInfo(aLoadingPrincipal,
aTriggeringPrincipal,
loadingNode,
aSecurityFlags,
aContentPolicyType);
}
NS_ASSERTION(loadInfo, "Please pass security info when creating a channel");
return NewChannelFromURIWithProxyFlagsInternal(aURI,
@ -1048,8 +1046,7 @@ nsIOService::SetOffline(bool offline)
mSettingOffline = true;
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
NS_ASSERTION(observerService, "The observer service should not be null");
@ -1162,8 +1159,7 @@ nsIOService::SetConnectivityInternal(bool aConnectivity)
// we have statistic about network change event even if we are offline.
mLastConnectivityChange = PR_IntervalNow();
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (!observerService) {
return NS_OK;
}
@ -1427,8 +1423,7 @@ private:
NS_IMETHODIMP
nsIOService::NotifyWakeup()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
NS_ASSERTION(observerService, "The observer service should not be null");
@ -1786,7 +1781,7 @@ nsIOService::ParseAttributePolicyString(const nsAString& policyString,
uint32_t *outPolicyEnum)
{
NS_ENSURE_ARG(outPolicyEnum);
*outPolicyEnum = (uint32_t)mozilla::net::AttributeReferrerPolicyFromString(policyString);
*outPolicyEnum = (uint32_t)AttributeReferrerPolicyFromString(policyString);
return NS_OK;
}
@ -1938,8 +1933,7 @@ nsIOService::NotifyAppOfflineStatus(uint32_t appId, int32_t state)
MOZ_RELEASE_ASSERT(NS_IsMainThread(),
"Should be called on the main thread");
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
MOZ_ASSERT(observerService, "The observer service should not be null");
if (observerService) {
@ -2095,3 +2089,6 @@ nsIOService::IsAppOffline(uint32_t aAppId, bool* aResult)
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -34,7 +34,6 @@
static const char gScheme[][sizeof("moz-safe-about")] =
{"chrome", "file", "http", "https", "jar", "data", "about", "moz-safe-about", "resource"};
class nsAsyncRedirectVerifyHelper;
class nsINetworkLinkService;
class nsIPrefBranch;
class nsIProtocolProxyService2;
@ -44,9 +43,8 @@ class nsPISocketTransportService;
namespace mozilla {
namespace net {
class NeckoChild;
} // namespace net
} // namespace mozilla
class NeckoChild;
class nsAsyncRedirectVerifyHelper;
class nsIOService final : public nsIIOService2
, public nsIObserver
@ -242,4 +240,7 @@ private:
*/
extern nsIOService* gIOService;
} // namespace net
} // namespace mozilla
#endif // nsIOService_h__

View File

@ -8,6 +8,9 @@
//-----------------------------------------------------------------------------
// nsInputStreamChannel
namespace mozilla {
namespace net {
nsresult
nsInputStreamChannel::OpenContentStream(bool async, nsIInputStream **result,
nsIChannel** channel)
@ -104,3 +107,6 @@ nsInputStreamChannel::SetBaseURI(nsIURI* aBaseURI)
mBaseURI = aBaseURI;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -11,6 +11,9 @@
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
class nsInputStreamChannel : public nsBaseChannel
, public nsIInputStreamChannel
{
@ -38,4 +41,7 @@ private:
bool mIsSrcdocChannel;
};
} // namespace net
} // namespace mozilla
#endif // !nsInputStreamChannel_h__

View File

@ -24,8 +24,8 @@
#include "mozilla/net/NeckoChild.h"
using namespace mozilla;
using namespace mozilla::net;
namespace mozilla {
namespace net {
//
// Log module for nsILoadGroup logging...
@ -1081,4 +1081,7 @@ nsresult nsLoadGroup::Init()
return NS_OK;
}
} // namespace net
} // namespace mozilla
#undef LOG

View File

@ -21,6 +21,9 @@ class nsIRequestContext;
class nsIRequestContextService;
class nsITimedChannel;
namespace mozilla {
namespace net {
class nsLoadGroup : public nsILoadGroup,
public nsILoadGroupChild,
public nsISupportsPriority,
@ -96,4 +99,7 @@ protected:
nsCString mUserAgentOverrideCache;
};
} // namespace net
} // namespace mozilla
#endif // nsLoadGroup_h__

View File

@ -14,10 +14,10 @@ static inline void
net_ResolveSegmentParams(uint32_t &segsize, uint32_t &segcount)
{
if (!segsize)
segsize = nsIOService::gDefaultSegmentSize;
segsize = mozilla::net::nsIOService::gDefaultSegmentSize;
if (!segcount)
segcount = nsIOService::gDefaultSegmentCount;
segcount = mozilla::net::nsIOService::gDefaultSegmentCount;
}
#endif // !nsNetSegmentUtils_h__

View File

@ -22,17 +22,14 @@
#endif
//-----------------------------------------------------------------------------
using namespace mozilla;
using namespace mozilla::net;
namespace mozilla {
namespace net {
LazyLogModule gProxyLog("proxy");
} // namespace net
} // namespace mozilla
#undef LOG
#define LOG(args) MOZ_LOG(mozilla::net::gProxyLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gProxyLog, LogLevel::Debug, args)
// The PAC thread does evaluations of both PAC files and
// nsISystemProxySettings because they can both block the calling thread and we
@ -788,3 +785,6 @@ nsPACMan::Init(nsISystemProxySettings *systemProxySettings)
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -22,9 +22,13 @@
#include "mozilla/Logging.h"
#include "mozilla/Atomics.h"
class nsPACMan;
class nsISystemProxySettings;
class nsIThread;
namespace mozilla {
namespace net {
class nsPACMan;
class WaitForThreadShutdown;
/**
@ -51,8 +55,8 @@ public:
const nsCString &newPACURL) = 0;
};
class PendingPACQuery final : public mozilla::Runnable,
public mozilla::LinkedListElement<PendingPACQuery>
class PendingPACQuery final : public Runnable,
public LinkedListElement<PendingPACQuery>
{
public:
PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, uint32_t appId,
@ -218,11 +222,11 @@ private:
void NamePACThread();
private:
mozilla::net::ProxyAutoConfig mPAC;
ProxyAutoConfig mPAC;
nsCOMPtr<nsIThread> mPACThread;
nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
mozilla::LinkedList<PendingPACQuery> mPendingQ; /* pac thread only */
LinkedList<PendingPACQuery> mPendingQ; /* pac thread only */
// These specs are not nsIURI so that they can be used off the main thread.
// The non-normalized versions are directly from the configuration, the
@ -233,16 +237,15 @@ private:
nsCOMPtr<nsIStreamLoader> mLoader;
bool mLoadPending;
mozilla::Atomic<bool, mozilla::Relaxed> mShutdown;
mozilla::TimeStamp mScheduledReload;
Atomic<bool, Relaxed> mShutdown;
TimeStamp mScheduledReload;
uint32_t mLoadFailureCount;
bool mInProgress;
};
namespace mozilla {
namespace net {
extern LazyLogModule gProxyLog;
} // namespace net
} // namespace mozilla

View File

@ -34,23 +34,22 @@
#include "nsISystemProxySettings.h"
#include "nsINetworkLinkService.h"
#include "nsIHttpChannelInternal.h"
#include "mozilla/Logging.h"
//----------------------------------------------------------------------------
namespace mozilla {
namespace net {
extern const char kProxyType_HTTP[];
extern const char kProxyType_HTTPS[];
extern const char kProxyType_SOCKS[];
extern const char kProxyType_SOCKS4[];
extern const char kProxyType_SOCKS5[];
extern const char kProxyType_DIRECT[];
} // namespace mozilla
using namespace mozilla;
#include "mozilla/Logging.h"
#undef LOG
#define LOG(args) MOZ_LOG(net::gProxyLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gProxyLog, LogLevel::Debug, args)
//----------------------------------------------------------------------------
@ -458,7 +457,7 @@ nsProtocolProxyService::Init()
PrefsChanged(prefBranch, nullptr);
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
// register for shutdown notification so we can clean ourselves up
// properly.
@ -536,7 +535,7 @@ nsProtocolProxyService::Observe(nsISupports *aSubject,
mPACMan = nullptr;
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->RemoveObserver(this, NS_NETWORK_LINK_TOPIC);
obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
@ -805,7 +804,6 @@ nsProtocolProxyService::CanUseProxy(nsIURI *aURI, int32_t defaultPort)
// kProxyType\* may be referred to externally in
// nsProxyInfo in order to compare by string pointer
namespace mozilla {
const char kProxyType_HTTP[] = "http";
const char kProxyType_HTTPS[] = "https";
const char kProxyType_PROXY[] = "proxy";
@ -813,7 +811,6 @@ const char kProxyType_SOCKS[] = "socks";
const char kProxyType_SOCKS4[] = "socks4";
const char kProxyType_SOCKS5[] = "socks5";
const char kProxyType_DIRECT[] = "direct";
} // namespace mozilla
const char *
nsProtocolProxyService::ExtractProxyInfo(const char *start,
@ -2088,3 +2085,6 @@ nsProtocolProxyService::PruneProxyInfo(const nsProtocolInfo &info,
*list = head; // Transfer ownership
}
} // namespace net
} // namespace mozilla

View File

@ -19,13 +19,17 @@
#include "prio.h"
#include "mozilla/Attributes.h"
typedef nsDataHashtable<nsCStringHashKey, uint32_t> nsFailedProxyTable;
class nsProxyInfo;
struct nsProtocolInfo;
class nsIPrefBranch;
class nsISystemProxySettings;
namespace mozilla {
namespace net {
typedef nsDataHashtable<nsCStringHashKey, uint32_t> nsFailedProxyTable;
class nsPACMan;
class nsProxyInfo;
struct nsProtocolInfo;
// CID for the nsProtocolProxyService class
// 091eedd8-8bae-4fe3-ad62-0c87351e640d
@ -406,4 +410,7 @@ private:
NS_DEFINE_STATIC_IID_ACCESSOR(nsProtocolProxyService, NS_PROTOCOL_PROXY_SERVICE_IMPL_CID)
} // namespace net
} // namespace mozilla
#endif // !nsProtocolProxyService_h__

View File

@ -7,11 +7,12 @@
#include "nsProxyInfo.h"
#include "nsCOMPtr.h"
namespace mozilla {
namespace net {
// Yes, we support QI to nsProxyInfo
NS_IMPL_ISUPPORTS(nsProxyInfo, nsProxyInfo, nsIProxyInfo)
using namespace mozilla;
NS_IMETHODIMP
nsProxyInfo::GetHost(nsACString &result)
{
@ -87,14 +88,12 @@ nsProxyInfo::SetFailoverProxy(nsIProxyInfo *proxy)
// These pointers are declared in nsProtocolProxyService.cpp and
// comparison of mType by string pointer is valid within necko
namespace mozilla {
extern const char kProxyType_HTTP[];
extern const char kProxyType_HTTPS[];
extern const char kProxyType_SOCKS[];
extern const char kProxyType_SOCKS4[];
extern const char kProxyType_SOCKS5[];
extern const char kProxyType_DIRECT[];
} // namespace mozilla
bool
nsProxyInfo::IsDirect()
@ -123,3 +122,5 @@ nsProxyInfo::IsSOCKS()
mType == kProxyType_SOCKS4 || mType == kProxyType_SOCKS5;
}
} // namespace net
} // namespace mozilla

View File

@ -20,6 +20,9 @@
{0xab, 0xeb, 0x36, 0x70, 0x71, 0x1a, 0x8b, 0x85} \
}
namespace mozilla {
namespace net {
// This class is exposed to other classes inside Necko for fast access
// to the nsIProxyInfo attributes.
class nsProxyInfo final : public nsIProxyInfo
@ -73,4 +76,7 @@ private:
NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyInfo, NS_PROXYINFO_IID)
} // namespace net
} // namespace mozilla
#endif // nsProxyInfo_h__

View File

@ -11,12 +11,13 @@
#include "nsAutoPtr.h"
#include "mozilla/Logging.h"
using namespace mozilla;
namespace mozilla {
namespace net {
static LazyLogModule gRequestObserverProxyLog("nsRequestObserverProxy");
#undef LOG
#define LOG(args) MOZ_LOG(gRequestObserverProxyLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gRequestObserverProxyLog, LogLevel::Debug, args)
//-----------------------------------------------------------------------------
// nsARequestObserverEvent internal class...
@ -189,3 +190,6 @@ nsRequestObserverProxy::FireEvent(nsARequestObserverEvent *event)
nsCOMPtr<nsIEventTarget> mainThread(do_GetMainThread());
return mainThread->Dispatch(event, NS_DISPATCH_NORMAL);
}
} // namespace net
} // namespace mozilla

View File

@ -13,6 +13,9 @@
#include "nsCOMPtr.h"
#include "nsProxyRelease.h"
namespace mozilla {
namespace net {
class nsARequestObserverEvent;
class nsRequestObserverProxy final : public nsIRequestObserverProxy
@ -38,7 +41,7 @@ protected:
friend class nsOnStopRequestEvent;
};
class nsARequestObserverEvent : public mozilla::Runnable
class nsARequestObserverEvent : public Runnable
{
public:
explicit nsARequestObserverEvent(nsIRequest *);
@ -49,4 +52,7 @@ protected:
nsCOMPtr<nsIRequest> mRequest;
};
} // namespace net
} // namespace mozilla
#endif // nsRequestObserverProxy_h__

View File

@ -10,8 +10,11 @@
#include "mozilla/Logging.h"
#include "nsCOMPtr.h"
static mozilla::LazyLogModule gChannelWrapperLog("ChannelWrapper");
#define CHANNELWRAPPERLOG(args) MOZ_LOG(gChannelWrapperLog, mozilla::LogLevel::Debug, args)
namespace mozilla {
namespace net {
static LazyLogModule gChannelWrapperLog("ChannelWrapper");
#define CHANNELWRAPPERLOG(args) MOZ_LOG(gChannelWrapperLog, LogLevel::Debug, args)
NS_IMPL_ADDREF(nsSecCheckWrapChannelBase)
NS_IMPL_RELEASE(nsSecCheckWrapChannelBase)
@ -191,3 +194,6 @@ nsSecCheckWrapChannel::Open2(nsIInputStream** aStream)
NS_ENSURE_SUCCESS(rv, rv);
return Open(aStream);
}
} // namespace net
} // namespace mozilla

View File

@ -14,6 +14,9 @@
#include "nsIWyciwygChannel.h"
#include "mozilla/LoadInfo.h"
namespace mozilla {
namespace net {
/*
* The nsSecCheckWrapChannelBase wraps channels that do *not*
* * provide a newChannel2() implementation
@ -97,4 +100,7 @@ protected:
nsCOMPtr<nsILoadInfo> mLoadInfo;
};
} // namespace net
} // namespace mozilla
#endif // nsSecCheckWrapChannel_h__

View File

@ -18,8 +18,7 @@
#include "nsServiceManagerUtils.h"
#include "nsIFile.h"
using namespace mozilla;
using namespace mozilla::net;
namespace mozilla { namespace net {
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
@ -556,3 +555,6 @@ nsServerSocket::GetAddress(PRNetAddr *aResult)
memcpy(aResult, &mAddr, sizeof(mAddr));
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -16,8 +16,6 @@
class nsIEventTarget;
namespace mozilla { namespace net {
union NetAddr;
} // namespace net
} // namespace mozilla
class nsServerSocket : public nsASocketHandler
, public nsIServerSocket
@ -61,6 +59,9 @@ private:
bool mKeepWhenOffline;
};
} // namespace net
} // namespace mozilla
//-----------------------------------------------------------------------------
#endif // nsServerSocket_h__

View File

@ -13,6 +13,9 @@
#include "mozilla/ipc/URIUtils.h"
namespace mozilla {
namespace net {
NS_IMPL_ISUPPORTS_INHERITED(nsSimpleNestedURI, nsSimpleURI, nsINestedURI)
nsSimpleNestedURI::nsSimpleNestedURI(nsIURI* innerURI)
@ -175,3 +178,6 @@ nsSimpleNestedURI::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
*aClassIDNoAlloc = kSimpleNestedURICID;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -22,6 +22,9 @@
#include "nsIIPCSerializableURI.h"
namespace mozilla {
namespace net {
class nsSimpleNestedURI : public nsSimpleURI,
public nsINestedURI
{
@ -65,4 +68,7 @@ protected:
nsCOMPtr<nsIURI> mInnerURI;
};
} // namespace net
} // namespace mozilla
#endif /* nsSimpleNestedURI_h__ */

View File

@ -5,6 +5,9 @@
#include "nsSimpleStreamListener.h"
namespace mozilla {
namespace net {
//
//----------------------------------------------------------------------------
// nsISupports implementation...
@ -75,3 +78,6 @@ nsSimpleStreamListener::Init(nsIOutputStream *aSink,
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -3,10 +3,16 @@
* 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/. */
#ifndef nsSimpleStreamListener_h__
#define nsSimpleStreamListener_h__
#include "nsISimpleStreamListener.h"
#include "nsIOutputStream.h"
#include "nsCOMPtr.h"
namespace mozilla {
namespace net {
class nsSimpleStreamListener : public nsISimpleStreamListener
{
public:
@ -23,3 +29,8 @@ protected:
nsCOMPtr<nsIOutputStream> mSink;
nsCOMPtr<nsIRequestObserver> mObserver;
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -24,6 +24,9 @@
using namespace mozilla::ipc;
namespace mozilla {
namespace net {
static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
@ -214,7 +217,7 @@ nsSimpleURI::SetSpec(const nsACString &aSpec)
return NS_ERROR_MALFORMED_URI;
mScheme.Truncate();
mozilla::DebugOnly<int32_t> n = spec.Left(mScheme, colonPos);
DebugOnly<int32_t> n = spec.Left(mScheme, colonPos);
NS_ASSERTION(n == colonPos, "Left failed");
ToLowerCase(mScheme);
@ -633,7 +636,7 @@ nsSimpleURI::SetMutable(bool value)
//----------------------------------------------------------------------------
size_t
nsSimpleURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
nsSimpleURI::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
@ -641,7 +644,9 @@ nsSimpleURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
}
size_t
nsSimpleURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
nsSimpleURI::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
} // namespace net
} // namespace mozilla

View File

@ -15,6 +15,9 @@
#include "nsISizeOf.h"
#include "nsIIPCSerializableURI.h"
namespace mozilla {
namespace net {
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
0x0b9bb0c2, \
@ -52,8 +55,8 @@ public:
// - nsJSURI: mBaseURI
// - nsSimpleNestedURI: mInnerURI
// - nsBlobURI: mPrincipal
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
protected:
// enum used in a few places to specify how .ref attribute should be handled
@ -88,4 +91,7 @@ protected:
bool mIsRefValid; // To distinguish between empty-ref and no-ref.
};
} // namespace net
} // namespace mozilla
#endif // nsSimpleURI_h__

View File

@ -58,9 +58,6 @@
#define SUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS 2
#define UNSUCCESSFUL_CONNECTING_TO_IPV6_ADDRESS 3
using namespace mozilla;
using namespace mozilla::net;
//-----------------------------------------------------------------------------
static NS_DEFINE_CID(kSocketProviderServiceCID, NS_SOCKETPROVIDERSERVICE_CID);
@ -68,6 +65,9 @@ static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
class nsSocketEvent : public Runnable
{
public:
@ -205,8 +205,8 @@ ErrorAccordingToNSPR(PRErrorCode errorCode)
rv = NS_ERROR_FILE_READ_ONLY;
break;
default:
if (mozilla::psm::IsNSSErrorCode(errorCode)) {
rv = mozilla::psm::GetXPCOMFromNSSError(errorCode);
if (psm::IsNSSErrorCode(errorCode)) {
rv = psm::GetXPCOMFromNSSError(errorCode);
}
break;
@ -1324,7 +1324,7 @@ nsSocketTransport::InitiateSocket()
}
// Attach network activity monitor
mozilla::net::NetworkActivityMonitor::AttachIOLayer(fd);
NetworkActivityMonitor::AttachIOLayer(fd);
PRStatus status;
@ -1699,7 +1699,7 @@ nsSocketTransport::OnSocketConnected()
mFDconnected = true;
#ifdef XP_WIN
if (!mozilla::IsWin2003OrLater()) { // windows xp
if (!IsWin2003OrLater()) { // windows xp
PRSocketOptionData opt;
opt.option = PR_SockOpt_RecvBufferSize;
if (PR_GetSocketOption(mFD, &opt) == PR_SUCCESS) {
@ -3112,7 +3112,7 @@ void
nsSocketTransport::CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled)
{
#if defined(XP_WIN)
mozilla::net::AttachShutdownLayer(aFd);
AttachShutdownLayer(aFd);
#endif
// We use PRIntervalTime here because we need
@ -3166,3 +3166,6 @@ nsSocketTransport::SendPRBlockingTelemetry(PRIntervalTime aStart,
PR_IntervalToMilliseconds(now - aStart));
}
}
} // namespace net
} // namespace mozilla

View File

@ -27,14 +27,10 @@
#include "prerror.h"
#include "nsAutoPtr.h"
class nsSocketTransport;
class nsICancelable;
class nsIDNSRecord;
class nsIInterfaceRequestor;
nsresult
ErrorAccordingToNSPR(PRErrorCode errorCode);
//-----------------------------------------------------------------------------
// after this short interval, we will return to PR_Poll
@ -42,6 +38,14 @@ ErrorAccordingToNSPR(PRErrorCode errorCode);
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
nsresult
ErrorAccordingToNSPR(PRErrorCode errorCode);
class nsSocketTransport;
class nsSocketInputStream : public nsIAsyncInputStream
{
public:
@ -61,7 +65,7 @@ public:
private:
nsSocketTransport *mTransport;
mozilla::ThreadSafeAutoRefCnt mReaderRefCnt;
ThreadSafeAutoRefCnt mReaderRefCnt;
// access to these is protected by mTransport->mLock
nsresult mCondition;
@ -95,7 +99,7 @@ private:
uint32_t count, uint32_t *countRead);
nsSocketTransport *mTransport;
mozilla::ThreadSafeAutoRefCnt mWriterRefCnt;
ThreadSafeAutoRefCnt mWriterRefCnt;
// access to these is protected by mTransport->mLock
nsresult mCondition;
@ -112,8 +116,6 @@ class nsSocketTransport final : public nsASocketHandler
, public nsIClassInfo
, public nsIInterfaceRequestor
{
typedef mozilla::Mutex Mutex;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITRANSPORT
@ -134,12 +136,12 @@ public:
// this method instructs the socket transport to use an already connected
// socket with the given address.
nsresult InitWithConnectedSocket(PRFileDesc *socketFD,
const mozilla::net::NetAddr *addr);
const NetAddr *addr);
// this method instructs the socket transport to use an already connected
// socket with the given address, and additionally supplies security info.
nsresult InitWithConnectedSocket(PRFileDesc* aSocketFD,
const mozilla::net::NetAddr* aAddr,
const NetAddr* aAddr,
nsISupports* aSecInfo);
// This method instructs the socket transport to open a socket
@ -160,11 +162,11 @@ public:
uint64_t ByteCountSent() override { return mOutput.ByteCount(); }
static void CloseSocket(PRFileDesc *aFd, bool aTelemetryEnabled);
static void SendPRBlockingTelemetry(PRIntervalTime aStart,
mozilla::Telemetry::ID aIDNormal,
mozilla::Telemetry::ID aIDShutdown,
mozilla::Telemetry::ID aIDConnectivityChange,
mozilla::Telemetry::ID aIDLinkChange,
mozilla::Telemetry::ID aIDOffline);
Telemetry::ID aIDNormal,
Telemetry::ID aIDShutdown,
Telemetry::ID aIDConnectivityChange,
Telemetry::ID aIDLinkChange,
Telemetry::ID aIDOffline);
protected:
virtual ~nsSocketTransport();
@ -197,8 +199,6 @@ private:
class MOZ_STACK_CLASS PRFileDescAutoLock
{
public:
typedef mozilla::MutexAutoLock MutexAutoLock;
explicit PRFileDescAutoLock(nsSocketTransport *aSocketTransport,
nsresult *aConditionWhileLocked = nullptr)
: mSocketTransport(aSocketTransport)
@ -322,12 +322,12 @@ private:
// mNetAddr/mSelfAddr is valid from GetPeerAddr()/GetSelfAddr() once we have
// reached STATE_TRANSFERRING. It must not change after that.
void SetSocketName(PRFileDesc *fd);
mozilla::net::NetAddr mNetAddr;
mozilla::net::NetAddr mSelfAddr; // getsockname()
mozilla::Atomic<bool, mozilla::Relaxed> mNetAddrIsSet;
mozilla::Atomic<bool, mozilla::Relaxed> mSelfAddrIsSet;
NetAddr mNetAddr;
NetAddr mSelfAddr; // getsockname()
Atomic<bool, Relaxed> mNetAddrIsSet;
Atomic<bool, Relaxed> mSelfAddrIsSet;
nsAutoPtr<mozilla::net::NetAddr> mBindAddr;
nsAutoPtr<NetAddr> mBindAddr;
// socket methods (these can only be called on the socket thread):
@ -446,4 +446,7 @@ private:
int32_t mKeepaliveProbeCount;
};
} // namespace net
} // namespace mozilla
#endif // !nsSocketTransport_h__

View File

@ -31,8 +31,8 @@
#include "mozilla/WindowsVersion.h"
#endif
using namespace mozilla;
using namespace mozilla::net;
namespace mozilla {
namespace net {
LazyLogModule gSocketTransportLog("nsSocketTransport");
LazyLogModule gUDPSocketLog("UDPSocket");
@ -644,7 +644,7 @@ nsSocketTransportService::Shutdown()
mAfterWakeUpTimer = nullptr;
}
mozilla::net::NetworkActivityMonitor::Shutdown();
NetworkActivityMonitor::Shutdown();
mInitialized = false;
mShuttingDown = false;
@ -1196,7 +1196,7 @@ nsSocketTransportService::UpdateSendBufferPref(nsIPrefBranch *pref)
#if defined(XP_WIN)
// If the pref is not set but this is windows set it depending on windows version
if (!mozilla::IsWin2003OrLater()) { // windows xp
if (!IsWin2003OrLater()) { // windows xp
mSendBufferSize = 131072;
} else { // vista or later
mSendBufferSize = 131072 * 4;
@ -1376,7 +1376,7 @@ nsSocketTransportService::ClosePrivateConnections()
}
}
mozilla::ClearPrivateSSLState();
ClearPrivateSSLState();
}
NS_IMETHODIMP
@ -1553,3 +1553,6 @@ nsSocketTransportService::GetSocketConnections(nsTArray<SocketInfo> *data)
for (uint32_t i = 0; i < mIdleCount; i++)
AnalyzeConnection(data, &mIdleList[i], false);
}
} // namespace net
} // namespace mozilla

View File

@ -29,19 +29,22 @@ class nsIPrefBranch;
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
//
// set NSPR_LOG_MODULES=nsSocketTransport:5
//
extern mozilla::LazyLogModule gSocketTransportLog;
#define SOCKET_LOG(args) MOZ_LOG(gSocketTransportLog, mozilla::LogLevel::Debug, args)
#define SOCKET_LOG_ENABLED() MOZ_LOG_TEST(gSocketTransportLog, mozilla::LogLevel::Debug)
extern LazyLogModule gSocketTransportLog;
#define SOCKET_LOG(args) MOZ_LOG(gSocketTransportLog, LogLevel::Debug, args)
#define SOCKET_LOG_ENABLED() MOZ_LOG_TEST(gSocketTransportLog, LogLevel::Debug)
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)
extern LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, LogLevel::Debug)
//-----------------------------------------------------------------------------
@ -49,8 +52,6 @@ extern mozilla::LazyLogModule gUDPSocketLog;
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
// These maximums are borrowed from the linux kernel.
static const int32_t kMaxTCPKeepIdle = 32767; // ~9 hours.
static const int32_t kMaxTCPKeepIntvl = 32767;
@ -63,8 +64,6 @@ static const int32_t kDefaultTCPKeepCount =
#else
4; // Specifiable in Linux.
#endif
} // namespace net
} // namespace mozilla
//-----------------------------------------------------------------------------
@ -74,8 +73,6 @@ class nsSocketTransportService final : public nsPISocketTransportService
, public nsIRunnable
, public nsIObserver
{
typedef mozilla::Mutex Mutex;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSPISOCKETTRANSPORTSERVICE
@ -99,7 +96,7 @@ public:
// Called by the networking dashboard on the socket thread only
// Fills the passed array with socket information
void GetSocketConnections(nsTArray<mozilla::net::SocketInfo> *);
void GetSocketConnections(nsTArray<SocketInfo> *);
uint64_t GetSentBytes() { return mSentBytesCount; }
uint64_t GetReceivedBytes() { return mReceivedBytesCount; }
@ -119,8 +116,8 @@ private:
// misc (any thread)
//-------------------------------------------------------------------------
nsCOMPtr<nsIThread> mThread; // protected by mLock
mozilla::UniquePtr<mozilla::net::PollableEvent> mPollableEvent;
nsCOMPtr<nsIThread> mThread; // protected by mLock
UniquePtr<PollableEvent> mPollableEvent;
// Returns mThread, protecting the get-and-addref with mLock
already_AddRefed<nsIThread> GetThreadSafely();
@ -192,10 +189,10 @@ private:
PRPollDesc *mPollList; /* mListSize + 1 entries */
PRIntervalTime PollTimeout(); // computes ideal poll timeout
nsresult DoPollIteration(mozilla::TimeDuration *pollDuration);
nsresult DoPollIteration(TimeDuration *pollDuration);
// perfoms a single poll iteration
int32_t Poll(uint32_t *interval,
mozilla::TimeDuration *pollDuration);
TimeDuration *pollDuration);
// calls PR_Poll. the out param
// interval indicates the poll
// duration in seconds.
@ -206,7 +203,7 @@ private:
// pending socket queue - see NotifyWhenCanAttachSocket
//-------------------------------------------------------------------------
mozilla::Mutex mEventQueueLock;
Mutex mEventQueueLock;
nsEventQueue mPendingSocketQ; // queue of nsIRunnable objects
// Preference Monitor for SendBufferSize and Keepalive prefs.
@ -222,15 +219,15 @@ private:
// True if TCP keepalive is enabled globally.
bool mKeepaliveEnabledPref;
mozilla::Atomic<bool> mServingPendingQueue;
mozilla::Atomic<int32_t, mozilla::Relaxed> mMaxTimePerPollIter;
mozilla::Atomic<bool, mozilla::Relaxed> mTelemetryEnabledPref;
mozilla::Atomic<PRIntervalTime, mozilla::Relaxed> mMaxTimeForPrClosePref;
Atomic<bool> mServingPendingQueue;
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
Atomic<bool, Relaxed> mTelemetryEnabledPref;
Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref;
// Between a computer going to sleep and waking up the PR_*** telemetry
// will be corrupted - so do not record it.
mozilla::Atomic<bool, mozilla::Relaxed> mSleepPhase;
nsCOMPtr<nsITimer> mAfterWakeUpTimer;
Atomic<bool, Relaxed> mSleepPhase;
nsCOMPtr<nsITimer> mAfterWakeUpTimer;
void OnKeepaliveEnabledPrefChange();
void NotifyKeepaliveEnabledPrefChange(SocketContext *sock);
@ -241,7 +238,7 @@ private:
#endif
bool mProbedMaxCount;
void AnalyzeConnection(nsTArray<mozilla::net::SocketInfo> *data,
void AnalyzeConnection(nsTArray<SocketInfo> *data,
SocketContext *context, bool aActive);
void ClosePrivateConnections();
@ -253,6 +250,9 @@ private:
};
extern nsSocketTransportService *gSocketTransportService;
extern mozilla::Atomic<PRThread*, mozilla::Relaxed> gSocketThread;
extern Atomic<PRThread*, Relaxed> gSocketThread;
} // namespace net
} // namespace mozilla
#endif // !nsSocketTransportService_h__

View File

@ -28,6 +28,9 @@
using mozilla::dom::EncodingUtils;
using namespace mozilla::ipc;
namespace mozilla {
namespace net {
static NS_DEFINE_CID(kThisImplCID, NS_THIS_STANDARDURL_IMPL_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -40,13 +43,13 @@ char nsStandardURL::gHostLimitDigits[] = { '/', '\\', '?', '#', 0 };
//
// setenv NSPR_LOG_MODULES nsStandardURL:5
//
static mozilla::LazyLogModule gStandardURLLog("nsStandardURL");
static LazyLogModule gStandardURLLog("nsStandardURL");
// The Chromium code defines its own LOG macro which we don't want
#undef LOG
#define LOG(args) MOZ_LOG(gStandardURLLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gStandardURLLog, LogLevel::Debug, args)
#undef LOG_ENABLED
#define LOG_ENABLED() MOZ_LOG_TEST(gStandardURLLog, mozilla::LogLevel::Debug)
#define LOG_ENABLED() MOZ_LOG_TEST(gStandardURLLog, LogLevel::Debug)
//----------------------------------------------------------------------------
@ -622,7 +625,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
// generate the normalized URL string
//
// approxLen should be correct or 1 high
if (!mSpec.SetLength(approxLen+1, mozilla::fallible)) // buf needs a trailing '\0' below
if (!mSpec.SetLength(approxLen+1, fallible)) // buf needs a trailing '\0' below
return NS_ERROR_OUT_OF_MEMORY;
char *buf;
mSpec.BeginWriting(buf);
@ -3259,15 +3262,15 @@ nsStandardURL::Write(nsIObjectOutputStream *stream)
//---------------------------------------------------------------------------
inline
mozilla::ipc::StandardURLSegment
ipc::StandardURLSegment
ToIPCSegment(const nsStandardURL::URLSegment& aSegment)
{
return mozilla::ipc::StandardURLSegment(aSegment.mPos, aSegment.mLen);
return ipc::StandardURLSegment(aSegment.mPos, aSegment.mLen);
}
inline
nsStandardURL::URLSegment
FromIPCSegment(const mozilla::ipc::StandardURLSegment& aSegment)
FromIPCSegment(const ipc::StandardURLSegment& aSegment)
{
return nsStandardURL::URLSegment(aSegment.position(), aSegment.length());
}
@ -3426,7 +3429,7 @@ nsStandardURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
//----------------------------------------------------------------------------
size_t
nsStandardURL::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
nsStandardURL::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
return mSpec.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
mOriginCharset.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
@ -3439,6 +3442,9 @@ nsStandardURL::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
}
size_t
nsStandardURL::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
nsStandardURL::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
} // namespace net
} // namespace mozilla

View File

@ -33,6 +33,9 @@ class nsIPrefBranch;
class nsIFile;
class nsIURLParser;
namespace mozilla {
namespace net {
//-----------------------------------------------------------------------------
// standard URL implementation
//-----------------------------------------------------------------------------
@ -61,8 +64,8 @@ public:
NS_DECL_NSISENSITIVEINFOHIDDENURI
// nsISizeOf
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
explicit nsStandardURL(bool aSupportsFileURL = false, bool aTrackURL = true);
@ -389,4 +392,7 @@ nsStandardURL::Filename()
return Substring(mSpec, pos, len);
}
} // namespace net
} // namespace mozilla
#endif // nsStandardURL_h__

View File

@ -5,6 +5,9 @@
#include "nsStreamListenerTee.h"
#include "nsProxyRelease.h"
namespace mozilla {
namespace net {
NS_IMPL_ISUPPORTS(nsStreamListenerTee,
nsIStreamListener,
nsIRequestObserver,
@ -135,3 +138,6 @@ nsStreamListenerTee::InitAsync(nsIStreamListener *listener,
mEventTarget = eventTarget;
return Init(listener, sink, requestObserver);
}
} // namespace net
} // namespace mozilla

View File

@ -12,6 +12,9 @@
#include "nsCOMPtr.h"
#include "nsIEventTarget.h"
namespace mozilla {
namespace net {
class nsStreamListenerTee : public nsIStreamListenerTee
, public nsIThreadRetargetableStreamListener
{
@ -34,4 +37,7 @@ private:
nsCOMPtr<nsIEventTarget> mEventTarget;
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -7,6 +7,9 @@
#include "MainThreadUtils.h"
#endif
namespace mozilla {
namespace net {
NS_IMPL_ISUPPORTS(nsStreamListenerWrapper,
nsIStreamListener,
nsIRequestObserver,
@ -24,3 +27,6 @@ nsStreamListenerWrapper::CheckListenerChain()
}
return rv;
}
} // namespace net
} // namespace mozilla

View File

@ -11,6 +11,9 @@
#include "nsIThreadRetargetableStreamListener.h"
#include "mozilla/Attributes.h"
namespace mozilla {
namespace net {
// Wrapper class to make replacement of nsHttpChannel's listener
// from JavaScript possible. It is workaround for bug 433711 and 682305.
class nsStreamListenerWrapper final : public nsIStreamListener
@ -47,5 +50,8 @@ private:
nsCOMPtr<nsIStreamListener> mListener;
};
} // namespace net
} // namespace mozilla
#endif // nsStreamListenerWrapper_h__

View File

@ -11,6 +11,9 @@
#include <limits>
namespace mozilla {
namespace net {
nsStreamLoader::nsStreamLoader()
: mData()
{
@ -161,3 +164,6 @@ nsStreamLoader::CheckListenerChain()
{
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -14,6 +14,9 @@
class nsIRequest;
namespace mozilla {
namespace net {
class nsStreamLoader final : public nsIStreamLoader
, public nsIThreadRetargetableStreamListener
{
@ -49,4 +52,7 @@ protected:
mozilla::Vector<uint8_t, 0> mData;
};
} // namespace net
} // namespace mozilla
#endif // nsStreamLoader_h__

View File

@ -19,6 +19,9 @@
#include "nsIThreadPool.h"
#include "mozilla/Services.h"
namespace mozilla {
namespace net {
//-----------------------------------------------------------------------------
// nsInputStreamTransport
//
@ -594,3 +597,6 @@ nsStreamTransportService::Observe(nsISupports *subject, const char *topic,
}
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -2,6 +2,9 @@
* 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/. */
#ifndef nsStreamTransportService_h__
#define nsStreamTransportService_h__
#include "nsIStreamTransportService.h"
#include "nsIEventTarget.h"
#include "nsIObserver.h"
@ -12,6 +15,9 @@
class nsIThreadPool;
namespace mozilla {
namespace net {
class nsStreamTransportService final : public nsIStreamTransportService
, public nsIEventTarget
, public nsIObserver
@ -36,3 +42,7 @@ private:
mozilla::Mutex mShutdownLock;
bool mIsShutdown;
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -35,8 +35,8 @@
#include "NetStatistics.h"
#endif
using namespace mozilla::net;
using namespace mozilla;
namespace mozilla {
namespace net {
static const uint32_t UDP_PACKET_CHUNK_SIZE = 1400;
static NS_DEFINE_CID(kSocketTransportServiceCID2, NS_SOCKETTRANSPORTSERVICE_CID);
@ -195,7 +195,7 @@ nsUDPMessage::nsUDPMessage(NetAddr* aAddr,
nsUDPMessage::~nsUDPMessage()
{
mozilla::DropJSObjects(this);
DropJSObjects(this);
}
NS_IMETHODIMP
@ -229,8 +229,8 @@ nsUDPMessage::GetRawData(JSContext* cx,
JS::MutableHandleValue aRawData)
{
if(!mJsobj){
mJsobj = mozilla::dom::Uint8Array::Create(cx, nullptr, mData.Length(), mData.Elements());
mozilla::HoldJSObjects(this);
mJsobj = dom::Uint8Array::Create(cx, nullptr, mData.Length(), mData.Elements());
HoldJSObjects(this);
}
aRawData.setObject(*mJsobj);
return NS_OK;
@ -1585,3 +1585,6 @@ nsUDPSocket::SetMulticastInterfaceInternal(const PRNetAddr& aIface)
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -19,6 +19,9 @@
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
class nsUDPSocket final : public nsASocketHandler
, public nsIUDPSocket
{
@ -61,15 +64,15 @@ private:
// lock protects access to mListener;
// so mListener is not cleared while being used/locked.
mozilla::Mutex mLock;
PRFileDesc *mFD;
mozilla::net::NetAddr mAddr;
Mutex mLock;
PRFileDesc *mFD;
NetAddr mAddr;
uint32_t mAppId;
bool mIsInIsolatedMozBrowserElement;
nsCOMPtr<nsIUDPSocketListener> mListener;
nsCOMPtr<nsIEventTarget> mListenerTarget;
bool mAttached;
RefPtr<nsSocketTransportService> mSts;
RefPtr<nsSocketTransportService> mSts;
uint64_t mByteReadCount;
uint64_t mByteWriteCount;
@ -87,14 +90,14 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsUDPMessage)
NS_DECL_NSIUDPMESSAGE
nsUDPMessage(mozilla::net::NetAddr* aAddr,
nsUDPMessage(NetAddr* aAddr,
nsIOutputStream* aOutputStream,
FallibleTArray<uint8_t>& aData);
private:
virtual ~nsUDPMessage();
mozilla::net::NetAddr mAddr;
NetAddr mAddr;
nsCOMPtr<nsIOutputStream> mOutputStream;
FallibleTArray<uint8_t> mData;
JS::Heap<JSObject*> mJsobj;
@ -122,4 +125,7 @@ private:
bool mIsClosed;
};
} // namespace net
} // namespace mozilla
#endif // nsUDPSocket_h__

View File

@ -54,6 +54,7 @@ ContentSnifferCache* gDataSniffers = nullptr;
///////////////////////////////////////////////////////////////////////////////
#include "nsIOService.h"
typedef mozilla::net::nsIOService nsIOService;
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIOService, nsIOService::GetInstance)
#include "nsDNSService2.h"
@ -61,17 +62,21 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDNSService,
nsDNSService::GetXPCOMSingleton)
#include "nsProtocolProxyService.h"
typedef mozilla::net::nsProtocolProxyService nsProtocolProxyService;
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsProtocolProxyService, Init)
#include "nsStreamTransportService.h"
typedef mozilla::net::nsStreamTransportService nsStreamTransportService;
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStreamTransportService, Init)
#include "nsSocketTransportService2.h"
typedef mozilla::net::nsSocketTransportService nsSocketTransportService;
#undef LOG
#undef LOG_ENABLED
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSocketTransportService, Init)
#include "nsServerSocket.h"
typedef mozilla::net::nsServerSocket nsServerSocket;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsServerSocket)
#include "TLSServerSocket.h"
@ -79,6 +84,7 @@ typedef mozilla::net::TLSServerSocket TLSServerSocket;
NS_GENERIC_FACTORY_CONSTRUCTOR(TLSServerSocket)
#include "nsUDPSocket.h"
typedef mozilla::net::nsUDPSocket nsUDPSocket;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUDPSocket)
#include "nsUDPSocketProvider.h"
@ -91,6 +97,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAsyncStreamCopier)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsInputStreamPump)
#include "nsInputStreamChannel.h"
typedef mozilla::net::nsInputStreamChannel nsInputStreamChannel;
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsInputStreamChannel, Init)
#include "nsDownloader.h"
@ -113,6 +120,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileStream)
typedef mozilla::net::nsLoadGroup nsLoadGroup;
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsLoadGroup, Init)
#include "ArrayBufferInputStream.h"
@ -174,7 +182,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
#include "nsDirIndexParser.h"
#include "nsDirIndex.h"
typedef mozilla::net::nsRequestObserverProxy nsRequestObserverProxy;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRequestObserverProxy)
typedef mozilla::net::nsSimpleStreamListener nsSimpleStreamListener;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleStreamListener)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDirIndexParser, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirIndex)
@ -182,6 +192,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirIndex)
///////////////////////////////////////////////////////////////////////////////
#include "nsStreamListenerTee.h"
typedef mozilla::net::nsStreamListenerTee nsStreamListenerTee;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee)
///////////////////////////////////////////////////////////////////////////////
@ -209,6 +220,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWifiMonitor)
// about:blank is mandatory
#include "nsAboutProtocolHandler.h"
#include "nsAboutBlank.h"
typedef mozilla::net::nsAboutProtocolHandler nsAboutProtocolHandler;
typedef mozilla::net::nsSafeAboutProtocolHandler nsSafeAboutProtocolHandler;
typedef mozilla::net::nsNestedAboutURI nsNestedAboutURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeAboutProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURI)
@ -294,11 +308,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(SubstitutingURL)
#ifdef NECKO_PROTOCOL_device
#include "nsDeviceProtocolHandler.h"
typedef mozilla::net::nsDeviceProtocolHandler nsDeviceProtocolHandler;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceProtocolHandler)
#endif
#ifdef NECKO_PROTOCOL_viewsource
#include "nsViewSourceHandler.h"
typedef mozilla::net::nsViewSourceHandler nsViewSourceHandler;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewSourceHandler)
#endif
@ -375,10 +391,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthURLParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStdURLParser)
#include "nsStandardURL.h"
typedef mozilla::net::nsStandardURL nsStandardURL;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURL)
typedef mozilla::net::nsSimpleURI nsSimpleURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleURI)
typedef mozilla::net::nsSimpleNestedURI nsSimpleNestedURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleNestedURI)
///////////////////////////////////////////////////////////////////////////////
@ -476,6 +494,7 @@ static const mozilla::Module::CategoryEntry kNeckoCategories[] = {
};
#ifdef BUILD_BINHEX_DECODER
typedef mozilla::net::nsBinHexDecoder nsBinHexDecoder;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinHexDecoder)
#endif
@ -855,7 +874,7 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_ASYNCSTREAMCOPIER_CID, false, nullptr, nsAsyncStreamCopierConstructor },
{ &kNS_INPUTSTREAMPUMP_CID, false, nullptr, nsInputStreamPumpConstructor },
{ &kNS_INPUTSTREAMCHANNEL_CID, false, nullptr, nsInputStreamChannelConstructor },
{ &kNS_STREAMLOADER_CID, false, nullptr, nsStreamLoader::Create },
{ &kNS_STREAMLOADER_CID, false, nullptr, mozilla::net::nsStreamLoader::Create },
{ &kNS_INCREMENTALSTREAMLOADER_CID, false, nullptr, nsIncrementalStreamLoader::Create },
{ &kNS_UNICHARSTREAMLOADER_CID, false, nullptr, nsUnicharStreamLoader::Create },
{ &kNS_DOWNLOADER_CID, false, nullptr, nsDownloaderConstructor },

View File

@ -44,6 +44,7 @@
#include <algorithm>
using namespace mozilla;
using namespace mozilla::net;
/******************************************************************************
* nsCacheProfilePrefObserver

View File

@ -21,6 +21,9 @@
#include "nsIChannel.h"
#include "nsIScriptError.h"
namespace mozilla {
namespace net {
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
static NS_DEFINE_CID(kNestedAboutURICID, NS_NESTEDABOUTURI_CID);
@ -418,3 +421,6 @@ nsNestedAboutURI::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
*aClassIDNoAlloc = kNestedAboutURICID;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -13,6 +13,9 @@
class nsIURI;
namespace mozilla {
namespace net {
class nsAboutProtocolHandler : public nsIProtocolHandlerWithDynamicFlags
, public nsIProtocolHandler
, public nsSupportsWeakReference
@ -80,4 +83,7 @@ protected:
nsCOMPtr<nsIURI> mBaseURI;
};
} // namespace net
} // namespace mozilla
#endif /* nsAboutProtocolHandler_h___ */

View File

@ -8,8 +8,10 @@
#include "nsAutoPtr.h"
#include "nsSimpleURI.h"
//-----------------------------------------------------------------------------
namespace mozilla {
namespace net {
//-----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS(nsDeviceProtocolHandler,
nsIProtocolHandler)
@ -86,3 +88,6 @@ nsDeviceProtocolHandler::AllowPort(int32_t port,
*aResult = false;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -9,6 +9,9 @@
#include "nsIProtocolHandler.h"
#include "mozilla/Attributes.h"
namespace mozilla {
namespace net {
// {6b0ffe9e-d114-486b-aeb7-da62e7273ed5}
#define NS_DEVICEPROTOCOLHANDLER_CID \
{ 0x60ffe9e, 0xd114, 0x486b, \
@ -26,4 +29,6 @@ public:
nsresult Init();
};
} // namespace net
} // namespace mozilla
#endif

View File

@ -27,10 +27,9 @@ https://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-06
#include "nsIInterfaceRequestor.h"
#include "nsISpeculativeConnect.h"
class nsProxyInfo;
namespace mozilla { namespace net {
class nsProxyInfo;
class nsHttpConnectionInfo;
class AltSvcMapping

View File

@ -15,13 +15,13 @@
#include "nsISupportsPriority.h"
#include "SimpleBuffer.h"
class nsStandardURL;
class nsIInputStream;
class nsIOutputStream;
namespace mozilla {
namespace net {
class nsStandardURL;
class Http2Session;
class Http2Decompressor;

View File

@ -14,12 +14,11 @@
#include "nsString.h"
#include "prtime.h"
class nsProxyInfo;
class nsHttpChannel;
namespace mozilla {
namespace net {
class nsProxyInfo;
class NullHttpChannel final
: public nsINullChannel
, public nsIHttpChannel

View File

@ -29,10 +29,12 @@ class nsISiteSecurityService;
class nsIStreamConverterService;
class nsITimer;
extern mozilla::Atomic<PRThread*, mozilla::Relaxed> gSocketThread;
namespace mozilla {
namespace net {
extern Atomic<PRThread*, Relaxed> gSocketThread;
class ATokenBucketEvent;
class EventTokenBucket;
class Tickler;

View File

@ -21,6 +21,7 @@
#include "LoadInfo.h"
namespace mozilla {
namespace net {
NS_IMPL_QUERY_INTERFACE(ExtensionProtocolHandler, nsISubstitutingProtocolHandler,
nsIProtocolHandler, nsIProtocolHandlerWithDynamicFlags,
@ -124,7 +125,7 @@ ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo =
static_cast<mozilla::LoadInfo*>(aLoadInfo)->CloneForNewRequest();
static_cast<LoadInfo*>(aLoadInfo)->CloneForNewRequest();
(*result)->SetLoadInfo(loadInfo);
rv = (*result)->AsyncOpen2(converter);
@ -155,4 +156,5 @@ ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -10,17 +10,18 @@
#include "nsWeakReference.h"
namespace mozilla {
namespace net {
class ExtensionProtocolHandler final : public nsISubstitutingProtocolHandler,
public nsIProtocolHandlerWithDynamicFlags,
public mozilla::SubstitutingProtocolHandler,
public SubstitutingProtocolHandler,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIPROTOCOLHANDLERWITHDYNAMICFLAGS
NS_FORWARD_NSIPROTOCOLHANDLER(mozilla::SubstitutingProtocolHandler::)
NS_FORWARD_NSISUBSTITUTINGPROTOCOLHANDLER(mozilla::SubstitutingProtocolHandler::)
NS_FORWARD_NSIPROTOCOLHANDLER(SubstitutingProtocolHandler::)
NS_FORWARD_NSISUBSTITUTINGPROTOCOLHANDLER(SubstitutingProtocolHandler::)
ExtensionProtocolHandler() : SubstitutingProtocolHandler("moz-extension") {}
@ -43,6 +44,7 @@ protected:
virtual nsresult SubstituteChannel(nsIURI* uri, nsILoadInfo* aLoadInfo, nsIChannel** result) override;
};
} // namespace net
} // namespace mozilla
#endif /* ExtensionProtocolHandler_h___ */

View File

@ -20,6 +20,7 @@
using mozilla::dom::ContentParent;
namespace mozilla {
namespace net {
// Log module for Substituting Protocol logging. We keep the pre-existing module
// name of "nsResProtocol" to avoid disruption.
@ -396,4 +397,5 @@ SubstitutingProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
return rv;
}
} // namespace net
} // namespace mozilla

View File

@ -18,6 +18,7 @@
class nsIIOService;
namespace mozilla {
namespace net {
//
// Base class for resource://-like substitution protocols.
@ -97,6 +98,7 @@ public:
NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID);
};
} // namespace net
} // namespace mozilla
#endif /* SubstitutingProtocolHandler_h___ */

View File

@ -11,6 +11,9 @@
#define VIEW_SOURCE "view-source"
namespace mozilla {
namespace net {
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS(nsViewSourceHandler, nsIProtocolHandler)
@ -167,3 +170,6 @@ nsViewSourceHandler::GetInstance()
{
return gInstance;
}
} // namespace net
} // namespace mozilla

View File

@ -12,6 +12,9 @@
class nsILoadInfo;
namespace mozilla {
namespace net {
class nsViewSourceHandler final : public nsIProtocolHandler
{
public:
@ -36,4 +39,7 @@ private:
static nsViewSourceHandler* gInstance;
};
} // namespace net
} // namespace mozilla
#endif /* !defined( nsViewSourceHandler_h___ ) */

View File

@ -77,6 +77,7 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDNSService,
nsDNSService::GetXPCOMSingleton)
#include "nsSocketTransportService2.h"
typedef mozilla::net::nsSocketTransportService nsSocketTransportService;
#undef LOG
#undef LOG_ENABLED
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSocketTransportService, Init)

View File

@ -20,6 +20,9 @@
#include "nsMimeTypes.h"
#include <algorithm>
namespace mozilla {
namespace net {
nsBinHexDecoder::nsBinHexDecoder() :
mState(0), mCRC(0), mFileCRC(0), mOctetin(26),
mDonePos(3), mInCRC(0), mCount(0), mMarker(0), mPosInbuff(0),
@ -508,3 +511,6 @@ nsBinHexDecoder::OnStopRequest(nsIRequest* request, nsISupports *aCtxt,
return rv;
}
} // namespace net
} // namespace mozilla

View File

@ -33,6 +33,9 @@
{ 0x89, 0x45, 0x81, 0xf7, 0xdb, 0xc2, 0x18, 0x6b } \
}
namespace mozilla {
namespace net {
typedef struct _binhex_header
{
uint32_t type, creator;
@ -117,4 +120,7 @@ protected:
int32_t mPosOutputBuff; /* the position of the out buff. */
};
} // namespace net
} // namespace mozilla
#endif /* nsBinHexDecoder_h__ */