diff --git a/docshell/build/components.conf b/docshell/build/components.conf index bcc6542d673c..2325e099a67f 100644 --- a/docshell/build/components.conf +++ b/docshell/build/components.conf @@ -180,6 +180,7 @@ if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android': else: Classes += [ { + 'name': 'Mime', 'cid': '{a7f800e0-4306-11d4-98d0-001083010e9b}', 'contract_ids': [ '@mozilla.org/mime;1', diff --git a/intl/uconv/components.conf b/intl/uconv/components.conf index 00686f661a92..7476f1293814 100644 --- a/intl/uconv/components.conf +++ b/intl/uconv/components.conf @@ -24,6 +24,7 @@ Classes = [ 'headers': ['/intl/uconv/nsScriptableUConv.h'], }, { + 'name': 'TextToSubURI', 'js_name': 'textToSubURI', 'cid': '{8b042e22-6f87-11d3-b3c8-00805f8a6670}', 'contract_ids': ['@mozilla.org/intl/texttosuburi;1'], diff --git a/layout/build/components.conf b/layout/build/components.conf index eb834a20a171..2df60e3a84da 100644 --- a/layout/build/components.conf +++ b/layout/build/components.conf @@ -112,6 +112,7 @@ Classes = [ 'init_method': 'Init', }, { + 'name': 'ContentSecurityManager', 'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}', 'contract_ids': ['@mozilla.org/contentsecuritymanager;1'], 'type': 'nsContentSecurityManager', @@ -363,6 +364,7 @@ Classes = [ 'headers': ['/dom/bindings/nsScriptError.h'], }, { + 'name': 'ScriptSecurityManager', 'js_name': 'scriptSecurityManager', 'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}', 'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'], diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp index 3af6b8eb2664..00bfae85c718 100644 --- a/netwerk/base/BackgroundFileSaver.cpp +++ b/netwerk/base/BackgroundFileSaver.cpp @@ -8,6 +8,7 @@ #include "ScopedNSSTypes.h" #include "mozilla/ArrayAlgorithm.h" +#include "mozilla/Components.h" #include "mozilla/Casting.h" #include "mozilla/Logging.h" #include "mozilla/ScopeExit.h" @@ -195,7 +196,7 @@ BackgroundFileSaver::EnableSha256() { // Ensure Personal Security Manager is initialized. This is required for // PK11_* operations to work. nsresult rv; - nsCOMPtr nssDummy = do_GetService("@mozilla.org/psm;1", &rv); + mozilla::components::NSSComponent::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); MutexAutoLock lock(mLock); mSha256Enabled = true; // this will be read by the worker thread @@ -220,7 +221,7 @@ BackgroundFileSaver::EnableSignatureInfo() { "Can't enable signature extraction off the main thread"); // Ensure Personal Security Manager is initialized. nsresult rv; - nsCOMPtr nssDummy = do_GetService("@mozilla.org/psm;1", &rv); + mozilla::components::NSSComponent::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); MutexAutoLock lock(mLock); mSignatureInfoEnabled = true; diff --git a/netwerk/base/Dashboard.cpp b/netwerk/base/Dashboard.cpp index bc1619ee6095..f69d355327d6 100644 --- a/netwerk/base/Dashboard.cpp +++ b/netwerk/base/Dashboard.cpp @@ -4,6 +4,7 @@ #include "mozilla/dom/NetDashboardBinding.h" #include "mozilla/dom/ToJSValue.h" +#include "mozilla/Components.h" #include "mozilla/ErrorNames.h" #include "mozilla/net/Dashboard.h" #include "mozilla/net/HttpInfo.h" @@ -821,7 +822,7 @@ Dashboard::RequestDNSInfo(nsINetDashboardCallback* aCallback) { dnsData->mEventTarget = GetCurrentSerialEventTarget(); if (!mDnsService) { - mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); + mDnsService = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -931,7 +932,7 @@ Dashboard::RequestDNSLookup(const nsACString& aHost, nsresult rv; if (!mDnsService) { - mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); + mDnsService = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -955,7 +956,7 @@ Dashboard::RequestDNSHTTPSRRLookup(const nsACString& aHost, nsresult rv; if (!mDnsService) { - mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); + mDnsService = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -1150,8 +1151,7 @@ using ErrorEntry = struct { }; #undef ERROR -#define ERROR(key, val) \ - { key, #key } +#define ERROR(key, val) {key, #key} ErrorEntry socketTransportStatuses[] = { ERROR(NS_NET_STATUS_RESOLVING_HOST, FAILURE(3)), diff --git a/netwerk/base/EventTokenBucket.cpp b/netwerk/base/EventTokenBucket.cpp index 87179d6732db..bcace902cf79 100644 --- a/netwerk/base/EventTokenBucket.cpp +++ b/netwerk/base/EventTokenBucket.cpp @@ -12,6 +12,9 @@ #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsSocketTransportService2.h" + +#include "mozilla/Components.h" + #ifdef DEBUG # include "MainThreadUtils.h" #endif @@ -91,7 +94,7 @@ EventTokenBucket::EventTokenBucket(uint32_t eventsPerSecond, uint32_t burstSize) nsCOMPtr sts; nsCOMPtr ioService = do_GetIOService(&rv); if (NS_SUCCEEDED(rv)) { - sts = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + sts = mozilla::components::SocketTransport::Service(&rv); } if (NS_SUCCEEDED(rv)) mTimer = NS_NewTimer(sts); SetRate(eventsPerSecond, burstSize); diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index 0c604d9d9abc..ee964cdaef9e 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -33,6 +33,7 @@ #include "nsThreadUtils.h" #include "mozilla/Logging.h" +#include "mozilla/Components.h" #include "mozilla/OriginAttributes.h" #include "mozilla/Preferences.h" #include "mozilla/SchedulerGroup.h" @@ -365,17 +366,16 @@ nsresult Predictor::Init() { mDNSListener = new DNSListener(); } - mCacheStorageService = - do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv); + mCacheStorageService = mozilla::components::CacheStorage::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); - mSpeculativeService = do_GetService("@mozilla.org/network/io-service;1", &rv); + mSpeculativeService = mozilla::components::IO::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); rv = NS_NewURI(getter_AddRefs(mStartupURI), "predictor://startup"); NS_ENSURE_SUCCESS(rv, rv); - mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); + mDnsService = mozilla::components::DNS::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); mInitialized = true; @@ -1923,8 +1923,8 @@ static nsresult EnsureGlobalPredictor(nsINetworkPredictor** aPredictor) { if (!sPredictor) { nsresult rv; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); sPredictor = predictor; ClearOnShutdown(&sPredictor); diff --git a/netwerk/base/TLSServerSocket.cpp b/netwerk/base/TLSServerSocket.cpp index 131ea50573b3..67008f13554b 100644 --- a/netwerk/base/TLSServerSocket.cpp +++ b/netwerk/base/TLSServerSocket.cpp @@ -6,6 +6,7 @@ #include "TLSServerSocket.h" #include "mozilla/net/DNS.h" +#include "mozilla/Components.h" #include "nsComponentManagerUtils.h" #include "nsDependentSubstring.h" #include "nsIServerSocket.h" @@ -391,8 +392,8 @@ nsresult TLSServerConnectionInfo::HandshakeCallback(PRFileDesc* aFD) { UniqueCERTCertificate clientCert(SSL_PeerCertificate(aFD)); if (clientCert) { - nsCOMPtr certDB = - do_GetService(NS_X509CERTDB_CONTRACTID, &rv); + nsCOMPtr certDB; + certDB = mozilla::components::NSSConstructor::Service(&rv); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/base/ThrottleQueue.cpp b/netwerk/base/ThrottleQueue.cpp index 4313a6ecb3a2..83ab30efbe85 100644 --- a/netwerk/base/ThrottleQueue.cpp +++ b/netwerk/base/ThrottleQueue.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ThrottleQueue.h" +#include "mozilla/Components.h" #include "mozilla/net/InputChannelThrottleQueueParent.h" #include "nsISeekableStream.h" #include "nsIAsyncInputStream.h" @@ -251,7 +252,7 @@ ThrottleQueue::ThrottleQueue() nsCOMPtr sts; nsCOMPtr ioService = do_GetIOService(&rv); if (NS_SUCCEEDED(rv)) { - sts = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + sts = mozilla::components::SocketTransport::Service(&rv); } if (NS_SUCCEEDED(rv)) mTimer = NS_NewTimer(sts); } diff --git a/netwerk/base/nsAsyncStreamCopier.cpp b/netwerk/base/nsAsyncStreamCopier.cpp index de8363d17df6..ffcfafc9da9c 100644 --- a/netwerk/base/nsAsyncStreamCopier.cpp +++ b/netwerk/base/nsAsyncStreamCopier.cpp @@ -12,6 +12,7 @@ #include "nsNetCID.h" #include "nsIBufferedStreams.h" #include "nsIRequestObserver.h" +#include "mozilla/Components.h" #include "mozilla/Logging.h" using namespace mozilla; @@ -251,7 +252,7 @@ nsresult nsAsyncStreamCopier::InitInternal( mTarget = target; } else { nsresult rv; - mTarget = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); + mTarget = mozilla::components::StreamTransport::Service(&rv); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index f11435f81bb4..4d46fb227250 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -41,6 +41,7 @@ #include "nsThreadUtils.h" #include "WebTransportSessionProxy.h" #include "mozilla/AppShutdown.h" +#include "mozilla/Components.h" #include "mozilla/LoadInfo.h" #include "mozilla/net/NeckoCommon.h" #include "mozilla/Services.h" @@ -452,7 +453,7 @@ nsresult nsIOService::InitializeCaptivePortalService() { return NS_OK; } - mCaptivePortalService = do_GetService(NS_CAPTIVEPORTAL_CID); + mCaptivePortalService = mozilla::components::CaptivePortal::Service(); if (mCaptivePortalService) { static_cast(mCaptivePortalService.get()) ->Initialize(); @@ -477,7 +478,7 @@ nsresult nsIOService::InitializeSocketTransportService() { if (!mSocketTransportService) { mSocketTransportService = - do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + mozilla::components::SocketTransport::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("failed to get socket transport service"); } @@ -507,7 +508,7 @@ nsresult nsIOService::InitializeNetworkLinkService() { return NS_ERROR_NOT_AVAILABLE; } - mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); + mNetworkLinkService = mozilla::components::NetworkLink::Service(&rv); if (mNetworkLinkService) { mNetworkLinkServiceInitialized = true; @@ -524,7 +525,7 @@ nsresult nsIOService::InitializeProtocolProxyService() { if (XRE_IsParentProcess()) { // for early-initialization - Unused << do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + Unused << mozilla::components::ProtocolProxy::Service(&rv); } return rv; @@ -853,8 +854,8 @@ nsresult nsIOService::AsyncOnChannelRedirect( // This is silly. I wish there was a simpler way to get at the global // reference of the contentSecurityManager. But it lives in the XPCOM // service registry. - nsCOMPtr sink = - do_GetService(NS_CONTENTSECURITYMANAGER_CONTRACTID); + nsCOMPtr sink; + sink = mozilla::components::ContentSecurityManager::Service(); if (sink) { nsresult rv = helper->DelegateOnChannelRedirect(sink, oldChan, newChan, flags); @@ -1190,8 +1191,8 @@ nsresult nsIOService::NewChannelFromURIWithProxyFlagsInternal( if (!gHasWarnedUploadChannel2 && scheme.EqualsLiteral("http")) { nsCOMPtr uploadChannel2 = do_QueryInterface(channel); if (!uploadChannel2) { - nsCOMPtr consoleService = - do_GetService(NS_CONSOLESERVICE_CONTRACTID); + nsCOMPtr consoleService; + consoleService = mozilla::components::Console::Service(); if (consoleService) { consoleService->LogStringMessage( u"Http channel implementation " @@ -1706,8 +1707,7 @@ nsIOService::Observe(nsISupports* subject, const char* topic, // Bug 870460 - Read cookie database at an early-as-possible time // off main thread. Hence, we have more chance to finish db query // before something calls into the cookie service. - nsCOMPtr cookieServ = - do_GetService(NS_COOKIESERVICE_CONTRACTID); + mozilla::components::Cookies::Service(); } } else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { // Remember we passed XPCOM shutdown notification to prevent any @@ -2051,8 +2051,8 @@ nsresult nsIOService::SpeculativeConnectInternal( // speculative connect should not be performed because the potential // reward is slim with tcp peers closely located to the browser. nsresult rv; - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr loadingPrincipal = aPrincipal; diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp index 413fbd3ed659..b700c7e0dd31 100644 --- a/netwerk/base/nsNetUtil.cpp +++ b/netwerk/base/nsNetUtil.cpp @@ -128,7 +128,8 @@ using mozilla::dom::ServiceWorkerDescriptor; #define MAX_RECURSION_COUNT 50 already_AddRefed do_GetIOService(nsresult* error /* = 0 */) { - nsCOMPtr io = mozilla::components::IO::Service(); + nsCOMPtr io; + io = mozilla::components::IO::Service(); if (error) *error = io ? NS_OK : NS_ERROR_FAILURE; return io.forget(); } @@ -1132,8 +1133,8 @@ nsresult NS_CheckPortSafety(nsIURI* uri) { nsresult NS_NewProxyInfo(const nsACString& type, const nsACString& host, int32_t port, uint32_t flags, nsIProxyInfo** result) { nsresult rv; - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(&rv); if (NS_SUCCEEDED(rv)) { rv = pps->NewProxyInfo(type, host, port, ""_ns, ""_ns, flags, UINT32_MAX, nullptr, result); @@ -1222,8 +1223,10 @@ void NS_GetReferrerFromChannel(nsIChannel* channel, nsIURI** referrer) { } already_AddRefed do_GetNetUtil(nsresult* error /* = 0 */) { - nsCOMPtr io = mozilla::components::IO::Service(); + nsCOMPtr io; nsCOMPtr util; + + io = mozilla::components::IO::Service(); if (io) util = do_QueryInterface(io); if (error) *error = !!util ? NS_OK : NS_ERROR_FAILURE; @@ -1556,8 +1559,8 @@ class BufferWriter final : public nsIInputStreamCallback { NS_ASSERT_OWNINGTHREAD(BufferWriter); if (!mTaskQueue) { - nsCOMPtr target = - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); + nsCOMPtr target; + target = mozilla::components::StreamTransport::Service(); if (!target) { return NS_ERROR_FAILURE; } @@ -2216,8 +2219,8 @@ bool NS_IsSafeMethodNav(nsIChannel* aChannel) { void NS_WrapAuthPrompt(nsIAuthPrompt* aAuthPrompt, nsIAuthPrompt2** aAuthPrompt2) { - nsCOMPtr factory = - do_GetService(NS_AUTHPROMPT_ADAPTER_FACTORY_CONTRACTID); + nsCOMPtr factory; + factory = mozilla::components::AuthPromptAdapter::Service(); if (!factory) return; NS_WARNING("Using deprecated nsIAuthPrompt"); @@ -2719,8 +2722,8 @@ uint32_t NS_GetContentDispositionFromToken(const nsAString& aDispToken) { uint32_t NS_GetContentDispositionFromHeader(const nsACString& aHeader, nsIChannel* aChan /* = nullptr */) { nsresult rv; - nsCOMPtr mimehdrpar = - do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); + nsCOMPtr mimehdrpar; + mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv); if (NS_FAILED(rv)) return nsIChannel::DISPOSITION_ATTACHMENT; nsAutoString dispToken; @@ -2743,8 +2746,8 @@ nsresult NS_GetFilenameFromDisposition(nsAString& aFilename, aFilename.Truncate(); nsresult rv; - nsCOMPtr mimehdrpar = - do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); + nsCOMPtr mimehdrpar; + mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv); if (NS_FAILED(rv)) return rv; // Get the value of 'filename' parameter @@ -2760,8 +2763,8 @@ nsresult NS_GetFilenameFromDisposition(nsAString& aFilename, // Filename may still be percent-encoded. Fix: if (aFilename.FindChar('%') != -1) { - nsCOMPtr textToSubURI = - do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); + nsCOMPtr textToSubURI; + textToSubURI = mozilla::components::TextToSubURI::Service(&rv); if (NS_SUCCEEDED(rv)) { nsAutoString unescaped; textToSubURI->UnEscapeURIForUI(NS_ConvertUTF16toUTF8(aFilename), @@ -3511,8 +3514,8 @@ already_AddRefed TryChangeProtocol(nsIURI* aURI, // passed value alone) static bool Decode5987Format(nsAString& aEncoded) { nsresult rv; - nsCOMPtr mimehdrpar = - do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); + nsCOMPtr mimehdrpar; + mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv); if (NS_FAILED(rv)) return false; nsAutoCString asciiValue; diff --git a/netwerk/base/nsStreamTransportService.cpp b/netwerk/base/nsStreamTransportService.cpp index 19776b2ac2d8..37e56ceb63c9 100644 --- a/netwerk/base/nsStreamTransportService.cpp +++ b/netwerk/base/nsStreamTransportService.cpp @@ -17,6 +17,7 @@ #include "nsITransport.h" #include "nsIObserverService.h" #include "nsThreadPool.h" +#include "mozilla/Components.h" #include "mozilla/Services.h" namespace mozilla { @@ -91,8 +92,8 @@ nsInputStreamTransport::OpenInputStream(uint32_t flags, uint32_t segsize, NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); nsresult rv; - nsCOMPtr target = - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); + nsCOMPtr target; + target = mozilla::components::StreamTransport::Service(&rv); if (NS_FAILED(rv)) return rv; // XXX if the caller requests an unbuffered stream, then perhaps diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index 70177f289e08..e4f1efc9456e 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -3,7 +3,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/. */ +#include "Predictor.h" #include "mozilla/Attributes.h" +#include "mozilla/Components.h" #include "mozilla/EndianUtils.h" #include "mozilla/dom/TypedArray.h" #include "mozilla/HoldDropJSObjects.h" @@ -60,8 +62,8 @@ static nsresult ResolveHost(const nsACString& host, nsIDNSListener* listener) { nsresult rv; - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1", &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -245,8 +247,7 @@ nsUDPSocket::nsUDPSocket() { // constructed yet. the STS constructor sets gSocketTransportService. if (!gSocketTransportService) { // This call can fail if we're offline, for example. - nsCOMPtr sts = - do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID); + mozilla::components::SocketTransport::Service(); } mSts = gSocketTransportService; diff --git a/netwerk/build/components.conf b/netwerk/build/components.conf index bebf9695e4a0..538191ff6524 100644 --- a/netwerk/build/components.conf +++ b/netwerk/build/components.conf @@ -100,6 +100,7 @@ Classes = [ 'headers': ['/netwerk/base/nsBufferedStreams.h'], }, { + 'name': 'CaptivePortal', 'cid': '{bdbe0555-fc3d-4f7b-9205-c309ceb2d641}', 'contract_ids': ['@mozilla.org/network/captive-portal-service;1'], 'singleton': True, @@ -108,6 +109,7 @@ Classes = [ 'headers': ['mozilla/net/CaptivePortalService.h'], }, { + 'name': 'Dashboard', 'cid': '{c79eb3c6-091a-45a6-8544-5a8d1ab79537}', 'contract_ids': ['@mozilla.org/network/dashboard;1'], 'type': 'mozilla::net::Dashboard', @@ -141,6 +143,7 @@ Classes = [ 'headers': ['/netwerk/base/nsDownloader.h'], }, { + 'name': 'EffectiveTLD', 'js_name': 'eTLD', 'cid': '{cb9abbae-66b6-4609-8594-5c4ff300888e}', 'contract_ids': ['@mozilla.org/network/effective-tld-service;1'], @@ -184,6 +187,7 @@ Classes = [ 'init_method': 'Init', }, { + 'name': 'IDN', 'cid': '{62b778a6-bce3-456b-8c31-2865fbb68c91}', 'contract_ids': ['@mozilla.org/network/idn-service;1'], 'type': 'nsIDNService', @@ -235,6 +239,7 @@ Classes = [ 'legacy_constructor': 'nsLoadGroupConstructor', }, { + 'name': 'MimeHeaderParam', 'cid': '{1f4dbcf7-245c-4c8c-943d-8a1da0495e8a}', 'contract_ids': ['@mozilla.org/network/mime-hdrparam;1'], 'type': 'nsMIMEHeaderParamImpl', @@ -255,6 +260,7 @@ Classes = [ 'headers': ['mozilla/net/NetworkConnectivityService.h'], }, { + 'name': 'Predictor', 'cid': '{969adfdf-7221-4419-aecf-05f8faf00c9b}', 'contract_ids': ['@mozilla.org/network/predictor;1'], 'singleton': True, @@ -262,6 +268,7 @@ Classes = [ 'headers': ['mozilla/net/Predictor.h'], }, { + 'name': 'ProtocolProxy', 'cid': '{e9b301c0-e0e4-11d3-a1a8-0050041caf44}', 'contract_ids': ['@mozilla.org/network/protocol-proxy-service;1'], 'singleton': True, @@ -324,6 +331,7 @@ Classes = [ }, }, { + 'name': 'FileProtocolHandler', 'cid': '{fbc81170-1f69-11d3-9344-00104ba0fd40}', 'contract_ids': ['@mozilla.org/network/protocol;1?name=file'], 'singleton': True, @@ -341,6 +349,7 @@ Classes = [ }, }, { + 'name': 'HttpHandler', 'cid': '{4f47e42e-4d23-4dd3-bfda-eb29255e9ea3}', 'contract_ids': ['@mozilla.org/network/protocol;1?name=http'], 'singleton': True, @@ -621,6 +630,7 @@ Classes = [ 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, }, { + 'name': 'StreamConverter', 'cid': '{892ffeb0-3f80-11d3-a16c-0050041caf44}', 'contract_ids': ['@mozilla.org/streamConverters;1'], 'legacy_constructor': 'CreateNewStreamConvServiceFactory', @@ -723,6 +733,7 @@ Classes = [ 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, }, { + 'name': 'Cookies', 'js_name': 'cookies', 'cid': '{c375fa80-150f-11d6-a618-0010a401eb10}', 'contract_ids': [ @@ -792,6 +803,7 @@ elif buildconfig.substs['OS_ARCH'] == 'Linux': if link_service: Classes += [ dict({ + 'name': 'NetworkLink', 'cid': '{75a500a2-0030-40f7-86f8-63f225b940ae}', 'contract_ids': ['@mozilla.org/network/network-link-service;1'], 'singleton': True, diff --git a/netwerk/cookie/CookieService.cpp b/netwerk/cookie/CookieService.cpp index 18663a4541f6..c148b6bde0b7 100644 --- a/netwerk/cookie/CookieService.cpp +++ b/netwerk/cookie/CookieService.cpp @@ -254,13 +254,13 @@ CookieService::CookieService() = default; nsresult CookieService::Init() { nsresult rv; - mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv); + mTLDService = mozilla::components::EffectiveTLD::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); - mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv); + mIDNService = mozilla::components::IDN::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); - mThirdPartyUtil = do_GetService(THIRDPARTYUTIL_CONTRACTID); + mThirdPartyUtil = mozilla::components::ThirdPartyUtil::Service(); NS_ENSURE_SUCCESS(rv, rv); // Init our default, and possibly private CookieStorages. diff --git a/netwerk/dns/DNSRequestParent.cpp b/netwerk/dns/DNSRequestParent.cpp index 09213b59ba74..eefd05f44660 100644 --- a/netwerk/dns/DNSRequestParent.cpp +++ b/netwerk/dns/DNSRequestParent.cpp @@ -12,6 +12,7 @@ #include "nsICancelable.h" #include "nsIDNSRecord.h" #include "nsHostResolver.h" +#include "mozilla/Components.h" #include "mozilla/Unused.h" #include "DNSAdditionalInfo.h" #include "nsServiceManagerUtils.h" @@ -43,7 +44,8 @@ void DNSRequestHandler::DoAsyncResolve(const nsACString& hostname, nsIDNSService::DNSFlags flags) { nsresult rv; mFlags = flags; - nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr main = GetMainThreadSerialEventTarget(); nsCOMPtr unused; @@ -66,7 +68,8 @@ void DNSRequestHandler::OnRecvCancelDNSRequest( const uint16_t& type, const OriginAttributes& originAttributes, const nsIDNSService::DNSFlags& flags, const nsresult& reason) { nsresult rv; - nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); if (NS_SUCCEEDED(rv)) { RefPtr info; if (!aTrrServer.IsEmpty() || port != -1) { diff --git a/netwerk/dns/TRRServiceChild.cpp b/netwerk/dns/TRRServiceChild.cpp index 37be446f8f77..8e04116120ef 100644 --- a/netwerk/dns/TRRServiceChild.cpp +++ b/netwerk/dns/TRRServiceChild.cpp @@ -6,6 +6,7 @@ #include "mozilla/net/TRRServiceChild.h" #include "mozilla/Atomics.h" +#include "mozilla/Components.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" @@ -42,8 +43,8 @@ TRRServiceChild* TRRServiceChild::GetSingleton() { void TRRServiceChild::Init(const bool& aCaptiveIsPassed, const bool& aParentalControlEnabled, nsTArray&& aDNSSuffixList) { - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1"); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(); sDNSService = dns; ClearOnShutdown(&sDNSService); MOZ_ASSERT(sDNSService); diff --git a/netwerk/dns/nsEffectiveTLDService.cpp b/netwerk/dns/nsEffectiveTLDService.cpp index fc9e8c069209..d831b382b1f1 100644 --- a/netwerk/dns/nsEffectiveTLDService.cpp +++ b/netwerk/dns/nsEffectiveTLDService.cpp @@ -9,6 +9,7 @@ // http://wiki.mozilla.org/Gecko:Effective_TLD_Service #include "mozilla/ArrayUtils.h" +#include "mozilla/Components.h" #include "mozilla/HashFunctions.h" #include "mozilla/MemoryReporting.h" #include "mozilla/ResultExtensions.h" @@ -59,7 +60,7 @@ nsresult nsEffectiveTLDService::Init() { } nsresult rv; - mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv); + mIDNService = mozilla::components::IDN::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -116,8 +117,8 @@ nsEffectiveTLDService* nsEffectiveTLDService::GetInstance() { if (gService) { return gService; } - nsCOMPtr tldService = - do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID); + nsCOMPtr tldService; + tldService = mozilla::components::EffectiveTLD::Service(); if (!tldService) { return nullptr; } diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index 1782f501e304..0cf1d3e52c45 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -10,6 +10,7 @@ #include "NeckoCommon.h" #include "mozilla/AntiTrackingUtils.h" #include "mozilla/DebugOnly.h" +#include "mozilla/Components.h" #include "mozilla/LoadInfo.h" #include "mozilla/NullPrincipal.h" #include "mozilla/RefPtr.h" @@ -261,9 +262,9 @@ class ParentProcessDocumentOpenInfo final : public nsDocumentOpenInfo, } nsresult rv; - nsCOMPtr streamConvService = - do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv); + nsCOMPtr streamConvService; nsAutoCString str; + streamConvService = mozilla::components::StreamConverter::Service(&rv); rv = streamConvService->ConvertedType(mContentType, aChannel, str); NS_ENSURE_SUCCESS(rv, rv); diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp index fe2b3df0bff8..ee94a94fb68b 100644 --- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -39,6 +39,7 @@ #include "nsINetworkLinkService.h" #include "nsQueryObject.h" #include "mozilla/ipc/URIUtils.h" +#include "mozilla/Components.h" #include "nsNetUtil.h" #include "SimpleChannel.h" @@ -263,8 +264,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPrefetch( // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); predictor->OnPredictPrefetch(aURI, aHttpStatus); @@ -280,8 +281,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPreconnect(nsIURI* aURI) { } // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); predictor->OnPredictPreconnect(aURI); @@ -297,8 +298,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictDNS(nsIURI* aURI) { } // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); predictor->OnPredictDNS(aURI); diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 727aea4660fb..1110888f48f1 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -7,6 +7,7 @@ #include "nsHttp.h" #include "mozilla/BasePrincipal.h" +#include "mozilla/Components.h" #include "mozilla/ContentPrincipal.h" #include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/net/ExtensionProtocolHandler.h" @@ -78,8 +79,7 @@ NeckoParent::NeckoParent() : mSocketProcessBridgeInited(false) { // Init HTTP protocol handler now since we need atomTable up and running very // early (IPDL argument handling for PHttpChannel constructor needs it) so // normal init (during 1st Http channel request) isn't early enough. - nsCOMPtr proto = - do_GetService("@mozilla.org/network/protocol;1?name=http"); + mozilla::components::HttpHandler::Service(); } static PBOverrideStatus PBOverrideStatusFromLoadContext( @@ -572,8 +572,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredPredict( const OriginAttributes& aOriginAttributes, const bool& hasVerifier) { // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_OK()); nsCOMPtr verifier; @@ -590,8 +590,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredLearn( const OriginAttributes& aOriginAttributes) { // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_OK()); predictor->LearnNative(aTargetURI, aSourceURI, aReason, aOriginAttributes); @@ -601,8 +601,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredLearn( mozilla::ipc::IPCResult NeckoParent::RecvPredReset() { // Get the current predictor nsresult rv = NS_OK; - nsCOMPtr predictor = - do_GetService("@mozilla.org/network/predictor;1", &rv); + nsCOMPtr predictor; + predictor = mozilla::components::Predictor::Service(&rv); NS_ENSURE_SUCCESS(rv, IPC_OK()); predictor->Reset(); diff --git a/netwerk/ipc/ProxyConfigLookup.cpp b/netwerk/ipc/ProxyConfigLookup.cpp index 29ce74091ded..1aa586456091 100644 --- a/netwerk/ipc/ProxyConfigLookup.cpp +++ b/netwerk/ipc/ProxyConfigLookup.cpp @@ -6,6 +6,7 @@ #include "ProxyConfigLookup.h" #include "ProxyConfigLookupChild.h" +#include "mozilla/Components.h" #include "mozilla/Unused.h" #include "nsContentUtils.h" #include "nsICancelable.h" @@ -59,8 +60,8 @@ nsresult ProxyConfigLookup::DoProxyResolve(nsICancelable** aLookupCancellable) { return rv; } - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(&rv); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/ipc/SocketProcessBridgeChild.cpp b/netwerk/ipc/SocketProcessBridgeChild.cpp index 798ce37bf149..df4ee0e1775f 100644 --- a/netwerk/ipc/SocketProcessBridgeChild.cpp +++ b/netwerk/ipc/SocketProcessBridgeChild.cpp @@ -7,6 +7,7 @@ #include "SocketProcessLogging.h" #include "mozilla/AppShutdown.h" +#include "mozilla/Components.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/Endpoint.h" @@ -144,8 +145,8 @@ void SocketProcessBridgeChild::ActorDestroy(ActorDestroyReason aWhy) { } nsresult res; - nsCOMPtr mSTSThread = - do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res); + nsCOMPtr mSTSThread; + mSTSThread = mozilla::components::SocketTransport::Service(&res); if (NS_SUCCEEDED(res) && mSTSThread) { // This must be called off the main thread. If we don't make this call // ipc::BackgroundChild::GetOrCreateSocketActorForCurrentThread() will diff --git a/netwerk/ipc/SocketProcessChild.cpp b/netwerk/ipc/SocketProcessChild.cpp index 000ebde2fd30..943094f790c9 100644 --- a/netwerk/ipc/SocketProcessChild.cpp +++ b/netwerk/ipc/SocketProcessChild.cpp @@ -194,8 +194,7 @@ bool SocketProcessChild::Init(mozilla::ipc::UntypedEndpoint&& aEndpoint, } // Initialize DNS Service here, since it needs to be done in main thread. - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1", &rv); + mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return false; } @@ -210,7 +209,7 @@ bool SocketProcessChild::Init(mozilla::ipc::UntypedEndpoint&& aEndpoint, Unused << obs->AddObserver(observer, "profile-change-net-teardown", false); } - mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID); + mSocketThread = mozilla::components::SocketTransport::Service(); if (!mSocketThread) { return false; } @@ -440,8 +439,9 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvUpdateDeviceModelId( mozilla::ipc::IPCResult SocketProcessChild::RecvOnHttpActivityDistributorActivated( const bool& aIsActivated) { - if (nsCOMPtr distributor = - components::HttpActivityDistributor::Service()) { + nsCOMPtr distributor; + distributor = mozilla::components::HttpActivityDistributor::Service(); + if (distributor) { distributor->SetIsActive(aIsActivated); } return IPC_OK(); @@ -450,8 +450,8 @@ SocketProcessChild::RecvOnHttpActivityDistributorActivated( mozilla::ipc::IPCResult SocketProcessChild::RecvOnHttpActivityDistributorObserveProxyResponse( const bool& aIsEnabled) { - nsCOMPtr distributor = - do_GetService("@mozilla.org/network/http-activity-distributor;1"); + nsCOMPtr distributor; + distributor = mozilla::components::HttpActivityDistributor::Service(); if (distributor) { Unused << distributor->SetObserveProxyResponse(aIsEnabled); } @@ -461,8 +461,8 @@ SocketProcessChild::RecvOnHttpActivityDistributorObserveProxyResponse( mozilla::ipc::IPCResult SocketProcessChild::RecvOnHttpActivityDistributorObserveConnection( const bool& aIsEnabled) { - nsCOMPtr distributor = - do_GetService("@mozilla.org/network/http-activity-distributor;1"); + nsCOMPtr distributor; + distributor = mozilla::components::HttpActivityDistributor::Service(); if (distributor) { Unused << distributor->SetObserveConnection(aIsEnabled); } @@ -641,8 +641,8 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvGetSocketData( mozilla::ipc::IPCResult SocketProcessChild::RecvGetDNSCacheEntries( GetDNSCacheEntriesResolver&& aResolve) { nsresult rv = NS_OK; - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1", &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { aResolve(nsTArray()); return IPC_OK(); diff --git a/netwerk/protocol/about/nsAboutCache.cpp b/netwerk/protocol/about/nsAboutCache.cpp index 214b18418925..9dde979e9f46 100644 --- a/netwerk/protocol/about/nsAboutCache.cpp +++ b/netwerk/protocol/about/nsAboutCache.cpp @@ -21,6 +21,8 @@ #include "nsThreadUtils.h" +#include "mozilla/Components.h" + using namespace mozilla::net; NS_IMPL_ISUPPORTS(nsAboutCache, nsIAboutModule) @@ -213,8 +215,8 @@ nsresult nsAboutCache::GetStorage(nsACString const& storageName, nsICacheStorage** storage) { nsresult rv; - nsCOMPtr cacheService = - do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv); + nsCOMPtr cacheService; + cacheService = mozilla::components::CacheStorage::Service(&rv); if (NS_FAILED(rv)) return rv; nsCOMPtr cacheStorage; diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 096f8807ba40..c3a20dc2fe0b 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -30,6 +30,7 @@ #include "prio.h" #include +#include "mozilla/Components.h" #include "mozilla/TaskQueue.h" #include "mozilla/Unused.h" @@ -149,8 +150,8 @@ nsresult nsFileCopyEvent::Dispatch(nsIRunnable* callback, if (NS_FAILED(rv)) return rv; // Dispatch ourselves to I/O thread pool... - nsCOMPtr pool = - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); + nsCOMPtr pool; + pool = mozilla::components::StreamTransport::Service(&rv); if (NS_FAILED(rv)) return rv; return pool->Dispatch(this, NS_DISPATCH_NORMAL); @@ -320,7 +321,8 @@ nsresult nsFileChannel::MakeFileInputStream(nsIFile* file, async ? nsIFileInputStream::DEFER_OPEN : 0); if (NS_SUCCEEDED(rv) && !HasContentTypeHint()) { // Use file extension to infer content type - nsCOMPtr mime = do_GetService("@mozilla.org/mime;1", &rv); + nsCOMPtr mime; + mime = mozilla::components::Mime::Service(&rv); if (NS_SUCCEEDED(rv)) { mime->GetTypeFromFile(file, contentType); } @@ -427,8 +429,7 @@ nsresult nsFileChannel::ListenerBlockingPromise(BlockingPromise** aPromise) { return NS_OK; } - nsCOMPtr sts( - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID)); + nsCOMPtr sts(mozilla::components::StreamTransport::Service()); if (!sts) { return FixupContentLength(true); } diff --git a/netwerk/protocol/http/CachePushChecker.cpp b/netwerk/protocol/http/CachePushChecker.cpp index 9f48aa7eda07..fc6ebcbd6e81 100644 --- a/netwerk/protocol/http/CachePushChecker.cpp +++ b/netwerk/protocol/http/CachePushChecker.cpp @@ -7,6 +7,7 @@ #include "CachePushChecker.h" #include "LoadContextInfo.h" +#include "mozilla/Components.h" #include "mozilla/ScopeExit.h" #include "mozilla/net/SocketProcessChild.h" #include "nsICacheEntry.h" @@ -54,8 +55,8 @@ nsresult CachePushChecker::DoCheck() { } nsresult rv; - nsCOMPtr css = - do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv); + nsCOMPtr css; + css = mozilla::components::CacheStorage::Service(&rv); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/protocol/http/DnsAndConnectSocket.cpp b/netwerk/protocol/http/DnsAndConnectSocket.cpp index 8895ac97e186..95d39930b0a8 100644 --- a/netwerk/protocol/http/DnsAndConnectSocket.cpp +++ b/netwerk/protocol/http/DnsAndConnectSocket.cpp @@ -209,8 +209,8 @@ nsresult DnsAndConnectSocket::SetupDnsFlags(ConnectionEntry* ent) { if (ent->mConnInfo->HasIPHintAddress()) { nsresult rv; - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1", &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); if (NS_FAILED(rv)) { return rv; } @@ -1206,8 +1206,8 @@ nsresult DnsAndConnectSocket::TransportSetup::SetupStreams( } if (ci->HasIPHintAddress()) { - nsCOMPtr dns = - do_GetService("@mozilla.org/network/dns-service;1", &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); // The spec says: "If A and AAAA records for TargetName are locally diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index b8634512cea6..f74eeeb9127f 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -21,6 +21,7 @@ #include "mozilla/dom/WindowGlobalParent.h" #include "mozilla/net/NeckoParent.h" #include "mozilla/net/CookieServiceParent.h" +#include "mozilla/Components.h" #include "mozilla/InputStreamLengthHelper.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/Preferences.h" @@ -119,8 +120,7 @@ HttpChannelParent::HttpChannelParent(dom::BrowserParent* iframeEmbedding, LOG(("Creating HttpChannelParent [this=%p]\n", this)); // Ensure gHttpHandler is initialized: we need the atom table up and running. - nsCOMPtr dummyInitializer = - do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http"); + mozilla::components::HttpHandler::Service(); MOZ_ASSERT(gHttpHandler); mHttpHandler = gHttpHandler; @@ -325,8 +325,8 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void** result) { if (!mBrowserParent && (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) || aIID.Equals(NS_GET_IID(nsIAuthPrompt2)))) { nsresult rv; - nsCOMPtr wwatch = - do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); + nsCOMPtr wwatch; + wwatch = mozilla::components::WindowWatcher::Service(&rv); NS_ENSURE_SUCCESS(rv, NS_ERROR_NO_INTERFACE); bool hasWindowCreator = false; diff --git a/netwerk/protocol/http/NullHttpTransaction.cpp b/netwerk/protocol/http/NullHttpTransaction.cpp index f27eb16138e5..3ca3d2f75d16 100644 --- a/netwerk/protocol/http/NullHttpTransaction.cpp +++ b/netwerk/protocol/http/NullHttpTransaction.cpp @@ -8,6 +8,7 @@ #include "HttpLog.h" #include "mozilla/net/NeckoChannelParams.h" // For HttpActivityArgs. +#include "mozilla/Components.h" #include "nsHttp.h" #include "NullHttpTransaction.h" #include "nsHttpHandler.h" @@ -34,7 +35,7 @@ NullHttpTransaction::NullHttpTransaction(nsHttpConnectionInfo* ci, mConnectionInfo(ci) { nsresult rv; mActivityDistributor = - do_GetService(NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &rv); + mozilla::components::HttpActivityDistributor::Service(&rv); if (NS_FAILED(rv)) { return; } diff --git a/netwerk/protocol/http/ParentChannelListener.cpp b/netwerk/protocol/http/ParentChannelListener.cpp index d35a0a9a1292..12d71a14ab6e 100644 --- a/netwerk/protocol/http/ParentChannelListener.cpp +++ b/netwerk/protocol/http/ParentChannelListener.cpp @@ -14,6 +14,7 @@ #include "mozilla/dom/ServiceWorkerUtils.h" #include "mozilla/net/HttpChannelParent.h" #include "mozilla/net/RedirectChannelRegistrar.h" +#include "mozilla/Components.h" #include "mozilla/SchedulerGroup.h" #include "nsIHttpHeaderVisitor.h" #include "nsIPrompt.h" @@ -165,8 +166,8 @@ ParentChannelListener::GetInterface(const nsIID& aIID, void** result) { NS_ENSURE_TRUE(win, NS_ERROR_NO_INTERFACE); nsresult rv; - nsCOMPtr wwatch = - do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); + nsCOMPtr wwatch; + wwatch = mozilla::components::WindowWatcher::Service(&rv); if (NS_WARN_IF(!NS_SUCCEEDED(rv))) { return NS_ERROR_NO_INTERFACE; @@ -248,8 +249,8 @@ ParentChannelListener::GetAuthPrompt(uint32_t aPromptReason, const nsIID& iid, } // we're either allowing auth, or it's a proxy request nsresult rv; - nsCOMPtr wwatch = - do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); + nsCOMPtr wwatch; + wwatch = mozilla::components::WindowWatcher::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr window; diff --git a/netwerk/protocol/http/nsCORSListenerProxy.cpp b/netwerk/protocol/http/nsCORSListenerProxy.cpp index a58f8b7b7ae1..6400f8640352 100644 --- a/netwerk/protocol/http/nsCORSListenerProxy.cpp +++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp @@ -7,6 +7,7 @@ #include "nsIThreadRetargetableStreamListener.h" #include "nsString.h" #include "mozilla/Assertions.h" +#include "mozilla/Components.h" #include "mozilla/LinkedList.h" #include "mozilla/StaticPrefs_content.h" #include "mozilla/StoragePrincipalHelper.h" @@ -1721,7 +1722,7 @@ void nsCORSListenerProxy::LogBlockedCORSRequest( // Build the error object and log it to the console nsCOMPtr console( - do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv)); + mozilla::components::Console::Service(&rv)); if (NS_FAILED(rv)) { NS_WARNING("Failed to log blocked cross-site request (no console)"); return; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 7867f758f2ae..96ac630682f2 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -1809,7 +1809,7 @@ nsresult nsHttpChannel::CallOnStartRequest() { if (contentType.Equals("multipart/x-mixed-replace"_ns)) { nsCOMPtr convServ( - do_GetService("@mozilla.org/streamConverters;1", &rv)); + mozilla::components::StreamConverter::Service(&rv)); if (NS_SUCCEEDED(rv)) { nsCOMPtr toListener(mListener); nsCOMPtr fromListener; @@ -2897,8 +2897,8 @@ nsresult nsHttpChannel::PromptTempRedirect() { return NS_OK; } nsresult rv; - nsCOMPtr bundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); + nsCOMPtr bundleService; + bundleService = mozilla::components::StringBundle::Service(&rv); if (NS_FAILED(rv)) return rv; nsCOMPtr stringBundle; @@ -2927,8 +2927,8 @@ nsresult nsHttpChannel::ProxyFailover() { nsresult rv; - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(&rv); if (NS_FAILED(rv)) return rv; nsCOMPtr pi; @@ -3314,8 +3314,8 @@ nsresult nsHttpChannel::ResolveProxy() { nsresult rv; - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(&rv); if (NS_FAILED(rv)) return rv; // using the nsIProtocolProxyService2 allows a minor performance @@ -5531,8 +5531,9 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) { if (!isRedirectURIInAllowList) { nsCOMPtr strippedURI; - nsCOMPtr queryStripper = - components::URLQueryStringStripper::Service(&rv); + nsCOMPtr queryStripper; + queryStripper = + mozilla::components::URLQueryStringStripper::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); uint32_t numStripped; @@ -6595,8 +6596,8 @@ nsresult nsHttpChannel::BeginConnect() { MOZ_ASSERT(NS_SUCCEEDED(rv)); } - nsCOMPtr consoleService = - do_GetService(NS_CONSOLESERVICE_CONTRACTID); + nsCOMPtr consoleService; + consoleService = mozilla::components::Console::Service(); if (consoleService && !host.Equals(mapping->AlternateHost())) { nsAutoString message(u"Alternate Service Mapping found: "_ns); AppendASCIItoUTF16(scheme, message); @@ -7778,8 +7779,7 @@ static nsLiteralCString ContentTypeToTelemetryLabel(nsHttpChannel* aChannel) { } nsresult nsHttpChannel::LogConsoleError(const char* aTag) { - nsCOMPtr console( - do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + nsCOMPtr console(mozilla::components::Console::Service()); NS_ENSURE_TRUE(console, NS_ERROR_OUT_OF_MEMORY); nsCOMPtr loadInfo = LoadInfo(); @@ -8554,8 +8554,8 @@ nsHttpChannel::OnDataAvailable(nsIRequest* request, nsIInputStream* input, count = delta; NS_WARNING("Listener OnDataAvailable contract violation"); - nsCOMPtr consoleService = - do_GetService(NS_CONSOLESERVICE_CONTRACTID); + nsCOMPtr consoleService; + consoleService = mozilla::components::Console::Service(); nsAutoString message(nsLiteralString( u"http channel Listener OnDataAvailable contract violation")); if (consoleService) { @@ -10045,8 +10045,8 @@ nsresult nsHttpChannel::TriggerNetwork() { void nsHttpChannel::MaybeRaceCacheWithNetwork() { nsresult rv; - nsCOMPtr netLinkSvc = - do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); + nsCOMPtr netLinkSvc; + netLinkSvc = mozilla::components::NetworkLink::Service(&rv); if (NS_FAILED(rv)) { return; } diff --git a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp index 28428f9eab29..dbacde61155b 100644 --- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp +++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp @@ -8,6 +8,7 @@ #include "HttpLog.h" #include "mozilla/BasePrincipal.h" +#include "mozilla/Components.h" #include "mozilla/StoragePrincipalHelper.h" #include "mozilla/Tokenizer.h" #include "MockHttpAuth.h" @@ -1690,8 +1691,8 @@ bool nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey, // assume the user said ok. this is done to keep things working in // embedded builds, where the string bundle might not be present, etc. - nsCOMPtr bundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID); + nsCOMPtr bundleService; + bundleService = mozilla::components::StringBundle::Service(); if (!bundleService) return true; nsCOMPtr bundle; @@ -1748,8 +1749,8 @@ bool nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey, rv = mAuthChannel->GetLoadGroup(getter_AddRefs(loadGroup)); if (NS_FAILED(rv)) return true; - nsCOMPtr promptSvc = - do_GetService("@mozilla.org/prompter;1", &rv); + nsCOMPtr promptSvc; + promptSvc = mozilla::components::Prompt::Service(&rv); if (NS_FAILED(rv) || !promptSvc) { return true; } diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 068926844af7..e1f1e3e08689 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -144,8 +144,8 @@ static nsCString GetDeviceModelId() { // Assumed to be running on the main thread // We need the device property in either case nsAutoCString deviceModelId; - nsCOMPtr infoService = - do_GetService("@mozilla.org/system-info;1"); + nsCOMPtr infoService; + infoService = mozilla::components::SystemInfo::Service(); MOZ_ASSERT(infoService, "Could not find a system info service"); nsAutoString androidDevice; nsresult rv = infoService->GetPropertyAsAString(u"device"_ns, androidDevice); @@ -266,7 +266,8 @@ nsHttpHandler::nsHttpHandler() MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!"); - nsCOMPtr runtime = do_GetService("@mozilla.org/xre/runtime;1"); + nsCOMPtr runtime; + runtime = mozilla::components::XULRuntime::Service(); if (runtime) { runtime->GetProcessID(&mProcessId); } @@ -327,7 +328,8 @@ nsresult nsHttpHandler::Init() { rv = nsHttp::CreateAtomTable(); if (NS_FAILED(rv)) return rv; - nsCOMPtr service = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + nsCOMPtr service; + service = mozilla::components::IO::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("unable to continue without io service"); return rv; @@ -387,8 +389,8 @@ nsresult nsHttpHandler::Init() { mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION); - nsCOMPtr appInfo = - do_GetService("@mozilla.org/xre/app-info;1"); + nsCOMPtr appInfo; + appInfo = mozilla::components::XULRuntime::Service(); mAppName.AssignLiteral(MOZ_APP_UA_NAME); if (mAppName.Length() == 0 && appInfo) { @@ -666,8 +668,8 @@ bool nsHttpHandler::IsAcceptableEncoding(const char* enc, bool isSecure) { nsISiteSecurityService* nsHttpHandler::GetSSService() { if (!mSSService) { - nsCOMPtr service = - do_GetService(NS_SSSERVICE_CONTRACTID); + nsCOMPtr service; + service = mozilla::components::SiteSecurity::Service(); mSSService = new nsMainThreadPtrHolder( "nsHttpHandler::mSSService", service); } @@ -677,7 +679,7 @@ nsISiteSecurityService* nsHttpHandler::GetSSService() { nsICookieService* nsHttpHandler::GetCookieService() { if (!mCookieService) { nsCOMPtr service = - do_GetService(NS_COOKIESERVICE_CONTRACTID); + mozilla::components::Cookies::Service(); mCookieService = new nsMainThreadPtrHolder( "nsHttpHandler::mCookieService", service); } @@ -889,8 +891,8 @@ void nsHttpHandler::InitUserAgentComponents() { #endif #ifdef ANDROID - nsCOMPtr infoService = - do_GetService("@mozilla.org/system-info;1"); + nsCOMPtr infoService; + infoService = mozilla::components::SystemInfo::Service(); MOZ_ASSERT(infoService, "Could not find a system info service"); nsresult rv; @@ -2382,7 +2384,7 @@ NS_IMPL_ISUPPORTS(nsHttpsHandler, nsIHttpProtocolHandler, nsresult nsHttpsHandler::Init() { nsCOMPtr httpHandler( - do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http")); + mozilla::components::HttpHandler::Service()); MOZ_ASSERT(httpHandler.get() != nullptr); return NS_OK; } diff --git a/netwerk/protocol/res/ExtensionProtocolHandler.cpp b/netwerk/protocol/res/ExtensionProtocolHandler.cpp index d3b1a3916452..16f9defb32c2 100644 --- a/netwerk/protocol/res/ExtensionProtocolHandler.cpp +++ b/netwerk/protocol/res/ExtensionProtocolHandler.cpp @@ -7,6 +7,7 @@ #include "ExtensionProtocolHandler.h" #include "mozilla/BinarySearch.h" +#include "mozilla/Components.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/Promise-inl.h" @@ -551,8 +552,8 @@ nsresult ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI, nsIChannel* channel, nsIChannel* origChannel) -> nsresult { nsresult rv; - nsCOMPtr convService = - do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv); + nsCOMPtr convService; + convService = mozilla::components::StreamConverter::Service(&rv); MOZ_TRY(rv); nsCOMPtr uri; @@ -901,7 +902,8 @@ Result ExtensionProtocolHandler::NewFD( void ExtensionProtocolHandler::SetContentType(nsIURI* aURI, nsIChannel* aChannel) { nsresult rv; - nsCOMPtr mime = do_GetService("@mozilla.org/mime;1", &rv); + nsCOMPtr mime; + mime = mozilla::components::Mime::Service(&rv); if (NS_SUCCEEDED(rv)) { nsAutoCString contentType; rv = mime->GetTypeFromURI(aURI, contentType); diff --git a/netwerk/protocol/res/PageThumbProtocolHandler.cpp b/netwerk/protocol/res/PageThumbProtocolHandler.cpp index ece55aa54c4b..b887cde98276 100644 --- a/netwerk/protocol/res/PageThumbProtocolHandler.cpp +++ b/netwerk/protocol/res/PageThumbProtocolHandler.cpp @@ -7,6 +7,7 @@ #include "PageThumbProtocolHandler.h" #include "mozilla/ClearOnShutdown.h" +#include "mozilla/Components.h" #include "mozilla/ipc/URIParams.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/net/NeckoChild.h" @@ -151,7 +152,8 @@ RefPtr PageThumbProtocolHandler::NewStream( auto promiseHolder = MakeUnique>(); RefPtr promise = promiseHolder->Ensure(__func__); - nsCOMPtr mime = do_GetService("@mozilla.org/mime;1", &rv); + nsCOMPtr mime; + mime = mozilla::components::Mime::Service(&rv); if (NS_FAILED(rv)) { return RemoteStreamPromise::CreateAndReject(rv, __func__); } @@ -313,8 +315,8 @@ nsresult PageThumbProtocolHandler::GetThumbnailPath(const nsACString& aPath, nsresult rv; if (aHost.EqualsLiteral(PAGE_THUMB_HOST)) { - nsCOMPtr pageThumbsStorage = - do_GetService("@mozilla.org/thumbnails/pagethumbs-service;1", &rv); + nsCOMPtr pageThumbsStorage; + pageThumbsStorage = mozilla::components::PageThumbsStorage::Service(&rv); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -324,8 +326,8 @@ nsresult PageThumbProtocolHandler::GetThumbnailPath(const nsACString& aPath, aThumbnailPath); #ifdef MOZ_PLACES } else if (aHost.EqualsLiteral(PLACES_PREVIEWS_HOST)) { - nsCOMPtr helper = - do_GetService("@mozilla.org/places/previews-helper;1", &rv); + nsCOMPtr helper; + helper = mozilla::components::PlacesPreviewsHelper::Service(&rv); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index a1ebf85d8ee7..d996d9689a91 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -14,6 +14,7 @@ #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" #include "mozilla/Base64.h" +#include "mozilla/Components.h" #include "mozilla/EndianUtils.h" #include "mozilla/MathAlgorithms.h" #include "mozilla/ScopeExit.h" @@ -176,8 +177,8 @@ class FailDelayManager { mDelaysDisabled = false; - nsCOMPtr prefService = - do_GetService(NS_PREFSERVICE_CONTRACTID); + nsCOMPtr prefService; + prefService = mozilla::components::Preferences::Service(); if (!prefService) { return; } @@ -1224,8 +1225,7 @@ WebSocketChannel::WebSocketChannel() mFramePtr = mBuffer = static_cast(moz_xmalloc(mBufferSize)); nsresult rv; - mConnectionLogService = - do_GetService("@mozilla.org/network/dashboard;1", &rv); + mConnectionLogService = mozilla::components::Dashboard::Service(&rv); if (NS_FAILED(rv)) LOG(("Failed to initiate dashboard service.")); mService = WebSocketEventService::GetOrCreate(); @@ -2743,8 +2743,8 @@ void ProcessServerWebSocketExtensions(const nsACString& aExtensions, nsACString& aNegotiatedExtensions) { aNegotiatedExtensions.Truncate(); - nsCOMPtr prefService = - do_GetService(NS_PREFSERVICE_CONTRACTID); + nsCOMPtr prefService; + prefService = mozilla::components::Preferences::Service(); if (prefService) { bool boolpref; nsresult rv = prefService->GetBoolPref( @@ -2895,7 +2895,8 @@ nsresult WebSocketChannel::DoAdmissionDNS() { rv = mURI->GetPort(&mPort); NS_ENSURE_SUCCESS(rv, rv); if (mPort == -1) mPort = (mEncrypted ? kDefaultWSSPort : kDefaultWSPort); - nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr main = GetMainThreadSerialEventTarget(); nsCOMPtr cancelable; @@ -2920,8 +2921,8 @@ nsresult WebSocketChannel::ApplyForAdmission() { // CONNECTING state per server IP address (not hostname) // Check to see if a proxy is being used before making DNS call - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID); + nsCOMPtr pps; + pps = mozilla::components::ProtocolProxy::Service(); if (!pps) { // go straight to DNS @@ -3450,14 +3451,14 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin, } } - mIOThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + mIOThread = mozilla::components::SocketTransport::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("unable to continue without socket transport service"); return rv; } nsCOMPtr prefService; - prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefService = mozilla::components::Preferences::Service(); if (prefService) { int32_t intpref; @@ -3530,8 +3531,7 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin, mURI->GetHostPort(mHost); - mRandomGenerator = - do_GetService("@mozilla.org/security/random-generator;1", &rv); + mRandomGenerator = mozilla::components::RandomGenerator::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("unable to continue without random number generator"); return rv; @@ -3546,7 +3546,7 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr ioService; - ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + ioService = mozilla::components::IO::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("unable to continue without io service"); return rv; @@ -3926,8 +3926,8 @@ WebSocketChannel::OnStartRequest(nsIRequest* aRequest) { // NS_ERROR_WEBSOCKET_CONNECTION_REFUSED. if (NS_SUCCEEDED(mHttpChannel->GetStatus(&httpStatus))) { uint32_t errorClass; - nsCOMPtr errSvc = - do_GetService("@mozilla.org/nss_errors_service;1"); + nsCOMPtr errSvc; + errSvc = mozilla::components::NSSErrors::Service(); // If GetErrorClass succeeds httpStatus is TLS related failure. if (errSvc && NS_SUCCEEDED(errSvc->GetErrorClass(httpStatus, &errorClass))) { diff --git a/netwerk/protocol/websocket/WebSocketConnection.cpp b/netwerk/protocol/websocket/WebSocketConnection.cpp index b57f4fc115e5..422cd7fd3105 100644 --- a/netwerk/protocol/websocket/WebSocketConnection.cpp +++ b/netwerk/protocol/websocket/WebSocketConnection.cpp @@ -9,6 +9,7 @@ #include "WebSocketLog.h" #include "mozilla/net/WebSocketConnectionListener.h" +#include "mozilla/Components.h" #include "nsIOService.h" #include "nsITLSSocketControl.h" #include "nsISocketTransport.h" @@ -38,7 +39,7 @@ nsresult WebSocketConnection::Init(WebSocketConnectionListener* aListener) { mListener = aListener; nsresult rv; - mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + mSocketThread = mozilla::components::SocketTransport::Service(&rv); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/protocol/websocket/WebSocketConnectionChild.cpp b/netwerk/protocol/websocket/WebSocketConnectionChild.cpp index 045c3763b7ce..8f12933b113f 100644 --- a/netwerk/protocol/websocket/WebSocketConnectionChild.cpp +++ b/netwerk/protocol/websocket/WebSocketConnectionChild.cpp @@ -10,6 +10,7 @@ #include "WebSocketConnection.h" #include "mozilla/ipc/Endpoint.h" #include "mozilla/net/SocketProcessBackgroundChild.h" +#include "mozilla/Components.h" #include "nsISerializable.h" #include "nsITLSSocketControl.h" #include "nsITransportSecurityInfo.h" @@ -35,7 +36,7 @@ void WebSocketConnectionChild::Init(uint32_t aListenerId) { MOZ_ASSERT(NS_IsMainThread()); nsresult rv; - mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + mSocketThread = mozilla::components::SocketTransport::Service(&rv); MOZ_ASSERT(NS_SUCCEEDED(rv)); if (!mSocketThread) { return; diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 81f54e775d01..f2e4c862a823 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -41,6 +41,7 @@ #include "nsThreadUtils.h" #include "nsNetUtil.h" #include "nsNetCID.h" +#include "mozilla/Components.h" #include "mozilla/RandomNum.h" #include "mozilla/StaticMutex.h" #include "mozilla/UniquePtrExtensions.h" @@ -547,7 +548,7 @@ bool DataChannelConnection::Init(const uint16_t aLocalPort, // XXX FIX! make this a global we get once // Find the STS thread nsresult rv; - mSTS = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + mSTS = mozilla::components::SocketTransport::Service(&rv); MOZ_ASSERT(NS_SUCCEEDED(rv)); // Open sctp with a callback @@ -701,8 +702,8 @@ void DataChannelConnection::SetMaxMessageSize(bool aMaxMessageSizeSet, mMaxMessageSize = aMaxMessageSize; nsresult rv; - nsCOMPtr prefs = - do_GetService("@mozilla.org/preferences-service;1", &rv); + nsCOMPtr prefs; + prefs = mozilla::components::Preferences::Service(&rv); if (!NS_WARN_IF(NS_FAILED(rv))) { nsCOMPtr branch = do_QueryInterface(prefs); diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp index b92de4e87abc..138c6c8dc15b 100644 --- a/netwerk/socket/nsSOCKSIOLayer.cpp +++ b/netwerk/socket/nsSOCKSIOLayer.cpp @@ -20,6 +20,7 @@ #include "nsThreadUtils.h" #include "nsIFile.h" #include "nsIFileProtocolHandler.h" +#include "mozilla/Components.h" #include "mozilla/Logging.h" #include "mozilla/net/DNS.h" #include "mozilla/Unused.h" @@ -127,7 +128,7 @@ class nsSOCKSSocketInfo : public nsIDNSListener { MOZ_ASSERT(aProxyAddr); nsCOMPtr protocolHandler( - do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file", &rv)); + mozilla::components::FileProtocolHandler::Service(&rv)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -408,7 +409,8 @@ PRStatus nsSOCKSSocketInfo::StartDNS(PRFileDesc* fd) { MOZ_ASSERT(!mDnsRec && mState == SOCKS_INITIAL, "Must be in initial state to make DNS Lookup"); - nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID); + nsCOMPtr dns; + dns = mozilla::components::DNS::Service(); if (!dns) return PR_FAILURE; nsCString proxyHost; diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index 40650d9fce3c..b72cbf8621c5 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -5,6 +5,7 @@ #include "nsIndexedToHTML.h" +#include "mozilla/Components.h" #include "mozilla/Encoding.h" #include "mozilla/intl/AppDateTimeFormat.h" #include "mozilla/intl/LocaleService.h" @@ -67,8 +68,8 @@ nsresult nsIndexedToHTML::Init(nsIStreamListener* aListener) { mListener = aListener; - nsCOMPtr sbs = - do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); + nsCOMPtr sbs; + sbs = mozilla::components::StringBundle::Service(&rv); if (NS_FAILED(rv)) return rv; rv = sbs->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(mBundle)); @@ -476,7 +477,7 @@ nsresult nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, // otherwise we end up linking to file:///foo/dirfile if (!mTextToSubURI) { - mTextToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); + mTextToSubURI = mozilla::components::TextToSubURI::Service(&rv); if (NS_FAILED(rv)) return rv; } diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index df7294acf9ed..e1ccfda303cc 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -20,6 +20,7 @@ #include "nsIURI.h" #include "nsHttpHeaderArray.h" #include "mozilla/AutoRestore.h" +#include "mozilla/Components.h" #include "mozilla/Tokenizer.h" #include "nsComponentManagerUtils.h" #include "mozilla/StaticPrefs_network.h" @@ -812,8 +813,8 @@ nsresult nsMultiMixedConv::SendStart() { nsCOMPtr partListener(mFinalListener); if (mContentType.IsEmpty()) { mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE); - nsCOMPtr serv = - do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv); + nsCOMPtr serv; + serv = mozilla::components::StreamConverter::Service(&rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr converter; rv = serv->AsyncConvertData(UNKNOWN_CONTENT_TYPE, "*/*", mFinalListener, diff --git a/netwerk/streamconv/nsStreamConverterService.cpp b/netwerk/streamconv/nsStreamConverterService.cpp index ce95bb0404f7..22703ada58af 100644 --- a/netwerk/streamconv/nsStreamConverterService.cpp +++ b/netwerk/streamconv/nsStreamConverterService.cpp @@ -18,6 +18,7 @@ #include "nsTArray.h" #include "nsServiceManagerUtils.h" #include "nsISimpleEnumerator.h" +#include "mozilla/Components.h" #include "mozilla/UniquePtr.h" /////////////////////////////////////////////////////////////////// @@ -65,7 +66,7 @@ nsresult nsStreamConverterService::BuildGraph() { nsresult rv; nsCOMPtr catmgr( - do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); + mozilla::components::CategoryManager::Service(&rv)); if (NS_FAILED(rv)) return rv; nsCOMPtr entries; diff --git a/netwerk/system/mac/nsNetworkLinkService.mm b/netwerk/system/mac/nsNetworkLinkService.mm index 83271c07126f..331a82475ae5 100644 --- a/netwerk/system/mac/nsNetworkLinkService.mm +++ b/netwerk/system/mac/nsNetworkLinkService.mm @@ -26,6 +26,7 @@ #include "nsCRT.h" #include "nsNetCID.h" #include "nsThreadUtils.h" +#include "mozilla/Components.h" #include "mozilla/Logging.h" #include "mozilla/StaticPrefs_network.h" #include "mozilla/SHA1.h" @@ -595,8 +596,8 @@ void nsNetworkLinkService::calculateNetworkIdWithDelay(uint32_t aDelay) { return; } - nsCOMPtr target = - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); + nsCOMPtr target; + target = mozilla::components::StreamTransport::Service(); if (!target) { return; } @@ -723,8 +724,8 @@ void nsNetworkLinkService::NetworkConfigChanged(SCDynamicStoreRef aStoreREf, void nsNetworkLinkService::DNSConfigChanged(uint32_t aDelayMs) { LOG(("nsNetworkLinkService::DNSConfigChanged")); - nsCOMPtr target = - do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); + nsCOMPtr target; + target = mozilla::components::StreamTransport::Service(); if (!target) { return; } @@ -752,8 +753,8 @@ void nsNetworkLinkService::DNSConfigChanged(uint32_t aDelayMs) { nsresult nsNetworkLinkService::Init(void) { nsresult rv; - nsCOMPtr observerService = - do_GetService("@mozilla.org/observer-service;1", &rv); + nsCOMPtr observerService; + observerService = mozilla::components::Observer::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); rv = observerService->AddObserver(this, "xpcom-shutdown", false); diff --git a/netwerk/url-classifier/UrlClassifierCommon.cpp b/netwerk/url-classifier/UrlClassifierCommon.cpp index 21589cef9467..151adc93cc8d 100644 --- a/netwerk/url-classifier/UrlClassifierCommon.cpp +++ b/netwerk/url-classifier/UrlClassifierCommon.cpp @@ -222,8 +222,8 @@ nsresult UrlClassifierCommon::SetBlockedContent(nsIChannel* channel, // to correct top-level window), we need to do this in the parent process // instead (find the top-level window in the parent and send an IPC to child // processes to report console). - nsCOMPtr thirdPartyUtil = - components::ThirdPartyUtil::Service(); + nsCOMPtr thirdPartyUtil; + thirdPartyUtil = mozilla::components::ThirdPartyUtil::Service(); if (NS_WARN_IF(!thirdPartyUtil)) { return NS_OK; } @@ -366,8 +366,8 @@ nsresult UrlClassifierCommon::CreatePairwiseEntityListURI(nsIChannel* aChannel, return NS_OK; } - nsCOMPtr securityManager = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); + nsCOMPtr securityManager; + securityManager = mozilla::components::ScriptSecurityManager::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr chanPrincipal; rv = securityManager->GetChannelURIPrincipal(aChannel, diff --git a/netwerk/url-classifier/nsChannelClassifier.cpp b/netwerk/url-classifier/nsChannelClassifier.cpp index b9bdb3a050d4..76aabeabfbe4 100644 --- a/netwerk/url-classifier/nsChannelClassifier.cpp +++ b/netwerk/url-classifier/nsChannelClassifier.cpp @@ -186,7 +186,7 @@ nsresult nsChannelClassifier::StartInternal() { } nsCOMPtr uriClassifier = - do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID, &rv); + mozilla::components::UrlClassifierDB::Service(&rv); if (rv == NS_ERROR_FACTORY_NOT_REGISTERED || rv == NS_ERROR_NOT_AVAILABLE) { // no URI classifier, ignore this failure. return NS_ERROR_NOT_AVAILABLE; @@ -194,7 +194,7 @@ nsresult nsChannelClassifier::StartInternal() { NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr securityManager = - do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); + mozilla::components::ScriptSecurityManager::Service(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr principal; diff --git a/netwerk/wifi/nsWifiMonitor.cpp b/netwerk/wifi/nsWifiMonitor.cpp index f437dec4bd08..fedd20510760 100644 --- a/netwerk/wifi/nsWifiMonitor.cpp +++ b/netwerk/wifi/nsWifiMonitor.cpp @@ -18,6 +18,7 @@ #include "nsNetCID.h" #include "nsComponentManagerUtils.h" +#include "mozilla/Components.h" #include "mozilla/DelayedRunnable.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/StaticPrefs_network.h" @@ -95,8 +96,8 @@ nsWifiMonitor::nsWifiMonitor(UniquePtr&& aScanner) } nsresult rv; - nsCOMPtr nls = - do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); + nsCOMPtr nls; + nls = mozilla::components::NetworkLink::Service(&rv); if (NS_SUCCEEDED(rv) && nls) { uint32_t linkType = nsINetworkLinkService::LINK_TYPE_UNKNOWN; rv = nls->GetLinkType(&linkType); diff --git a/security/manager/ssl/components.conf b/security/manager/ssl/components.conf index 7bdcae356ab1..bf53ed22b7c5 100644 --- a/security/manager/ssl/components.conf +++ b/security/manager/ssl/components.conf @@ -10,6 +10,7 @@ Headers = [ Classes = [ { + 'name': 'NSSComponent', 'cid': '{4cb64dfd-ca98-4e24-befd-0d9285a33bcb}', 'contract_ids': ['@mozilla.org/psm;1'], 'type': 'nsNSSComponent', @@ -17,6 +18,7 @@ Classes = [ 'init_method': 'Init', }, { + 'name': 'NSSErrors', 'cid': '{9ef18451-a157-4d17-8132-47afef213689}', 'contract_ids': ['@mozilla.org/nss_errors_service;1'], 'type': 'mozilla::psm::NSSErrorsService', @@ -54,6 +56,7 @@ Classes = [ 'headers': ['nsNSSCertificate.h'], }, { + 'name': 'NSSConstructor', 'cid': '{fb0bbc5c-452e-4783-b32c-80124693d871}', 'contract_ids': ['@mozilla.org/security/x509certdb;1'], 'type': 'nsNSSCertificateDB', @@ -86,6 +89,7 @@ Classes = [ 'init_method': 'Init', }, { + 'name': 'RandomGenerator', 'cid': '{be65e2b7-fe46-4e0f-88e0-4b385db4d68a}', 'contract_ids': ['@mozilla.org/security/random-generator;1'], 'type': 'nsRandomGenerator', @@ -97,6 +101,7 @@ Classes = [ 'type': 'mozilla::psm::TransportSecurityInfo', }, { + 'name': 'SiteSecurity', 'cid': '{16955eee-6c48-4152-9309-c42a465138a1}', 'contract_ids': ['@mozilla.org/ssservice;1'], 'type': 'nsSiteSecurityService', diff --git a/toolkit/components/places/components.conf b/toolkit/components/places/components.conf index af18830a2991..a9a89c4e9d18 100644 --- a/toolkit/components/places/components.conf +++ b/toolkit/components/places/components.conf @@ -112,6 +112,7 @@ Classes = [ }, { + 'name': 'PlacesPreviewsHelper', 'cid': '{bd0a4d3b-ff26-4d4d-9a62-a513e1c1bf92}', 'contract_ids': ['@mozilla.org/places/previews-helper;1'], 'esModule': 'resource://gre/modules/PlacesPreviews.sys.mjs', diff --git a/toolkit/components/prompts/src/components.conf b/toolkit/components/prompts/src/components.conf index 32a6df21a2df..84799f0262eb 100644 --- a/toolkit/components/prompts/src/components.conf +++ b/toolkit/components/prompts/src/components.conf @@ -6,6 +6,7 @@ Classes = [ { + 'name': 'AuthPromptAdapter', 'cid': '{6e134924-6c3a-4d86-81ac-69432dd971dc}', 'contract_ids': ['@mozilla.org/network/authprompt-adapter-factory;1'], 'esModule': 'resource://gre/modules/Prompter.sys.mjs', @@ -16,6 +17,7 @@ Classes = [ if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] not in ('android', 'uikit'): Classes += [ { + 'name': 'Prompt', 'js_name': 'prompt', 'cid': '{1c978d25-b37f-43a8-a2d6-0c7a239ead87}', 'contract_ids': ['@mozilla.org/prompter;1'], diff --git a/toolkit/components/thumbnails/components.conf b/toolkit/components/thumbnails/components.conf index d472b23bed37..6d9ba4e369a4 100644 --- a/toolkit/components/thumbnails/components.conf +++ b/toolkit/components/thumbnails/components.conf @@ -6,6 +6,7 @@ Classes = [ { + 'name': 'PageThumbsStorage', 'cid': '{97943eec-0e48-49ef-b7b7-cf4aa0109bb6}', 'contract_ids': ['@mozilla.org/thumbnails/pagethumbs-service;1'], 'esModule': 'resource://gre/modules/PageThumbsStorageService.sys.mjs', diff --git a/toolkit/xre/components.conf b/toolkit/xre/components.conf index b59964e79445..41fbdb00b993 100644 --- a/toolkit/xre/components.conf +++ b/toolkit/xre/components.conf @@ -37,6 +37,7 @@ Classes = [ 'headers': ['/dom/webbrowserpersist/nsWebBrowserPersist.h'], }, { + 'name': 'WindowWatcher', 'js_name': 'ww', 'cid': '{a21bfa01-f349-4394-a84c-8de5cf0737d0}', 'contract_ids': ['@mozilla.org/embedcomp/window-watcher;1'], diff --git a/xpcom/build/components.conf b/xpcom/build/components.conf index a34076a525b7..7cb61da93c30 100644 --- a/xpcom/build/components.conf +++ b/xpcom/build/components.conf @@ -42,6 +42,7 @@ Classes = [ 'constructor': 'nsChromeRegistry::GetSingleton', }, { + 'name': 'Console', 'js_name': 'console', 'cid': '{7e3ff85c-1dd2-11b2-8d4b-eb452cb0ff40}', 'contract_ids': ['@mozilla.org/consoleservice;1'], @@ -196,6 +197,7 @@ Classes = [ 'headers': ['nsSupportsPrimitives.h'], }, { + 'name': 'SystemInfo', 'js_name': 'sysinfo', 'cid': '{d962398a-99e5-49b2-857a-c159049c7f6c}', 'contract_ids': ['@mozilla.org/system-info;1'], diff --git a/xpcom/components/components.conf b/xpcom/components/components.conf index 9938fb104f81..2bfadb199243 100644 --- a/xpcom/components/components.conf +++ b/xpcom/components/components.conf @@ -6,6 +6,7 @@ Classes = [ { + 'name': 'CategoryManager', 'js_name': 'catMan', 'cid': '{16d222a6-1dd2-11b2-b693-f38b02c021b2}', 'contract_ids': ['@mozilla.org/categorymanager;1'],