Bug 1895232 - Convert do_GetService to using components::*::service in netwerk/ r=valentin,cookie-reviewers,places-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D209747
This commit is contained in:
Sean 2024-05-30 21:18:43 +00:00
Родитель 8eb6901456
Коммит 680bd63580
56 изменённых файлов: 259 добавлений и 188 удалений

Просмотреть файл

@ -24,6 +24,7 @@ Classes = [
'headers': ['/intl/uconv/nsScriptableUConv.h'], 'headers': ['/intl/uconv/nsScriptableUConv.h'],
}, },
{ {
'name': 'TextToSubURI',
'js_name': 'textToSubURI', 'js_name': 'textToSubURI',
'cid': '{8b042e22-6f87-11d3-b3c8-00805f8a6670}', 'cid': '{8b042e22-6f87-11d3-b3c8-00805f8a6670}',
'contract_ids': ['@mozilla.org/intl/texttosuburi;1'], 'contract_ids': ['@mozilla.org/intl/texttosuburi;1'],

Просмотреть файл

@ -112,6 +112,7 @@ Classes = [
'init_method': 'Init', 'init_method': 'Init',
}, },
{ {
'name': 'ContentSecurityManager',
'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}', 'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}',
'contract_ids': ['@mozilla.org/contentsecuritymanager;1'], 'contract_ids': ['@mozilla.org/contentsecuritymanager;1'],
'type': 'nsContentSecurityManager', 'type': 'nsContentSecurityManager',
@ -363,6 +364,7 @@ Classes = [
'headers': ['/dom/bindings/nsScriptError.h'], 'headers': ['/dom/bindings/nsScriptError.h'],
}, },
{ {
'name': 'ScriptSecurityManager',
'js_name': 'scriptSecurityManager', 'js_name': 'scriptSecurityManager',
'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}', 'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}',
'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'], 'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'],

Просмотреть файл

@ -8,6 +8,7 @@
#include "ScopedNSSTypes.h" #include "ScopedNSSTypes.h"
#include "mozilla/ArrayAlgorithm.h" #include "mozilla/ArrayAlgorithm.h"
#include "mozilla/Components.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/ScopeExit.h" #include "mozilla/ScopeExit.h"
@ -194,8 +195,8 @@ BackgroundFileSaver::EnableSha256() {
"Can't enable sha256 or initialize NSS off the main thread"); "Can't enable sha256 or initialize NSS off the main thread");
// Ensure Personal Security Manager is initialized. This is required for // Ensure Personal Security Manager is initialized. This is required for
// PK11_* operations to work. // PK11_* operations to work.
nsresult rv; nsresult rv = NS_OK;
nsCOMPtr<nsISupports> nssDummy = do_GetService("@mozilla.org/psm;1", &rv); mozilla::components::NSSComponent::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
MutexAutoLock lock(mLock); MutexAutoLock lock(mLock);
mSha256Enabled = true; // this will be read by the worker thread mSha256Enabled = true; // this will be read by the worker thread
@ -219,8 +220,8 @@ BackgroundFileSaver::EnableSignatureInfo() {
MOZ_ASSERT(NS_IsMainThread(), MOZ_ASSERT(NS_IsMainThread(),
"Can't enable signature extraction off the main thread"); "Can't enable signature extraction off the main thread");
// Ensure Personal Security Manager is initialized. // Ensure Personal Security Manager is initialized.
nsresult rv; nsresult rv = NS_OK;
nsCOMPtr<nsISupports> nssDummy = do_GetService("@mozilla.org/psm;1", &rv); mozilla::components::NSSComponent::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
MutexAutoLock lock(mLock); MutexAutoLock lock(mLock);
mSignatureInfoEnabled = true; mSignatureInfoEnabled = true;

Просмотреть файл

@ -4,6 +4,7 @@
#include "mozilla/dom/NetDashboardBinding.h" #include "mozilla/dom/NetDashboardBinding.h"
#include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/ToJSValue.h"
#include "mozilla/Components.h"
#include "mozilla/ErrorNames.h" #include "mozilla/ErrorNames.h"
#include "mozilla/net/Dashboard.h" #include "mozilla/net/Dashboard.h"
#include "mozilla/net/HttpInfo.h" #include "mozilla/net/HttpInfo.h"
@ -821,7 +822,7 @@ Dashboard::RequestDNSInfo(nsINetDashboardCallback* aCallback) {
dnsData->mEventTarget = GetCurrentSerialEventTarget(); dnsData->mEventTarget = GetCurrentSerialEventTarget();
if (!mDnsService) { if (!mDnsService) {
mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); mDnsService = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -931,7 +932,7 @@ Dashboard::RequestDNSLookup(const nsACString& aHost,
nsresult rv; nsresult rv;
if (!mDnsService) { if (!mDnsService) {
mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); mDnsService = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -955,7 +956,7 @@ Dashboard::RequestDNSHTTPSRRLookup(const nsACString& aHost,
nsresult rv; nsresult rv;
if (!mDnsService) { if (!mDnsService) {
mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv); mDnsService = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -1150,8 +1151,7 @@ using ErrorEntry = struct {
}; };
#undef ERROR #undef ERROR
#define ERROR(key, val) \ #define ERROR(key, val) {key, #key}
{ key, #key }
ErrorEntry socketTransportStatuses[] = { ErrorEntry socketTransportStatuses[] = {
ERROR(NS_NET_STATUS_RESOLVING_HOST, FAILURE(3)), ERROR(NS_NET_STATUS_RESOLVING_HOST, FAILURE(3)),

Просмотреть файл

@ -12,6 +12,9 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsSocketTransportService2.h" #include "nsSocketTransportService2.h"
#include "mozilla/Components.h"
#ifdef DEBUG #ifdef DEBUG
# include "MainThreadUtils.h" # include "MainThreadUtils.h"
#endif #endif
@ -91,7 +94,7 @@ EventTokenBucket::EventTokenBucket(uint32_t eventsPerSecond, uint32_t burstSize)
nsCOMPtr<nsIEventTarget> sts; nsCOMPtr<nsIEventTarget> sts;
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv); nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
if (NS_SUCCEEDED(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); if (NS_SUCCEEDED(rv)) mTimer = NS_NewTimer(sts);
SetRate(eventsPerSecond, burstSize); SetRate(eventsPerSecond, burstSize);

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/Components.h"
#include "mozilla/OriginAttributes.h" #include "mozilla/OriginAttributes.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h" #include "mozilla/SchedulerGroup.h"
@ -365,17 +366,16 @@ nsresult Predictor::Init() {
mDNSListener = new DNSListener(); mDNSListener = new DNSListener();
} }
mCacheStorageService = mCacheStorageService = mozilla::components::CacheStorage::Service(&rv);
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv);
NS_ENSURE_SUCCESS(rv, 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); NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewURI(getter_AddRefs(mStartupURI), "predictor://startup"); rv = NS_NewURI(getter_AddRefs(mStartupURI), "predictor://startup");
NS_ENSURE_SUCCESS(rv, rv); 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); NS_ENSURE_SUCCESS(rv, rv);
mInitialized = true; mInitialized = true;
@ -1923,8 +1923,8 @@ static nsresult EnsureGlobalPredictor(nsINetworkPredictor** aPredictor) {
if (!sPredictor) { if (!sPredictor) {
nsresult rv; nsresult rv;
nsCOMPtr<nsINetworkPredictor> predictor = nsCOMPtr<nsINetworkPredictor> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
sPredictor = predictor; sPredictor = predictor;
ClearOnShutdown(&sPredictor); ClearOnShutdown(&sPredictor);

Просмотреть файл

@ -6,6 +6,7 @@
#include "TLSServerSocket.h" #include "TLSServerSocket.h"
#include "mozilla/net/DNS.h" #include "mozilla/net/DNS.h"
#include "mozilla/Components.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsDependentSubstring.h" #include "nsDependentSubstring.h"
#include "nsIServerSocket.h" #include "nsIServerSocket.h"
@ -391,8 +392,8 @@ nsresult TLSServerConnectionInfo::HandshakeCallback(PRFileDesc* aFD) {
UniqueCERTCertificate clientCert(SSL_PeerCertificate(aFD)); UniqueCERTCertificate clientCert(SSL_PeerCertificate(aFD));
if (clientCert) { if (clientCert) {
nsCOMPtr<nsIX509CertDB> certDB = nsCOMPtr<nsIX509CertDB> certDB;
do_GetService(NS_X509CERTDB_CONTRACTID, &rv); certDB = mozilla::components::NSSCertificateDB::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

Просмотреть файл

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ThrottleQueue.h" #include "ThrottleQueue.h"
#include "mozilla/Components.h"
#include "mozilla/net/InputChannelThrottleQueueParent.h" #include "mozilla/net/InputChannelThrottleQueueParent.h"
#include "nsISeekableStream.h" #include "nsISeekableStream.h"
#include "nsIAsyncInputStream.h" #include "nsIAsyncInputStream.h"
@ -251,7 +252,7 @@ ThrottleQueue::ThrottleQueue()
nsCOMPtr<nsIEventTarget> sts; nsCOMPtr<nsIEventTarget> sts;
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv); nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
if (NS_SUCCEEDED(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); if (NS_SUCCEEDED(rv)) mTimer = NS_NewTimer(sts);
} }

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsIBufferedStreams.h" #include "nsIBufferedStreams.h"
#include "nsIRequestObserver.h" #include "nsIRequestObserver.h"
#include "mozilla/Components.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
using namespace mozilla; using namespace mozilla;
@ -251,7 +252,7 @@ nsresult nsAsyncStreamCopier::InitInternal(
mTarget = target; mTarget = target;
} else { } else {
nsresult rv; nsresult rv;
mTarget = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); mTarget = mozilla::components::StreamTransport::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "WebTransportSessionProxy.h" #include "WebTransportSessionProxy.h"
#include "mozilla/AppShutdown.h" #include "mozilla/AppShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/LoadInfo.h" #include "mozilla/LoadInfo.h"
#include "mozilla/net/NeckoCommon.h" #include "mozilla/net/NeckoCommon.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
@ -452,7 +453,7 @@ nsresult nsIOService::InitializeCaptivePortalService() {
return NS_OK; return NS_OK;
} }
mCaptivePortalService = do_GetService(NS_CAPTIVEPORTAL_CID); mCaptivePortalService = mozilla::components::CaptivePortal::Service();
if (mCaptivePortalService) { if (mCaptivePortalService) {
static_cast<CaptivePortalService*>(mCaptivePortalService.get()) static_cast<CaptivePortalService*>(mCaptivePortalService.get())
->Initialize(); ->Initialize();
@ -477,7 +478,7 @@ nsresult nsIOService::InitializeSocketTransportService() {
if (!mSocketTransportService) { if (!mSocketTransportService) {
mSocketTransportService = mSocketTransportService =
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); mozilla::components::SocketTransport::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("failed to get socket transport service"); NS_WARNING("failed to get socket transport service");
} }
@ -524,7 +525,7 @@ nsresult nsIOService::InitializeProtocolProxyService() {
if (XRE_IsParentProcess()) { if (XRE_IsParentProcess()) {
// for early-initialization // for early-initialization
Unused << do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); Unused << mozilla::components::ProtocolProxy::Service(&rv);
} }
return 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 // 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 // reference of the contentSecurityManager. But it lives in the XPCOM
// service registry. // service registry.
nsCOMPtr<nsIChannelEventSink> sink = nsCOMPtr<nsIChannelEventSink> sink;
do_GetService(NS_CONTENTSECURITYMANAGER_CONTRACTID); sink = mozilla::components::ContentSecurityManager::Service();
if (sink) { if (sink) {
nsresult rv = nsresult rv =
helper->DelegateOnChannelRedirect(sink, oldChan, newChan, flags); helper->DelegateOnChannelRedirect(sink, oldChan, newChan, flags);
@ -1190,8 +1191,8 @@ nsresult nsIOService::NewChannelFromURIWithProxyFlagsInternal(
if (!gHasWarnedUploadChannel2 && scheme.EqualsLiteral("http")) { if (!gHasWarnedUploadChannel2 && scheme.EqualsLiteral("http")) {
nsCOMPtr<nsIUploadChannel2> uploadChannel2 = do_QueryInterface(channel); nsCOMPtr<nsIUploadChannel2> uploadChannel2 = do_QueryInterface(channel);
if (!uploadChannel2) { if (!uploadChannel2) {
nsCOMPtr<nsIConsoleService> consoleService = nsCOMPtr<nsIConsoleService> consoleService;
do_GetService(NS_CONSOLESERVICE_CONTRACTID); consoleService = mozilla::components::Console::Service();
if (consoleService) { if (consoleService) {
consoleService->LogStringMessage( consoleService->LogStringMessage(
u"Http channel implementation " u"Http channel implementation "
@ -2051,8 +2052,8 @@ nsresult nsIOService::SpeculativeConnectInternal(
// speculative connect should not be performed because the potential // speculative connect should not be performed because the potential
// reward is slim with tcp peers closely located to the browser. // reward is slim with tcp peers closely located to the browser.
nsresult rv; nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); pps = mozilla::components::ProtocolProxy::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> loadingPrincipal = aPrincipal; nsCOMPtr<nsIPrincipal> loadingPrincipal = aPrincipal;

Просмотреть файл

@ -128,7 +128,8 @@ using mozilla::dom::ServiceWorkerDescriptor;
#define MAX_RECURSION_COUNT 50 #define MAX_RECURSION_COUNT 50
already_AddRefed<nsIIOService> do_GetIOService(nsresult* error /* = 0 */) { already_AddRefed<nsIIOService> do_GetIOService(nsresult* error /* = 0 */) {
nsCOMPtr<nsIIOService> io = mozilla::components::IO::Service(); nsCOMPtr<nsIIOService> io;
io = mozilla::components::IO::Service();
if (error) *error = io ? NS_OK : NS_ERROR_FAILURE; if (error) *error = io ? NS_OK : NS_ERROR_FAILURE;
return io.forget(); return io.forget();
} }
@ -1132,8 +1133,8 @@ nsresult NS_CheckPortSafety(nsIURI* uri) {
nsresult NS_NewProxyInfo(const nsACString& type, const nsACString& host, nsresult NS_NewProxyInfo(const nsACString& type, const nsACString& host,
int32_t port, uint32_t flags, nsIProxyInfo** result) { int32_t port, uint32_t flags, nsIProxyInfo** result) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); pps = mozilla::components::ProtocolProxy::Service(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = pps->NewProxyInfo(type, host, port, ""_ns, ""_ns, flags, UINT32_MAX, rv = pps->NewProxyInfo(type, host, port, ""_ns, ""_ns, flags, UINT32_MAX,
nullptr, result); nullptr, result);
@ -1222,8 +1223,10 @@ void NS_GetReferrerFromChannel(nsIChannel* channel, nsIURI** referrer) {
} }
already_AddRefed<nsINetUtil> do_GetNetUtil(nsresult* error /* = 0 */) { already_AddRefed<nsINetUtil> do_GetNetUtil(nsresult* error /* = 0 */) {
nsCOMPtr<nsIIOService> io = mozilla::components::IO::Service(); nsCOMPtr<nsIIOService> io;
nsCOMPtr<nsINetUtil> util; nsCOMPtr<nsINetUtil> util;
io = mozilla::components::IO::Service();
if (io) util = do_QueryInterface(io); if (io) util = do_QueryInterface(io);
if (error) *error = !!util ? NS_OK : NS_ERROR_FAILURE; if (error) *error = !!util ? NS_OK : NS_ERROR_FAILURE;
@ -1556,8 +1559,8 @@ class BufferWriter final : public nsIInputStreamCallback {
NS_ASSERT_OWNINGTHREAD(BufferWriter); NS_ASSERT_OWNINGTHREAD(BufferWriter);
if (!mTaskQueue) { if (!mTaskQueue) {
nsCOMPtr<nsIEventTarget> target = nsCOMPtr<nsIEventTarget> target;
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); target = mozilla::components::StreamTransport::Service();
if (!target) { if (!target) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -2216,8 +2219,8 @@ bool NS_IsSafeMethodNav(nsIChannel* aChannel) {
void NS_WrapAuthPrompt(nsIAuthPrompt* aAuthPrompt, void NS_WrapAuthPrompt(nsIAuthPrompt* aAuthPrompt,
nsIAuthPrompt2** aAuthPrompt2) { nsIAuthPrompt2** aAuthPrompt2) {
nsCOMPtr<nsIAuthPromptAdapterFactory> factory = nsCOMPtr<nsIAuthPromptAdapterFactory> factory;
do_GetService(NS_AUTHPROMPT_ADAPTER_FACTORY_CONTRACTID); factory = mozilla::components::AuthPromptAdapter::Service();
if (!factory) return; if (!factory) return;
NS_WARNING("Using deprecated nsIAuthPrompt"); NS_WARNING("Using deprecated nsIAuthPrompt");
@ -2719,8 +2722,8 @@ uint32_t NS_GetContentDispositionFromToken(const nsAString& aDispToken) {
uint32_t NS_GetContentDispositionFromHeader(const nsACString& aHeader, uint32_t NS_GetContentDispositionFromHeader(const nsACString& aHeader,
nsIChannel* aChan /* = nullptr */) { nsIChannel* aChan /* = nullptr */) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar = nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar;
do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv);
if (NS_FAILED(rv)) return nsIChannel::DISPOSITION_ATTACHMENT; if (NS_FAILED(rv)) return nsIChannel::DISPOSITION_ATTACHMENT;
nsAutoString dispToken; nsAutoString dispToken;
@ -2743,8 +2746,8 @@ nsresult NS_GetFilenameFromDisposition(nsAString& aFilename,
aFilename.Truncate(); aFilename.Truncate();
nsresult rv; nsresult rv;
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar = nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar;
do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Get the value of 'filename' parameter // Get the value of 'filename' parameter
@ -2760,8 +2763,8 @@ nsresult NS_GetFilenameFromDisposition(nsAString& aFilename,
// Filename may still be percent-encoded. Fix: // Filename may still be percent-encoded. Fix:
if (aFilename.FindChar('%') != -1) { if (aFilename.FindChar('%') != -1) {
nsCOMPtr<nsITextToSubURI> textToSubURI = nsCOMPtr<nsITextToSubURI> textToSubURI;
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); textToSubURI = mozilla::components::TextToSubURI::Service(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsAutoString unescaped; nsAutoString unescaped;
textToSubURI->UnEscapeURIForUI(NS_ConvertUTF16toUTF8(aFilename), textToSubURI->UnEscapeURIForUI(NS_ConvertUTF16toUTF8(aFilename),
@ -3511,8 +3514,8 @@ already_AddRefed<nsIURI> TryChangeProtocol(nsIURI* aURI,
// passed value alone) // passed value alone)
static bool Decode5987Format(nsAString& aEncoded) { static bool Decode5987Format(nsAString& aEncoded) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar = nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar;
do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv); mimehdrpar = mozilla::components::MimeHeaderParam::Service(&rv);
if (NS_FAILED(rv)) return false; if (NS_FAILED(rv)) return false;
nsAutoCString asciiValue; nsAutoCString asciiValue;

Просмотреть файл

@ -17,6 +17,7 @@
#include "nsITransport.h" #include "nsITransport.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsThreadPool.h" #include "nsThreadPool.h"
#include "mozilla/Components.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
namespace mozilla { namespace mozilla {
@ -91,8 +92,8 @@ nsInputStreamTransport::OpenInputStream(uint32_t flags, uint32_t segsize,
NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS); NS_ENSURE_TRUE(!mInProgress, NS_ERROR_IN_PROGRESS);
nsresult rv; nsresult rv;
nsCOMPtr<nsIEventTarget> target = nsCOMPtr<nsIEventTarget> target;
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); target = mozilla::components::StreamTransport::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// XXX if the caller requests an unbuffered stream, then perhaps // XXX if the caller requests an unbuffered stream, then perhaps

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Predictor.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Components.h"
#include "mozilla/EndianUtils.h" #include "mozilla/EndianUtils.h"
#include "mozilla/dom/TypedArray.h" #include "mozilla/dom/TypedArray.h"
#include "mozilla/HoldDropJSObjects.h" #include "mozilla/HoldDropJSObjects.h"
@ -60,8 +62,8 @@ static nsresult ResolveHost(const nsACString& host,
nsIDNSListener* listener) { nsIDNSListener* listener) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIDNSService> dns = nsCOMPtr<nsIDNSService> dns;
do_GetService("@mozilla.org/network/dns-service;1", &rv); dns = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -245,8 +247,7 @@ nsUDPSocket::nsUDPSocket() {
// constructed yet. the STS constructor sets gSocketTransportService. // constructed yet. the STS constructor sets gSocketTransportService.
if (!gSocketTransportService) { if (!gSocketTransportService) {
// This call can fail if we're offline, for example. // This call can fail if we're offline, for example.
nsCOMPtr<nsISocketTransportService> sts = mozilla::components::SocketTransport::Service();
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
} }
mSts = gSocketTransportService; mSts = gSocketTransportService;

Просмотреть файл

@ -100,6 +100,7 @@ Classes = [
'headers': ['/netwerk/base/nsBufferedStreams.h'], 'headers': ['/netwerk/base/nsBufferedStreams.h'],
}, },
{ {
'name': 'CaptivePortal',
'cid': '{bdbe0555-fc3d-4f7b-9205-c309ceb2d641}', 'cid': '{bdbe0555-fc3d-4f7b-9205-c309ceb2d641}',
'contract_ids': ['@mozilla.org/network/captive-portal-service;1'], 'contract_ids': ['@mozilla.org/network/captive-portal-service;1'],
'singleton': True, 'singleton': True,
@ -108,6 +109,7 @@ Classes = [
'headers': ['mozilla/net/CaptivePortalService.h'], 'headers': ['mozilla/net/CaptivePortalService.h'],
}, },
{ {
'name': 'Dashboard',
'cid': '{c79eb3c6-091a-45a6-8544-5a8d1ab79537}', 'cid': '{c79eb3c6-091a-45a6-8544-5a8d1ab79537}',
'contract_ids': ['@mozilla.org/network/dashboard;1'], 'contract_ids': ['@mozilla.org/network/dashboard;1'],
'type': 'mozilla::net::Dashboard', 'type': 'mozilla::net::Dashboard',
@ -141,6 +143,7 @@ Classes = [
'headers': ['/netwerk/base/nsDownloader.h'], 'headers': ['/netwerk/base/nsDownloader.h'],
}, },
{ {
'name': 'EffectiveTLD',
'js_name': 'eTLD', 'js_name': 'eTLD',
'cid': '{cb9abbae-66b6-4609-8594-5c4ff300888e}', 'cid': '{cb9abbae-66b6-4609-8594-5c4ff300888e}',
'contract_ids': ['@mozilla.org/network/effective-tld-service;1'], 'contract_ids': ['@mozilla.org/network/effective-tld-service;1'],
@ -184,6 +187,7 @@ Classes = [
'init_method': 'Init', 'init_method': 'Init',
}, },
{ {
'name': 'IDN',
'cid': '{62b778a6-bce3-456b-8c31-2865fbb68c91}', 'cid': '{62b778a6-bce3-456b-8c31-2865fbb68c91}',
'contract_ids': ['@mozilla.org/network/idn-service;1'], 'contract_ids': ['@mozilla.org/network/idn-service;1'],
'type': 'nsIDNService', 'type': 'nsIDNService',
@ -235,6 +239,7 @@ Classes = [
'legacy_constructor': 'nsLoadGroupConstructor', 'legacy_constructor': 'nsLoadGroupConstructor',
}, },
{ {
'name': 'MimeHeaderParam',
'cid': '{1f4dbcf7-245c-4c8c-943d-8a1da0495e8a}', 'cid': '{1f4dbcf7-245c-4c8c-943d-8a1da0495e8a}',
'contract_ids': ['@mozilla.org/network/mime-hdrparam;1'], 'contract_ids': ['@mozilla.org/network/mime-hdrparam;1'],
'type': 'nsMIMEHeaderParamImpl', 'type': 'nsMIMEHeaderParamImpl',
@ -255,6 +260,7 @@ Classes = [
'headers': ['mozilla/net/NetworkConnectivityService.h'], 'headers': ['mozilla/net/NetworkConnectivityService.h'],
}, },
{ {
'name': 'Predictor',
'cid': '{969adfdf-7221-4419-aecf-05f8faf00c9b}', 'cid': '{969adfdf-7221-4419-aecf-05f8faf00c9b}',
'contract_ids': ['@mozilla.org/network/predictor;1'], 'contract_ids': ['@mozilla.org/network/predictor;1'],
'singleton': True, 'singleton': True,
@ -262,6 +268,7 @@ Classes = [
'headers': ['mozilla/net/Predictor.h'], 'headers': ['mozilla/net/Predictor.h'],
}, },
{ {
'name': 'ProtocolProxy',
'cid': '{e9b301c0-e0e4-11d3-a1a8-0050041caf44}', 'cid': '{e9b301c0-e0e4-11d3-a1a8-0050041caf44}',
'contract_ids': ['@mozilla.org/network/protocol-proxy-service;1'], 'contract_ids': ['@mozilla.org/network/protocol-proxy-service;1'],
'singleton': True, 'singleton': True,
@ -324,6 +331,7 @@ Classes = [
}, },
}, },
{ {
'name': 'FileProtocolHandler',
'cid': '{fbc81170-1f69-11d3-9344-00104ba0fd40}', 'cid': '{fbc81170-1f69-11d3-9344-00104ba0fd40}',
'contract_ids': ['@mozilla.org/network/protocol;1?name=file'], 'contract_ids': ['@mozilla.org/network/protocol;1?name=file'],
'singleton': True, 'singleton': True,
@ -341,6 +349,7 @@ Classes = [
}, },
}, },
{ {
'name': 'HttpHandler',
'cid': '{4f47e42e-4d23-4dd3-bfda-eb29255e9ea3}', 'cid': '{4f47e42e-4d23-4dd3-bfda-eb29255e9ea3}',
'contract_ids': ['@mozilla.org/network/protocol;1?name=http'], 'contract_ids': ['@mozilla.org/network/protocol;1?name=http'],
'singleton': True, 'singleton': True,
@ -621,6 +630,7 @@ Classes = [
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS, 'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
}, },
{ {
'name': 'StreamConverter',
'cid': '{892ffeb0-3f80-11d3-a16c-0050041caf44}', 'cid': '{892ffeb0-3f80-11d3-a16c-0050041caf44}',
'contract_ids': ['@mozilla.org/streamConverters;1'], 'contract_ids': ['@mozilla.org/streamConverters;1'],
'legacy_constructor': 'CreateNewStreamConvServiceFactory', 'legacy_constructor': 'CreateNewStreamConvServiceFactory',

Просмотреть файл

@ -8,6 +8,7 @@
#include "CookieLogging.h" #include "CookieLogging.h"
#include "mozilla/AppShutdown.h" #include "mozilla/AppShutdown.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/ContentBlockingNotifier.h" #include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/dom/Document.h" #include "mozilla/dom/Document.h"
@ -268,13 +269,13 @@ CookieService::CookieService() = default;
nsresult CookieService::Init() { nsresult CookieService::Init() {
nsresult rv; nsresult rv;
mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv); mTLDService = mozilla::components::EffectiveTLD::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv); mIDNService = mozilla::components::IDN::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mThirdPartyUtil = do_GetService(THIRDPARTYUTIL_CONTRACTID); mThirdPartyUtil = mozilla::components::ThirdPartyUtil::Service();
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// Init our default, and possibly private CookieStorages. // Init our default, and possibly private CookieStorages.

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsICancelable.h" #include "nsICancelable.h"
#include "nsIDNSRecord.h" #include "nsIDNSRecord.h"
#include "nsHostResolver.h" #include "nsHostResolver.h"
#include "mozilla/Components.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "DNSAdditionalInfo.h" #include "DNSAdditionalInfo.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
@ -43,7 +44,8 @@ void DNSRequestHandler::DoAsyncResolve(const nsACString& hostname,
nsIDNSService::DNSFlags flags) { nsIDNSService::DNSFlags flags) {
nsresult rv; nsresult rv;
mFlags = flags; mFlags = flags;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); nsCOMPtr<nsIDNSService> dns;
dns = mozilla::components::DNS::Service(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIEventTarget> main = GetMainThreadSerialEventTarget(); nsCOMPtr<nsIEventTarget> main = GetMainThreadSerialEventTarget();
nsCOMPtr<nsICancelable> unused; nsCOMPtr<nsICancelable> unused;
@ -66,7 +68,8 @@ void DNSRequestHandler::OnRecvCancelDNSRequest(
const uint16_t& type, const OriginAttributes& originAttributes, const uint16_t& type, const OriginAttributes& originAttributes,
const nsIDNSService::DNSFlags& flags, const nsresult& reason) { const nsIDNSService::DNSFlags& flags, const nsresult& reason) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); nsCOMPtr<nsIDNSService> dns;
dns = mozilla::components::DNS::Service(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
RefPtr<DNSAdditionalInfo> info; RefPtr<DNSAdditionalInfo> info;
if (!aTrrServer.IsEmpty() || port != -1) { if (!aTrrServer.IsEmpty() || port != -1) {

Просмотреть файл

@ -6,6 +6,7 @@
#include "mozilla/net/TRRServiceChild.h" #include "mozilla/net/TRRServiceChild.h"
#include "mozilla/Atomics.h" #include "mozilla/Atomics.h"
#include "mozilla/Components.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
@ -42,8 +43,8 @@ TRRServiceChild* TRRServiceChild::GetSingleton() {
void TRRServiceChild::Init(const bool& aCaptiveIsPassed, void TRRServiceChild::Init(const bool& aCaptiveIsPassed,
const bool& aParentalControlEnabled, const bool& aParentalControlEnabled,
nsTArray<nsCString>&& aDNSSuffixList) { nsTArray<nsCString>&& aDNSSuffixList) {
nsCOMPtr<nsIDNSService> dns = nsCOMPtr<nsIDNSService> dns;
do_GetService("@mozilla.org/network/dns-service;1"); dns = mozilla::components::DNS::Service();
sDNSService = dns; sDNSService = dns;
ClearOnShutdown(&sDNSService); ClearOnShutdown(&sDNSService);
MOZ_ASSERT(sDNSService); MOZ_ASSERT(sDNSService);

Просмотреть файл

@ -9,6 +9,7 @@
// http://wiki.mozilla.org/Gecko:Effective_TLD_Service // http://wiki.mozilla.org/Gecko:Effective_TLD_Service
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/Components.h"
#include "mozilla/HashFunctions.h" #include "mozilla/HashFunctions.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/ResultExtensions.h" #include "mozilla/ResultExtensions.h"
@ -59,7 +60,7 @@ nsresult nsEffectiveTLDService::Init() {
} }
nsresult rv; nsresult rv;
mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv); mIDNService = mozilla::components::IDN::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -116,8 +117,8 @@ nsEffectiveTLDService* nsEffectiveTLDService::GetInstance() {
if (gService) { if (gService) {
return gService; return gService;
} }
nsCOMPtr<nsIEffectiveTLDService> tldService = nsCOMPtr<nsIEffectiveTLDService> tldService;
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID); tldService = mozilla::components::EffectiveTLD::Service();
if (!tldService) { if (!tldService) {
return nullptr; return nullptr;
} }

Просмотреть файл

@ -10,6 +10,7 @@
#include "NeckoCommon.h" #include "NeckoCommon.h"
#include "mozilla/AntiTrackingUtils.h" #include "mozilla/AntiTrackingUtils.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/Components.h"
#include "mozilla/LoadInfo.h" #include "mozilla/LoadInfo.h"
#include "mozilla/NullPrincipal.h" #include "mozilla/NullPrincipal.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
@ -261,9 +262,9 @@ class ParentProcessDocumentOpenInfo final : public nsDocumentOpenInfo,
} }
nsresult rv; nsresult rv;
nsCOMPtr<nsIStreamConverterService> streamConvService = nsCOMPtr<nsIStreamConverterService> streamConvService;
do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv);
nsAutoCString str; nsAutoCString str;
streamConvService = mozilla::components::StreamConverter::Service(&rv);
rv = streamConvService->ConvertedType(mContentType, aChannel, str); rv = streamConvService->ConvertedType(mContentType, aChannel, str);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsINetworkLinkService.h" #include "nsINetworkLinkService.h"
#include "nsQueryObject.h" #include "nsQueryObject.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/Components.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "SimpleChannel.h" #include "SimpleChannel.h"
@ -263,8 +264,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPrefetch(
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictorVerifier> predictor = nsCOMPtr<nsINetworkPredictorVerifier> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
predictor->OnPredictPrefetch(aURI, aHttpStatus); predictor->OnPredictPrefetch(aURI, aHttpStatus);
@ -280,8 +281,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPreconnect(nsIURI* aURI) {
} }
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictorVerifier> predictor = nsCOMPtr<nsINetworkPredictorVerifier> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
predictor->OnPredictPreconnect(aURI); predictor->OnPredictPreconnect(aURI);
@ -297,8 +298,8 @@ mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictDNS(nsIURI* aURI) {
} }
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictorVerifier> predictor = nsCOMPtr<nsINetworkPredictorVerifier> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this)); NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
predictor->OnPredictDNS(aURI); predictor->OnPredictDNS(aURI);

Просмотреть файл

@ -7,6 +7,7 @@
#include "nsHttp.h" #include "nsHttp.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/ContentPrincipal.h" #include "mozilla/ContentPrincipal.h"
#include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/net/ExtensionProtocolHandler.h" #include "mozilla/net/ExtensionProtocolHandler.h"
@ -572,8 +573,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredPredict(
const OriginAttributes& aOriginAttributes, const bool& hasVerifier) { const OriginAttributes& aOriginAttributes, const bool& hasVerifier) {
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictor> predictor = nsCOMPtr<nsINetworkPredictor> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_OK()); NS_ENSURE_SUCCESS(rv, IPC_OK());
nsCOMPtr<nsINetworkPredictorVerifier> verifier; nsCOMPtr<nsINetworkPredictorVerifier> verifier;
@ -590,8 +591,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredLearn(
const OriginAttributes& aOriginAttributes) { const OriginAttributes& aOriginAttributes) {
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictor> predictor = nsCOMPtr<nsINetworkPredictor> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_OK()); NS_ENSURE_SUCCESS(rv, IPC_OK());
predictor->LearnNative(aTargetURI, aSourceURI, aReason, aOriginAttributes); predictor->LearnNative(aTargetURI, aSourceURI, aReason, aOriginAttributes);
@ -601,8 +602,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredLearn(
mozilla::ipc::IPCResult NeckoParent::RecvPredReset() { mozilla::ipc::IPCResult NeckoParent::RecvPredReset() {
// Get the current predictor // Get the current predictor
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsINetworkPredictor> predictor = nsCOMPtr<nsINetworkPredictor> predictor;
do_GetService("@mozilla.org/network/predictor;1", &rv); predictor = mozilla::components::Predictor::Service(&rv);
NS_ENSURE_SUCCESS(rv, IPC_OK()); NS_ENSURE_SUCCESS(rv, IPC_OK());
predictor->Reset(); predictor->Reset();

Просмотреть файл

@ -6,6 +6,7 @@
#include "ProxyConfigLookup.h" #include "ProxyConfigLookup.h"
#include "ProxyConfigLookupChild.h" #include "ProxyConfigLookupChild.h"
#include "mozilla/Components.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsICancelable.h" #include "nsICancelable.h"
@ -59,8 +60,8 @@ nsresult ProxyConfigLookup::DoProxyResolve(nsICancelable** aLookupCancellable) {
return rv; return rv;
} }
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); pps = mozilla::components::ProtocolProxy::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

Просмотреть файл

@ -7,6 +7,7 @@
#include "SocketProcessLogging.h" #include "SocketProcessLogging.h"
#include "mozilla/AppShutdown.h" #include "mozilla/AppShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/Endpoint.h" #include "mozilla/ipc/Endpoint.h"
@ -144,8 +145,8 @@ void SocketProcessBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
} }
nsresult res; nsresult res;
nsCOMPtr<nsISerialEventTarget> mSTSThread = nsCOMPtr<nsISerialEventTarget> mSTSThread;
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res); mSTSThread = mozilla::components::SocketTransport::Service(&res);
if (NS_SUCCEEDED(res) && mSTSThread) { if (NS_SUCCEEDED(res) && mSTSThread) {
// This must be called off the main thread. If we don't make this call // This must be called off the main thread. If we don't make this call
// ipc::BackgroundChild::GetOrCreateSocketActorForCurrentThread() will // ipc::BackgroundChild::GetOrCreateSocketActorForCurrentThread() will

Просмотреть файл

@ -194,8 +194,7 @@ bool SocketProcessChild::Init(mozilla::ipc::UntypedEndpoint&& aEndpoint,
} }
// Initialize DNS Service here, since it needs to be done in main thread. // Initialize DNS Service here, since it needs to be done in main thread.
nsCOMPtr<nsIDNSService> dns = mozilla::components::DNS::Service(&rv);
do_GetService("@mozilla.org/network/dns-service;1", &rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return false; return false;
} }
@ -210,7 +209,7 @@ bool SocketProcessChild::Init(mozilla::ipc::UntypedEndpoint&& aEndpoint,
Unused << obs->AddObserver(observer, "profile-change-net-teardown", false); Unused << obs->AddObserver(observer, "profile-change-net-teardown", false);
} }
mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID); mSocketThread = mozilla::components::SocketTransport::Service();
if (!mSocketThread) { if (!mSocketThread) {
return false; return false;
} }
@ -440,8 +439,9 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvUpdateDeviceModelId(
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
SocketProcessChild::RecvOnHttpActivityDistributorActivated( SocketProcessChild::RecvOnHttpActivityDistributorActivated(
const bool& aIsActivated) { const bool& aIsActivated) {
if (nsCOMPtr<nsIHttpActivityObserver> distributor = nsCOMPtr<nsIHttpActivityObserver> distributor;
components::HttpActivityDistributor::Service()) { distributor = mozilla::components::HttpActivityDistributor::Service();
if (distributor) {
distributor->SetIsActive(aIsActivated); distributor->SetIsActive(aIsActivated);
} }
return IPC_OK(); return IPC_OK();
@ -450,8 +450,8 @@ SocketProcessChild::RecvOnHttpActivityDistributorActivated(
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
SocketProcessChild::RecvOnHttpActivityDistributorObserveProxyResponse( SocketProcessChild::RecvOnHttpActivityDistributorObserveProxyResponse(
const bool& aIsEnabled) { const bool& aIsEnabled) {
nsCOMPtr<nsIHttpActivityDistributor> distributor = nsCOMPtr<nsIHttpActivityDistributor> distributor;
do_GetService("@mozilla.org/network/http-activity-distributor;1"); distributor = mozilla::components::HttpActivityDistributor::Service();
if (distributor) { if (distributor) {
Unused << distributor->SetObserveProxyResponse(aIsEnabled); Unused << distributor->SetObserveProxyResponse(aIsEnabled);
} }
@ -461,8 +461,8 @@ SocketProcessChild::RecvOnHttpActivityDistributorObserveProxyResponse(
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
SocketProcessChild::RecvOnHttpActivityDistributorObserveConnection( SocketProcessChild::RecvOnHttpActivityDistributorObserveConnection(
const bool& aIsEnabled) { const bool& aIsEnabled) {
nsCOMPtr<nsIHttpActivityDistributor> distributor = nsCOMPtr<nsIHttpActivityDistributor> distributor;
do_GetService("@mozilla.org/network/http-activity-distributor;1"); distributor = mozilla::components::HttpActivityDistributor::Service();
if (distributor) { if (distributor) {
Unused << distributor->SetObserveConnection(aIsEnabled); Unused << distributor->SetObserveConnection(aIsEnabled);
} }
@ -641,8 +641,8 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvGetSocketData(
mozilla::ipc::IPCResult SocketProcessChild::RecvGetDNSCacheEntries( mozilla::ipc::IPCResult SocketProcessChild::RecvGetDNSCacheEntries(
GetDNSCacheEntriesResolver&& aResolve) { GetDNSCacheEntriesResolver&& aResolve) {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsIDNSService> dns = nsCOMPtr<nsIDNSService> dns;
do_GetService("@mozilla.org/network/dns-service;1", &rv); dns = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
aResolve(nsTArray<DNSCacheEntries>()); aResolve(nsTArray<DNSCacheEntries>());
return IPC_OK(); return IPC_OK();

Просмотреть файл

@ -21,6 +21,8 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/Components.h"
using namespace mozilla::net; using namespace mozilla::net;
NS_IMPL_ISUPPORTS(nsAboutCache, nsIAboutModule) NS_IMPL_ISUPPORTS(nsAboutCache, nsIAboutModule)
@ -213,8 +215,8 @@ nsresult nsAboutCache::GetStorage(nsACString const& storageName,
nsICacheStorage** storage) { nsICacheStorage** storage) {
nsresult rv; nsresult rv;
nsCOMPtr<nsICacheStorageService> cacheService = nsCOMPtr<nsICacheStorageService> cacheService;
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv); cacheService = mozilla::components::CacheStorage::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsICacheStorage> cacheStorage; nsCOMPtr<nsICacheStorage> cacheStorage;

Просмотреть файл

@ -30,6 +30,7 @@
#include "prio.h" #include "prio.h"
#include <algorithm> #include <algorithm>
#include "mozilla/Components.h"
#include "mozilla/TaskQueue.h" #include "mozilla/TaskQueue.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
@ -149,8 +150,8 @@ nsresult nsFileCopyEvent::Dispatch(nsIRunnable* callback,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Dispatch ourselves to I/O thread pool... // Dispatch ourselves to I/O thread pool...
nsCOMPtr<nsIEventTarget> pool = nsCOMPtr<nsIEventTarget> pool;
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); pool = mozilla::components::StreamTransport::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
return pool->Dispatch(this, NS_DISPATCH_NORMAL); return pool->Dispatch(this, NS_DISPATCH_NORMAL);
@ -427,8 +428,7 @@ nsresult nsFileChannel::ListenerBlockingPromise(BlockingPromise** aPromise) {
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIEventTarget> sts( nsCOMPtr<nsIEventTarget> sts(mozilla::components::StreamTransport::Service());
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID));
if (!sts) { if (!sts) {
return FixupContentLength(true); return FixupContentLength(true);
} }

Просмотреть файл

@ -7,6 +7,7 @@
#include "CachePushChecker.h" #include "CachePushChecker.h"
#include "LoadContextInfo.h" #include "LoadContextInfo.h"
#include "mozilla/Components.h"
#include "mozilla/ScopeExit.h" #include "mozilla/ScopeExit.h"
#include "mozilla/net/SocketProcessChild.h" #include "mozilla/net/SocketProcessChild.h"
#include "nsICacheEntry.h" #include "nsICacheEntry.h"
@ -54,8 +55,8 @@ nsresult CachePushChecker::DoCheck() {
} }
nsresult rv; nsresult rv;
nsCOMPtr<nsICacheStorageService> css = nsCOMPtr<nsICacheStorageService> css;
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv); css = mozilla::components::CacheStorage::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

Просмотреть файл

@ -209,8 +209,8 @@ nsresult DnsAndConnectSocket::SetupDnsFlags(ConnectionEntry* ent) {
if (ent->mConnInfo->HasIPHintAddress()) { if (ent->mConnInfo->HasIPHintAddress()) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIDNSService> dns = nsCOMPtr<nsIDNSService> dns;
do_GetService("@mozilla.org/network/dns-service;1", &rv); dns = mozilla::components::DNS::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -1206,8 +1206,8 @@ nsresult DnsAndConnectSocket::TransportSetup::SetupStreams(
} }
if (ci->HasIPHintAddress()) { if (ci->HasIPHintAddress()) {
nsCOMPtr<nsIDNSService> dns = nsCOMPtr<nsIDNSService> dns;
do_GetService("@mozilla.org/network/dns-service;1", &rv); dns = mozilla::components::DNS::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// The spec says: "If A and AAAA records for TargetName are locally // The spec says: "If A and AAAA records for TargetName are locally

Просмотреть файл

@ -21,6 +21,7 @@
#include "mozilla/dom/WindowGlobalParent.h" #include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/net/NeckoParent.h" #include "mozilla/net/NeckoParent.h"
#include "mozilla/net/CookieServiceParent.h" #include "mozilla/net/CookieServiceParent.h"
#include "mozilla/Components.h"
#include "mozilla/InputStreamLengthHelper.h" #include "mozilla/InputStreamLengthHelper.h"
#include "mozilla/IntegerPrintfMacros.h" #include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
@ -325,8 +326,8 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void** result) {
if (!mBrowserParent && (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) || if (!mBrowserParent && (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
aIID.Equals(NS_GET_IID(nsIAuthPrompt2)))) { aIID.Equals(NS_GET_IID(nsIAuthPrompt2)))) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIWindowWatcher> wwatch = nsCOMPtr<nsIWindowWatcher> wwatch;
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); wwatch = mozilla::components::WindowWatcher::Service(&rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_NO_INTERFACE); NS_ENSURE_SUCCESS(rv, NS_ERROR_NO_INTERFACE);
bool hasWindowCreator = false; bool hasWindowCreator = false;

Просмотреть файл

@ -8,6 +8,7 @@
#include "HttpLog.h" #include "HttpLog.h"
#include "mozilla/net/NeckoChannelParams.h" // For HttpActivityArgs. #include "mozilla/net/NeckoChannelParams.h" // For HttpActivityArgs.
#include "mozilla/Components.h"
#include "nsHttp.h" #include "nsHttp.h"
#include "NullHttpTransaction.h" #include "NullHttpTransaction.h"
#include "nsHttpHandler.h" #include "nsHttpHandler.h"
@ -34,7 +35,7 @@ NullHttpTransaction::NullHttpTransaction(nsHttpConnectionInfo* ci,
mConnectionInfo(ci) { mConnectionInfo(ci) {
nsresult rv; nsresult rv;
mActivityDistributor = mActivityDistributor =
do_GetService(NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &rv); mozilla::components::HttpActivityDistributor::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return; return;
} }

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/dom/ServiceWorkerUtils.h" #include "mozilla/dom/ServiceWorkerUtils.h"
#include "mozilla/net/HttpChannelParent.h" #include "mozilla/net/HttpChannelParent.h"
#include "mozilla/net/RedirectChannelRegistrar.h" #include "mozilla/net/RedirectChannelRegistrar.h"
#include "mozilla/Components.h"
#include "mozilla/SchedulerGroup.h" #include "mozilla/SchedulerGroup.h"
#include "nsIHttpHeaderVisitor.h" #include "nsIHttpHeaderVisitor.h"
#include "nsIPrompt.h" #include "nsIPrompt.h"
@ -165,8 +166,8 @@ ParentChannelListener::GetInterface(const nsIID& aIID, void** result) {
NS_ENSURE_TRUE(win, NS_ERROR_NO_INTERFACE); NS_ENSURE_TRUE(win, NS_ERROR_NO_INTERFACE);
nsresult rv; nsresult rv;
nsCOMPtr<nsIWindowWatcher> wwatch = nsCOMPtr<nsIWindowWatcher> wwatch;
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); wwatch = mozilla::components::WindowWatcher::Service(&rv);
if (NS_WARN_IF(!NS_SUCCEEDED(rv))) { if (NS_WARN_IF(!NS_SUCCEEDED(rv))) {
return NS_ERROR_NO_INTERFACE; 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 // we're either allowing auth, or it's a proxy request
nsresult rv; nsresult rv;
nsCOMPtr<nsIPromptFactory> wwatch = nsCOMPtr<nsIPromptFactory> wwatch;
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); wwatch = mozilla::components::WindowWatcher::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindowOuter> window; nsCOMPtr<nsPIDOMWindowOuter> window;

Просмотреть файл

@ -7,6 +7,7 @@
#include "nsIThreadRetargetableStreamListener.h" #include "nsIThreadRetargetableStreamListener.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Components.h"
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
#include "mozilla/StaticPrefs_content.h" #include "mozilla/StaticPrefs_content.h"
#include "mozilla/StoragePrincipalHelper.h" #include "mozilla/StoragePrincipalHelper.h"
@ -1721,7 +1722,7 @@ void nsCORSListenerProxy::LogBlockedCORSRequest(
// Build the error object and log it to the console // Build the error object and log it to the console
nsCOMPtr<nsIConsoleService> console( nsCOMPtr<nsIConsoleService> console(
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv)); mozilla::components::Console::Service(&rv));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("Failed to log blocked cross-site request (no console)"); NS_WARNING("Failed to log blocked cross-site request (no console)");
return; return;

Просмотреть файл

@ -1818,7 +1818,7 @@ nsresult nsHttpChannel::CallOnStartRequest() {
if (contentType.Equals("multipart/x-mixed-replace"_ns)) { if (contentType.Equals("multipart/x-mixed-replace"_ns)) {
nsCOMPtr<nsIStreamConverterService> convServ( nsCOMPtr<nsIStreamConverterService> convServ(
do_GetService("@mozilla.org/streamConverters;1", &rv)); mozilla::components::StreamConverter::Service(&rv));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIStreamListener> toListener(mListener); nsCOMPtr<nsIStreamListener> toListener(mListener);
nsCOMPtr<nsIStreamListener> fromListener; nsCOMPtr<nsIStreamListener> fromListener;
@ -2866,8 +2866,8 @@ nsresult nsHttpChannel::PromptTempRedirect() {
return NS_OK; return NS_OK;
} }
nsresult rv; nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService = nsCOMPtr<nsIStringBundleService> bundleService;
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); bundleService = mozilla::components::StringBundle::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIStringBundle> stringBundle; nsCOMPtr<nsIStringBundle> stringBundle;
@ -2896,8 +2896,8 @@ nsresult nsHttpChannel::ProxyFailover() {
nsresult rv; nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); pps = mozilla::components::ProtocolProxy::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIProxyInfo> pi; nsCOMPtr<nsIProxyInfo> pi;
@ -3283,8 +3283,8 @@ nsresult nsHttpChannel::ResolveProxy() {
nsresult rv; nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); pps = mozilla::components::ProtocolProxy::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// using the nsIProtocolProxyService2 allows a minor performance // using the nsIProtocolProxyService2 allows a minor performance
@ -5500,8 +5500,9 @@ nsresult nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) {
if (!isRedirectURIInAllowList) { if (!isRedirectURIInAllowList) {
nsCOMPtr<nsIURI> strippedURI; nsCOMPtr<nsIURI> strippedURI;
nsCOMPtr<nsIURLQueryStringStripper> queryStripper = nsCOMPtr<nsIURLQueryStringStripper> queryStripper;
components::URLQueryStringStripper::Service(&rv); queryStripper =
mozilla::components::URLQueryStringStripper::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
uint32_t numStripped; uint32_t numStripped;
@ -6564,8 +6565,8 @@ nsresult nsHttpChannel::BeginConnect() {
MOZ_ASSERT(NS_SUCCEEDED(rv)); MOZ_ASSERT(NS_SUCCEEDED(rv));
} }
nsCOMPtr<nsIConsoleService> consoleService = nsCOMPtr<nsIConsoleService> consoleService;
do_GetService(NS_CONSOLESERVICE_CONTRACTID); consoleService = mozilla::components::Console::Service();
if (consoleService && !host.Equals(mapping->AlternateHost())) { if (consoleService && !host.Equals(mapping->AlternateHost())) {
nsAutoString message(u"Alternate Service Mapping found: "_ns); nsAutoString message(u"Alternate Service Mapping found: "_ns);
AppendASCIItoUTF16(scheme, message); AppendASCIItoUTF16(scheme, message);
@ -7752,8 +7753,7 @@ static nsLiteralCString ContentTypeToTelemetryLabel(nsHttpChannel* aChannel) {
} }
nsresult nsHttpChannel::LogConsoleError(const char* aTag) { nsresult nsHttpChannel::LogConsoleError(const char* aTag) {
nsCOMPtr<nsIConsoleService> console( nsCOMPtr<nsIConsoleService> console(mozilla::components::Console::Service());
do_GetService(NS_CONSOLESERVICE_CONTRACTID));
NS_ENSURE_TRUE(console, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(console, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo(); nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
@ -8528,8 +8528,8 @@ nsHttpChannel::OnDataAvailable(nsIRequest* request, nsIInputStream* input,
count = delta; count = delta;
NS_WARNING("Listener OnDataAvailable contract violation"); NS_WARNING("Listener OnDataAvailable contract violation");
nsCOMPtr<nsIConsoleService> consoleService = nsCOMPtr<nsIConsoleService> consoleService;
do_GetService(NS_CONSOLESERVICE_CONTRACTID); consoleService = mozilla::components::Console::Service();
nsAutoString message(nsLiteralString( nsAutoString message(nsLiteralString(
u"http channel Listener OnDataAvailable contract violation")); u"http channel Listener OnDataAvailable contract violation"));
if (consoleService) { if (consoleService) {
@ -10019,8 +10019,8 @@ nsresult nsHttpChannel::TriggerNetwork() {
void nsHttpChannel::MaybeRaceCacheWithNetwork() { void nsHttpChannel::MaybeRaceCacheWithNetwork() {
nsresult rv; nsresult rv;
nsCOMPtr<nsINetworkLinkService> netLinkSvc = nsCOMPtr<nsINetworkLinkService> netLinkSvc;
do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); netLinkSvc = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return; return;
} }

Просмотреть файл

@ -8,6 +8,7 @@
#include "HttpLog.h" #include "HttpLog.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "mozilla/Components.h"
#include "mozilla/StoragePrincipalHelper.h" #include "mozilla/StoragePrincipalHelper.h"
#include "mozilla/Tokenizer.h" #include "mozilla/Tokenizer.h"
#include "MockHttpAuth.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 // assume the user said ok. this is done to keep things working in
// embedded builds, where the string bundle might not be present, etc. // embedded builds, where the string bundle might not be present, etc.
nsCOMPtr<nsIStringBundleService> bundleService = nsCOMPtr<nsIStringBundleService> bundleService;
do_GetService(NS_STRINGBUNDLE_CONTRACTID); bundleService = mozilla::components::StringBundle::Service();
if (!bundleService) return true; if (!bundleService) return true;
nsCOMPtr<nsIStringBundle> bundle; nsCOMPtr<nsIStringBundle> bundle;

Просмотреть файл

@ -144,8 +144,8 @@ static nsCString GetDeviceModelId() {
// Assumed to be running on the main thread // Assumed to be running on the main thread
// We need the device property in either case // We need the device property in either case
nsAutoCString deviceModelId; nsAutoCString deviceModelId;
nsCOMPtr<nsIPropertyBag2> infoService = nsCOMPtr<nsIPropertyBag2> infoService;
do_GetService("@mozilla.org/system-info;1"); infoService = mozilla::components::SystemInfo::Service();
MOZ_ASSERT(infoService, "Could not find a system info service"); MOZ_ASSERT(infoService, "Could not find a system info service");
nsAutoString androidDevice; nsAutoString androidDevice;
nsresult rv = infoService->GetPropertyAsAString(u"device"_ns, androidDevice); nsresult rv = infoService->GetPropertyAsAString(u"device"_ns, androidDevice);
@ -266,7 +266,8 @@ nsHttpHandler::nsHttpHandler()
MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!"); MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!");
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1"); nsCOMPtr<nsIXULRuntime> runtime;
runtime = mozilla::components::XULRuntime::Service();
if (runtime) { if (runtime) {
runtime->GetProcessID(&mProcessId); runtime->GetProcessID(&mProcessId);
} }
@ -327,7 +328,8 @@ nsresult nsHttpHandler::Init() {
rv = nsHttp::CreateAtomTable(); rv = nsHttp::CreateAtomTable();
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIIOService> service = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); nsCOMPtr<nsIIOService> service;
service = mozilla::components::IO::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without io service"); NS_WARNING("unable to continue without io service");
return rv; return rv;
@ -387,8 +389,8 @@ nsresult nsHttpHandler::Init() {
mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION); mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION);
nsCOMPtr<nsIXULAppInfo> appInfo = nsCOMPtr<nsIXULAppInfo> appInfo;
do_GetService("@mozilla.org/xre/app-info;1"); appInfo = mozilla::components::XULRuntime::Service();
mAppName.AssignLiteral(MOZ_APP_UA_NAME); mAppName.AssignLiteral(MOZ_APP_UA_NAME);
if (mAppName.Length() == 0 && appInfo) { if (mAppName.Length() == 0 && appInfo) {
@ -666,8 +668,8 @@ bool nsHttpHandler::IsAcceptableEncoding(const char* enc, bool isSecure) {
nsISiteSecurityService* nsHttpHandler::GetSSService() { nsISiteSecurityService* nsHttpHandler::GetSSService() {
if (!mSSService) { if (!mSSService) {
nsCOMPtr<nsISiteSecurityService> service = nsCOMPtr<nsISiteSecurityService> service;
do_GetService(NS_SSSERVICE_CONTRACTID); service = mozilla::components::SiteSecurity::Service();
mSSService = new nsMainThreadPtrHolder<nsISiteSecurityService>( mSSService = new nsMainThreadPtrHolder<nsISiteSecurityService>(
"nsHttpHandler::mSSService", service); "nsHttpHandler::mSSService", service);
} }
@ -889,8 +891,8 @@ void nsHttpHandler::InitUserAgentComponents() {
#endif #endif
#ifdef ANDROID #ifdef ANDROID
nsCOMPtr<nsIPropertyBag2> infoService = nsCOMPtr<nsIPropertyBag2> infoService;
do_GetService("@mozilla.org/system-info;1"); infoService = mozilla::components::SystemInfo::Service();
MOZ_ASSERT(infoService, "Could not find a system info service"); MOZ_ASSERT(infoService, "Could not find a system info service");
nsresult rv; nsresult rv;

Просмотреть файл

@ -7,6 +7,7 @@
#include "ExtensionProtocolHandler.h" #include "ExtensionProtocolHandler.h"
#include "mozilla/BinarySearch.h" #include "mozilla/BinarySearch.h"
#include "mozilla/Components.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/Promise.h" #include "mozilla/dom/Promise.h"
#include "mozilla/dom/Promise-inl.h" #include "mozilla/dom/Promise-inl.h"
@ -551,8 +552,8 @@ nsresult ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
nsIChannel* channel, nsIChannel* channel,
nsIChannel* origChannel) -> nsresult { nsIChannel* origChannel) -> nsresult {
nsresult rv; nsresult rv;
nsCOMPtr<nsIStreamConverterService> convService = nsCOMPtr<nsIStreamConverterService> convService;
do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv); convService = mozilla::components::StreamConverter::Service(&rv);
MOZ_TRY(rv); MOZ_TRY(rv);
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;

Просмотреть файл

@ -7,6 +7,7 @@
#include "PageThumbProtocolHandler.h" #include "PageThumbProtocolHandler.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/ipc/URIParams.h" #include "mozilla/ipc/URIParams.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/NeckoChild.h" #include "mozilla/net/NeckoChild.h"
@ -313,8 +314,8 @@ nsresult PageThumbProtocolHandler::GetThumbnailPath(const nsACString& aPath,
nsresult rv; nsresult rv;
if (aHost.EqualsLiteral(PAGE_THUMB_HOST)) { if (aHost.EqualsLiteral(PAGE_THUMB_HOST)) {
nsCOMPtr<nsIPageThumbsStorageService> pageThumbsStorage = nsCOMPtr<nsIPageThumbsStorageService> pageThumbsStorage;
do_GetService("@mozilla.org/thumbnails/pagethumbs-service;1", &rv); pageThumbsStorage = mozilla::components::PageThumbsStorage::Service(&rv);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
} }
@ -324,8 +325,8 @@ nsresult PageThumbProtocolHandler::GetThumbnailPath(const nsACString& aPath,
aThumbnailPath); aThumbnailPath);
#ifdef MOZ_PLACES #ifdef MOZ_PLACES
} else if (aHost.EqualsLiteral(PLACES_PREVIEWS_HOST)) { } else if (aHost.EqualsLiteral(PLACES_PREVIEWS_HOST)) {
nsCOMPtr<nsIPlacesPreviewsHelperService> helper = nsCOMPtr<nsIPlacesPreviewsHelperService> helper;
do_GetService("@mozilla.org/places/previews-helper;1", &rv); helper = mozilla::components::PlacesPreviewsHelper::Service(&rv);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
} }

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/Atomics.h" #include "mozilla/Atomics.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Base64.h" #include "mozilla/Base64.h"
#include "mozilla/Components.h"
#include "mozilla/EndianUtils.h" #include "mozilla/EndianUtils.h"
#include "mozilla/MathAlgorithms.h" #include "mozilla/MathAlgorithms.h"
#include "mozilla/ScopeExit.h" #include "mozilla/ScopeExit.h"
@ -176,8 +177,8 @@ class FailDelayManager {
mDelaysDisabled = false; mDelaysDisabled = false;
nsCOMPtr<nsIPrefBranch> prefService = nsCOMPtr<nsIPrefBranch> prefService;
do_GetService(NS_PREFSERVICE_CONTRACTID); prefService = mozilla::components::Preferences::Service();
if (!prefService) { if (!prefService) {
return; return;
} }
@ -1224,8 +1225,7 @@ WebSocketChannel::WebSocketChannel()
mFramePtr = mBuffer = static_cast<uint8_t*>(moz_xmalloc(mBufferSize)); mFramePtr = mBuffer = static_cast<uint8_t*>(moz_xmalloc(mBufferSize));
nsresult rv; nsresult rv;
mConnectionLogService = mConnectionLogService = mozilla::components::Dashboard::Service(&rv);
do_GetService("@mozilla.org/network/dashboard;1", &rv);
if (NS_FAILED(rv)) LOG(("Failed to initiate dashboard service.")); if (NS_FAILED(rv)) LOG(("Failed to initiate dashboard service."));
mService = WebSocketEventService::GetOrCreate(); mService = WebSocketEventService::GetOrCreate();
@ -2743,8 +2743,8 @@ void ProcessServerWebSocketExtensions(const nsACString& aExtensions,
nsACString& aNegotiatedExtensions) { nsACString& aNegotiatedExtensions) {
aNegotiatedExtensions.Truncate(); aNegotiatedExtensions.Truncate();
nsCOMPtr<nsIPrefBranch> prefService = nsCOMPtr<nsIPrefBranch> prefService;
do_GetService(NS_PREFSERVICE_CONTRACTID); prefService = mozilla::components::Preferences::Service();
if (prefService) { if (prefService) {
bool boolpref; bool boolpref;
nsresult rv = prefService->GetBoolPref( nsresult rv = prefService->GetBoolPref(
@ -2895,7 +2895,8 @@ nsresult WebSocketChannel::DoAdmissionDNS() {
rv = mURI->GetPort(&mPort); rv = mURI->GetPort(&mPort);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (mPort == -1) mPort = (mEncrypted ? kDefaultWSSPort : kDefaultWSPort); if (mPort == -1) mPort = (mEncrypted ? kDefaultWSSPort : kDefaultWSPort);
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv); nsCOMPtr<nsIDNSService> dns;
dns = mozilla::components::DNS::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIEventTarget> main = GetMainThreadSerialEventTarget(); nsCOMPtr<nsIEventTarget> main = GetMainThreadSerialEventTarget();
nsCOMPtr<nsICancelable> cancelable; nsCOMPtr<nsICancelable> cancelable;
@ -2920,8 +2921,8 @@ nsresult WebSocketChannel::ApplyForAdmission() {
// CONNECTING state per server IP address (not hostname) // CONNECTING state per server IP address (not hostname)
// Check to see if a proxy is being used before making DNS call // Check to see if a proxy is being used before making DNS call
nsCOMPtr<nsIProtocolProxyService> pps = nsCOMPtr<nsIProtocolProxyService> pps;
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID); pps = mozilla::components::ProtocolProxy::Service();
if (!pps) { if (!pps) {
// go straight to DNS // 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)) { if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without socket transport service"); NS_WARNING("unable to continue without socket transport service");
return rv; return rv;
} }
nsCOMPtr<nsIPrefBranch> prefService; nsCOMPtr<nsIPrefBranch> prefService;
prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); prefService = mozilla::components::Preferences::Service();
if (prefService) { if (prefService) {
int32_t intpref; int32_t intpref;
@ -3530,8 +3531,7 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin,
mURI->GetHostPort(mHost); mURI->GetHostPort(mHost);
mRandomGenerator = mRandomGenerator = mozilla::components::RandomGenerator::Service(&rv);
do_GetService("@mozilla.org/security/random-generator;1", &rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without random number generator"); NS_WARNING("unable to continue without random number generator");
return rv; return rv;
@ -3546,7 +3546,7 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIIOService> ioService; nsCOMPtr<nsIIOService> ioService;
ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); ioService = mozilla::components::IO::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without io service"); NS_WARNING("unable to continue without io service");
return rv; return rv;
@ -3926,8 +3926,8 @@ WebSocketChannel::OnStartRequest(nsIRequest* aRequest) {
// NS_ERROR_WEBSOCKET_CONNECTION_REFUSED. // NS_ERROR_WEBSOCKET_CONNECTION_REFUSED.
if (NS_SUCCEEDED(mHttpChannel->GetStatus(&httpStatus))) { if (NS_SUCCEEDED(mHttpChannel->GetStatus(&httpStatus))) {
uint32_t errorClass; uint32_t errorClass;
nsCOMPtr<nsINSSErrorsService> errSvc = nsCOMPtr<nsINSSErrorsService> errSvc;
do_GetService("@mozilla.org/nss_errors_service;1"); errSvc = mozilla::components::NSSErrors::Service();
// If GetErrorClass succeeds httpStatus is TLS related failure. // If GetErrorClass succeeds httpStatus is TLS related failure.
if (errSvc && if (errSvc &&
NS_SUCCEEDED(errSvc->GetErrorClass(httpStatus, &errorClass))) { NS_SUCCEEDED(errSvc->GetErrorClass(httpStatus, &errorClass))) {

Просмотреть файл

@ -9,6 +9,7 @@
#include "WebSocketLog.h" #include "WebSocketLog.h"
#include "mozilla/net/WebSocketConnectionListener.h" #include "mozilla/net/WebSocketConnectionListener.h"
#include "mozilla/Components.h"
#include "nsIOService.h" #include "nsIOService.h"
#include "nsITLSSocketControl.h" #include "nsITLSSocketControl.h"
#include "nsISocketTransport.h" #include "nsISocketTransport.h"
@ -38,7 +39,7 @@ nsresult WebSocketConnection::Init(WebSocketConnectionListener* aListener) {
mListener = aListener; mListener = aListener;
nsresult rv; nsresult rv;
mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); mSocketThread = mozilla::components::SocketTransport::Service(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

Просмотреть файл

@ -10,6 +10,7 @@
#include "WebSocketConnection.h" #include "WebSocketConnection.h"
#include "mozilla/ipc/Endpoint.h" #include "mozilla/ipc/Endpoint.h"
#include "mozilla/net/SocketProcessBackgroundChild.h" #include "mozilla/net/SocketProcessBackgroundChild.h"
#include "mozilla/Components.h"
#include "nsISerializable.h" #include "nsISerializable.h"
#include "nsITLSSocketControl.h" #include "nsITLSSocketControl.h"
#include "nsITransportSecurityInfo.h" #include "nsITransportSecurityInfo.h"
@ -35,7 +36,7 @@ void WebSocketConnectionChild::Init(uint32_t aListenerId) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
nsresult rv; nsresult rv;
mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); mSocketThread = mozilla::components::SocketTransport::Service(&rv);
MOZ_ASSERT(NS_SUCCEEDED(rv)); MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!mSocketThread) { if (!mSocketThread) {
return; return;

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "mozilla/Components.h"
#include "mozilla/RandomNum.h" #include "mozilla/RandomNum.h"
#include "mozilla/StaticMutex.h" #include "mozilla/StaticMutex.h"
#include "mozilla/UniquePtrExtensions.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 // XXX FIX! make this a global we get once
// Find the STS thread // Find the STS thread
nsresult rv; nsresult rv;
mSTS = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); mSTS = mozilla::components::SocketTransport::Service(&rv);
MOZ_ASSERT(NS_SUCCEEDED(rv)); MOZ_ASSERT(NS_SUCCEEDED(rv));
// Open sctp with a callback // Open sctp with a callback
@ -701,8 +702,8 @@ void DataChannelConnection::SetMaxMessageSize(bool aMaxMessageSizeSet,
mMaxMessageSize = aMaxMessageSize; mMaxMessageSize = aMaxMessageSize;
nsresult rv; nsresult rv;
nsCOMPtr<nsIPrefService> prefs = nsCOMPtr<nsIPrefService> prefs;
do_GetService("@mozilla.org/preferences-service;1", &rv); prefs = mozilla::components::Preferences::Service(&rv);
if (!NS_WARN_IF(NS_FAILED(rv))) { if (!NS_WARN_IF(NS_FAILED(rv))) {
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs); nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsIFileProtocolHandler.h" #include "nsIFileProtocolHandler.h"
#include "mozilla/Components.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/net/DNS.h" #include "mozilla/net/DNS.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
@ -127,7 +128,7 @@ class nsSOCKSSocketInfo : public nsIDNSListener {
MOZ_ASSERT(aProxyAddr); MOZ_ASSERT(aProxyAddr);
nsCOMPtr<nsIProtocolHandler> protocolHandler( nsCOMPtr<nsIProtocolHandler> protocolHandler(
do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file", &rv)); mozilla::components::FileProtocolHandler::Service(&rv));
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
} }
@ -408,7 +409,8 @@ PRStatus nsSOCKSSocketInfo::StartDNS(PRFileDesc* fd) {
MOZ_ASSERT(!mDnsRec && mState == SOCKS_INITIAL, MOZ_ASSERT(!mDnsRec && mState == SOCKS_INITIAL,
"Must be in initial state to make DNS Lookup"); "Must be in initial state to make DNS Lookup");
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID); nsCOMPtr<nsIDNSService> dns;
dns = mozilla::components::DNS::Service();
if (!dns) return PR_FAILURE; if (!dns) return PR_FAILURE;
nsCString proxyHost; nsCString proxyHost;

Просмотреть файл

@ -5,6 +5,7 @@
#include "nsIndexedToHTML.h" #include "nsIndexedToHTML.h"
#include "mozilla/Components.h"
#include "mozilla/Encoding.h" #include "mozilla/Encoding.h"
#include "mozilla/intl/AppDateTimeFormat.h" #include "mozilla/intl/AppDateTimeFormat.h"
#include "mozilla/intl/LocaleService.h" #include "mozilla/intl/LocaleService.h"
@ -67,8 +68,8 @@ nsresult nsIndexedToHTML::Init(nsIStreamListener* aListener) {
mListener = aListener; mListener = aListener;
nsCOMPtr<nsIStringBundleService> sbs = nsCOMPtr<nsIStringBundleService> sbs;
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); sbs = mozilla::components::StringBundle::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = sbs->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(mBundle)); 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 // otherwise we end up linking to file:///foo/dirfile
if (!mTextToSubURI) { if (!mTextToSubURI) {
mTextToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); mTextToSubURI = mozilla::components::TextToSubURI::Service(&rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
} }

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsIURI.h" #include "nsIURI.h"
#include "nsHttpHeaderArray.h" #include "nsHttpHeaderArray.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/Components.h"
#include "mozilla/Tokenizer.h" #include "mozilla/Tokenizer.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "mozilla/StaticPrefs_network.h" #include "mozilla/StaticPrefs_network.h"
@ -812,8 +813,8 @@ nsresult nsMultiMixedConv::SendStart() {
nsCOMPtr<nsIStreamListener> partListener(mFinalListener); nsCOMPtr<nsIStreamListener> partListener(mFinalListener);
if (mContentType.IsEmpty()) { if (mContentType.IsEmpty()) {
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE); mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
nsCOMPtr<nsIStreamConverterService> serv = nsCOMPtr<nsIStreamConverterService> serv;
do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv); serv = mozilla::components::StreamConverter::Service(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIStreamListener> converter; nsCOMPtr<nsIStreamListener> converter;
rv = serv->AsyncConvertData(UNKNOWN_CONTENT_TYPE, "*/*", mFinalListener, rv = serv->AsyncConvertData(UNKNOWN_CONTENT_TYPE, "*/*", mFinalListener,

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "mozilla/Components.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
@ -65,7 +66,7 @@ nsresult nsStreamConverterService::BuildGraph() {
nsresult rv; nsresult rv;
nsCOMPtr<nsICategoryManager> catmgr( nsCOMPtr<nsICategoryManager> catmgr(
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); mozilla::components::CategoryManager::Service(&rv));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISimpleEnumerator> entries; nsCOMPtr<nsISimpleEnumerator> entries;

Просмотреть файл

@ -26,6 +26,7 @@
#include "nsCRT.h" #include "nsCRT.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/Components.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/StaticPrefs_network.h" #include "mozilla/StaticPrefs_network.h"
#include "mozilla/SHA1.h" #include "mozilla/SHA1.h"
@ -595,8 +596,8 @@ void nsNetworkLinkService::calculateNetworkIdWithDelay(uint32_t aDelay) {
return; return;
} }
nsCOMPtr<nsIEventTarget> target = nsCOMPtr<nsIEventTarget> target;
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); target = mozilla::components::StreamTransport::Service();
if (!target) { if (!target) {
return; return;
} }
@ -723,8 +724,8 @@ void nsNetworkLinkService::NetworkConfigChanged(SCDynamicStoreRef aStoreREf,
void nsNetworkLinkService::DNSConfigChanged(uint32_t aDelayMs) { void nsNetworkLinkService::DNSConfigChanged(uint32_t aDelayMs) {
LOG(("nsNetworkLinkService::DNSConfigChanged")); LOG(("nsNetworkLinkService::DNSConfigChanged"));
nsCOMPtr<nsIEventTarget> target = nsCOMPtr<nsIEventTarget> target;
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID); target = mozilla::components::StreamTransport::Service();
if (!target) { if (!target) {
return; return;
} }
@ -752,8 +753,8 @@ void nsNetworkLinkService::DNSConfigChanged(uint32_t aDelayMs) {
nsresult nsNetworkLinkService::Init(void) { nsresult nsNetworkLinkService::Init(void) {
nsresult rv; nsresult rv;
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService;
do_GetService("@mozilla.org/observer-service;1", &rv); observerService = mozilla::components::Observer::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = observerService->AddObserver(this, "xpcom-shutdown", false); rv = observerService->AddObserver(this, "xpcom-shutdown", false);

Просмотреть файл

@ -222,8 +222,8 @@ nsresult UrlClassifierCommon::SetBlockedContent(nsIChannel* channel,
// to correct top-level window), we need to do this in the parent process // 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 // instead (find the top-level window in the parent and send an IPC to child
// processes to report console). // processes to report console).
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil;
components::ThirdPartyUtil::Service(); thirdPartyUtil = mozilla::components::ThirdPartyUtil::Service();
if (NS_WARN_IF(!thirdPartyUtil)) { if (NS_WARN_IF(!thirdPartyUtil)) {
return NS_OK; return NS_OK;
} }
@ -366,8 +366,8 @@ nsresult UrlClassifierCommon::CreatePairwiseEntityListURI(nsIChannel* aChannel,
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIScriptSecurityManager> securityManager = nsCOMPtr<nsIScriptSecurityManager> securityManager;
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); securityManager = mozilla::components::ScriptSecurityManager::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> chanPrincipal; nsCOMPtr<nsIPrincipal> chanPrincipal;
rv = securityManager->GetChannelURIPrincipal(aChannel, rv = securityManager->GetChannelURIPrincipal(aChannel,

Просмотреть файл

@ -186,7 +186,7 @@ nsresult nsChannelClassifier::StartInternal() {
} }
nsCOMPtr<nsIURIClassifier> uriClassifier = nsCOMPtr<nsIURIClassifier> uriClassifier =
do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID, &rv); mozilla::components::UrlClassifierDB::Service(&rv);
if (rv == NS_ERROR_FACTORY_NOT_REGISTERED || rv == NS_ERROR_NOT_AVAILABLE) { if (rv == NS_ERROR_FACTORY_NOT_REGISTERED || rv == NS_ERROR_NOT_AVAILABLE) {
// no URI classifier, ignore this failure. // no URI classifier, ignore this failure.
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
@ -194,7 +194,7 @@ nsresult nsChannelClassifier::StartInternal() {
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptSecurityManager> securityManager = nsCOMPtr<nsIScriptSecurityManager> securityManager =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); mozilla::components::ScriptSecurityManager::Service(&rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "mozilla/Components.h"
#include "mozilla/DelayedRunnable.h" #include "mozilla/DelayedRunnable.h"
#include "mozilla/IntegerPrintfMacros.h" #include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/StaticPrefs_network.h" #include "mozilla/StaticPrefs_network.h"
@ -95,8 +96,8 @@ nsWifiMonitor::nsWifiMonitor(UniquePtr<mozilla::WifiScanner>&& aScanner)
} }
nsresult rv; nsresult rv;
nsCOMPtr<nsINetworkLinkService> nls = nsCOMPtr<nsINetworkLinkService> nls;
do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); nls = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && nls) { if (NS_SUCCEEDED(rv) && nls) {
uint32_t linkType = nsINetworkLinkService::LINK_TYPE_UNKNOWN; uint32_t linkType = nsINetworkLinkService::LINK_TYPE_UNKNOWN;
rv = nls->GetLinkType(&linkType); rv = nls->GetLinkType(&linkType);

Просмотреть файл

@ -10,6 +10,7 @@ Headers = [
Classes = [ Classes = [
{ {
'name': 'NSSComponent',
'cid': '{4cb64dfd-ca98-4e24-befd-0d9285a33bcb}', 'cid': '{4cb64dfd-ca98-4e24-befd-0d9285a33bcb}',
'contract_ids': ['@mozilla.org/psm;1'], 'contract_ids': ['@mozilla.org/psm;1'],
'type': 'nsNSSComponent', 'type': 'nsNSSComponent',
@ -17,6 +18,7 @@ Classes = [
'init_method': 'Init', 'init_method': 'Init',
}, },
{ {
'name': 'NSSErrors',
'cid': '{9ef18451-a157-4d17-8132-47afef213689}', 'cid': '{9ef18451-a157-4d17-8132-47afef213689}',
'contract_ids': ['@mozilla.org/nss_errors_service;1'], 'contract_ids': ['@mozilla.org/nss_errors_service;1'],
'type': 'mozilla::psm::NSSErrorsService', 'type': 'mozilla::psm::NSSErrorsService',
@ -54,6 +56,7 @@ Classes = [
'headers': ['nsNSSCertificate.h'], 'headers': ['nsNSSCertificate.h'],
}, },
{ {
'name': 'NSSCertificateDB',
'cid': '{fb0bbc5c-452e-4783-b32c-80124693d871}', 'cid': '{fb0bbc5c-452e-4783-b32c-80124693d871}',
'contract_ids': ['@mozilla.org/security/x509certdb;1'], 'contract_ids': ['@mozilla.org/security/x509certdb;1'],
'type': 'nsNSSCertificateDB', 'type': 'nsNSSCertificateDB',
@ -86,6 +89,7 @@ Classes = [
'init_method': 'Init', 'init_method': 'Init',
}, },
{ {
'name': 'RandomGenerator',
'cid': '{be65e2b7-fe46-4e0f-88e0-4b385db4d68a}', 'cid': '{be65e2b7-fe46-4e0f-88e0-4b385db4d68a}',
'contract_ids': ['@mozilla.org/security/random-generator;1'], 'contract_ids': ['@mozilla.org/security/random-generator;1'],
'type': 'nsRandomGenerator', 'type': 'nsRandomGenerator',
@ -97,6 +101,7 @@ Classes = [
'type': 'mozilla::psm::TransportSecurityInfo', 'type': 'mozilla::psm::TransportSecurityInfo',
}, },
{ {
'name': 'SiteSecurity',
'cid': '{16955eee-6c48-4152-9309-c42a465138a1}', 'cid': '{16955eee-6c48-4152-9309-c42a465138a1}',
'contract_ids': ['@mozilla.org/ssservice;1'], 'contract_ids': ['@mozilla.org/ssservice;1'],
'type': 'nsSiteSecurityService', 'type': 'nsSiteSecurityService',

Просмотреть файл

@ -112,6 +112,7 @@ Classes = [
}, },
{ {
'name': 'PlacesPreviewsHelper',
'cid': '{bd0a4d3b-ff26-4d4d-9a62-a513e1c1bf92}', 'cid': '{bd0a4d3b-ff26-4d4d-9a62-a513e1c1bf92}',
'contract_ids': ['@mozilla.org/places/previews-helper;1'], 'contract_ids': ['@mozilla.org/places/previews-helper;1'],
'esModule': 'resource://gre/modules/PlacesPreviews.sys.mjs', 'esModule': 'resource://gre/modules/PlacesPreviews.sys.mjs',

Просмотреть файл

@ -6,6 +6,7 @@
Classes = [ Classes = [
{ {
'name': 'AuthPromptAdapter',
'cid': '{6e134924-6c3a-4d86-81ac-69432dd971dc}', 'cid': '{6e134924-6c3a-4d86-81ac-69432dd971dc}',
'contract_ids': ['@mozilla.org/network/authprompt-adapter-factory;1'], 'contract_ids': ['@mozilla.org/network/authprompt-adapter-factory;1'],
'esModule': 'resource://gre/modules/Prompter.sys.mjs', 'esModule': 'resource://gre/modules/Prompter.sys.mjs',

Просмотреть файл

@ -6,6 +6,7 @@
Classes = [ Classes = [
{ {
'name': 'PageThumbsStorage',
'cid': '{97943eec-0e48-49ef-b7b7-cf4aa0109bb6}', 'cid': '{97943eec-0e48-49ef-b7b7-cf4aa0109bb6}',
'contract_ids': ['@mozilla.org/thumbnails/pagethumbs-service;1'], 'contract_ids': ['@mozilla.org/thumbnails/pagethumbs-service;1'],
'esModule': 'resource://gre/modules/PageThumbsStorageService.sys.mjs', 'esModule': 'resource://gre/modules/PageThumbsStorageService.sys.mjs',

Просмотреть файл

@ -37,6 +37,7 @@ Classes = [
'headers': ['/dom/webbrowserpersist/nsWebBrowserPersist.h'], 'headers': ['/dom/webbrowserpersist/nsWebBrowserPersist.h'],
}, },
{ {
'name': 'WindowWatcher',
'js_name': 'ww', 'js_name': 'ww',
'cid': '{a21bfa01-f349-4394-a84c-8de5cf0737d0}', 'cid': '{a21bfa01-f349-4394-a84c-8de5cf0737d0}',
'contract_ids': ['@mozilla.org/embedcomp/window-watcher;1'], 'contract_ids': ['@mozilla.org/embedcomp/window-watcher;1'],

Просмотреть файл

@ -42,6 +42,7 @@ Classes = [
'constructor': 'nsChromeRegistry::GetSingleton', 'constructor': 'nsChromeRegistry::GetSingleton',
}, },
{ {
'name': 'Console',
'js_name': 'console', 'js_name': 'console',
'cid': '{7e3ff85c-1dd2-11b2-8d4b-eb452cb0ff40}', 'cid': '{7e3ff85c-1dd2-11b2-8d4b-eb452cb0ff40}',
'contract_ids': ['@mozilla.org/consoleservice;1'], 'contract_ids': ['@mozilla.org/consoleservice;1'],
@ -196,6 +197,7 @@ Classes = [
'headers': ['nsSupportsPrimitives.h'], 'headers': ['nsSupportsPrimitives.h'],
}, },
{ {
'name': 'SystemInfo',
'js_name': 'sysinfo', 'js_name': 'sysinfo',
'cid': '{d962398a-99e5-49b2-857a-c159049c7f6c}', 'cid': '{d962398a-99e5-49b2-857a-c159049c7f6c}',
'contract_ids': ['@mozilla.org/system-info;1'], 'contract_ids': ['@mozilla.org/system-info;1'],

Просмотреть файл

@ -6,6 +6,7 @@
Classes = [ Classes = [
{ {
'name': 'CategoryManager',
'js_name': 'catMan', 'js_name': 'catMan',
'cid': '{16d222a6-1dd2-11b2-b693-f38b02c021b2}', 'cid': '{16d222a6-1dd2-11b2-b693-f38b02c021b2}',
'contract_ids': ['@mozilla.org/categorymanager;1'], 'contract_ids': ['@mozilla.org/categorymanager;1'],