Bug 1565688. Remove unused IOService arg from NS_NewURI. r=mayhemer

Differential Revision: https://phabricator.services.mozilla.com/D37968

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-07-15 13:39:51 +00:00
Родитель 048ab60385
Коммит 5062731c15
30 изменённых файлов: 91 добавлений и 169 удалений

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

@ -1051,8 +1051,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(
uint32_t aFlags) {
nsresult rv;
nsCOMPtr<nsIURI> target;
rv = NS_NewURI(getter_AddRefs(target), aTargetURIStr, nullptr, nullptr,
sIOService);
rv = NS_NewURI(getter_AddRefs(target), aTargetURIStr);
NS_ENSURE_SUCCESS(rv, rv);
rv = CheckLoadURIWithPrincipal(aPrincipal, target, aFlags);
@ -1487,8 +1486,7 @@ void nsScriptSecurityManager::AddSitesToFileURIAllowlist(
// Convert it to a URI and add it to our list.
nsCOMPtr<nsIURI> uri;
nsresult rv =
NS_NewURI(getter_AddRefs(uri), site, nullptr, nullptr, sIOService);
nsresult rv = NS_NewURI(getter_AddRefs(uri), site);
if (NS_SUCCEEDED(rv)) {
mFileURIAllowlist.ref().AppendElement(uri);
} else {

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

@ -44,24 +44,20 @@ void nsChromeRegistryContent::RegisterRemoteChrome(
}
void nsChromeRegistryContent::RegisterPackage(const ChromePackage& aPackage) {
nsCOMPtr<nsIIOService> io(do_GetIOService());
if (!io) return;
nsCOMPtr<nsIURI> content, locale, skin;
if (aPackage.contentBaseURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(content),
aPackage.contentBaseURI.spec, nullptr, nullptr, io);
nsresult rv =
NS_NewURI(getter_AddRefs(content), aPackage.contentBaseURI.spec);
if (NS_FAILED(rv)) return;
}
if (aPackage.localeBaseURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(locale), aPackage.localeBaseURI.spec,
nullptr, nullptr, io);
nsresult rv =
NS_NewURI(getter_AddRefs(locale), aPackage.localeBaseURI.spec);
if (NS_FAILED(rv)) return;
}
if (aPackage.skinBaseURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(skin), aPackage.skinBaseURI.spec,
nullptr, nullptr, io);
nsresult rv = NS_NewURI(getter_AddRefs(skin), aPackage.skinBaseURI.spec);
if (NS_FAILED(rv)) return;
}
@ -89,8 +85,7 @@ void nsChromeRegistryContent::RegisterSubstitution(
nsCOMPtr<nsIURI> resolvedURI;
if (aSubstitution.resolvedURI.spec.Length()) {
rv = NS_NewURI(getter_AddRefs(resolvedURI), aSubstitution.resolvedURI.spec,
nullptr, nullptr, io);
rv = NS_NewURI(getter_AddRefs(resolvedURI), aSubstitution.resolvedURI.spec);
if (NS_FAILED(rv)) return;
}
@ -101,16 +96,12 @@ void nsChromeRegistryContent::RegisterSubstitution(
void nsChromeRegistryContent::RegisterOverride(
const OverrideMapping& aOverride) {
nsCOMPtr<nsIIOService> io(do_GetIOService());
if (!io) return;
nsCOMPtr<nsIURI> chromeURI, overrideURI;
nsresult rv = NS_NewURI(getter_AddRefs(chromeURI), aOverride.originalURI.spec,
nullptr, nullptr, io);
nsresult rv =
NS_NewURI(getter_AddRefs(chromeURI), aOverride.originalURI.spec);
if (NS_FAILED(rv)) return;
rv = NS_NewURI(getter_AddRefs(overrideURI), aOverride.overrideURI.spec,
nullptr, nullptr, io);
rv = NS_NewURI(getter_AddRefs(overrideURI), aOverride.overrideURI.spec);
if (NS_FAILED(rv)) return;
mOverrideTable.Put(chromeURI, overrideURI);

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

@ -251,7 +251,7 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI,
if (ourHandler != extHandler || !PossiblyHostPortUrl(uriString)) {
// Just try to create an URL out of it
rv = NS_NewURI(getter_AddRefs(info->mFixedURI), uriString, nullptr);
rv = NS_NewURI(getter_AddRefs(info->mFixedURI), uriString);
if (!info->mFixedURI && rv != NS_ERROR_MALFORMED_URI) {
return rv;
@ -595,7 +595,7 @@ nsresult nsDefaultURIFixup::FileURIFixup(const nsACString& aStringURI,
nsresult rv = ConvertFileToStringURI(aStringURI, uriSpecOut);
if (NS_SUCCEEDED(rv)) {
// if this is file url, uriSpecOut is already in FS charset
if (NS_SUCCEEDED(NS_NewURI(aURI, uriSpecOut.get(), nullptr))) {
if (NS_SUCCEEDED(NS_NewURI(aURI, uriSpecOut.get()))) {
return NS_OK;
}
}
@ -672,7 +672,7 @@ nsresult nsDefaultURIFixup::FixupURIProtocol(const nsACString& aURIString,
aFixupInfo->mFixupChangedProtocol = true;
} // end if checkprotocol
return NS_NewURI(aURI, uriString, nullptr);
return NS_NewURI(aURI, uriString);
}
bool nsDefaultURIFixup::PossiblyHostPortUrl(const nsACString& aUrl) {

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

@ -2945,9 +2945,9 @@ nsresult nsContentUtils::NewURIWithDocumentCharset(nsIURI** aResult,
nsIURI* aBaseURI) {
if (aDocument) {
return NS_NewURI(aResult, aSpec, aDocument->GetDocumentCharacterSet(),
aBaseURI, sIOService);
aBaseURI);
}
return NS_NewURI(aResult, aSpec, nullptr, aBaseURI, sIOService);
return NS_NewURI(aResult, aSpec, nullptr, aBaseURI);
}
// static

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

@ -1359,8 +1359,7 @@ nsresult nsImageLoadingContent::StringToURI(const nsAString& aSpec,
auto encoding = aDocument->GetDocumentCharacterSet();
// (3) Construct the silly thing
return NS_NewURI(aURI, aSpec, encoding, baseURL,
nsContentUtils::GetIOService());
return NS_NewURI(aURI, aSpec, encoding, baseURL);
}
nsresult nsImageLoadingContent::FireEvent(const nsAString& aEventType,

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

@ -421,7 +421,7 @@ nsresult FetchDriver::HttpFetch(
nsAutoCString url;
mRequest->GetURL(url);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), url, nullptr, nullptr, ios);
rv = NS_NewURI(getter_AddRefs(uri), url);
NS_ENSURE_SUCCESS(rv, rv);
if (StaticPrefs::browser_tabs_remote_useCrossOriginPolicy()) {

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

@ -133,7 +133,7 @@ nsresult FetchUtil::SetRequestReferrer(nsIPrincipal* aPrincipal, Document* aDoc,
// "If request's referrer is a URL, let referrerSource be request's
// referrer."
nsCOMPtr<nsIURI> referrerURI;
rv = NS_NewURI(getter_AddRefs(referrerURI), referrer, nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(referrerURI), referrer);
NS_ENSURE_SUCCESS(rv, rv);
referrerInfo = new ReferrerInfo(referrerURI, policy);
}

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

@ -130,7 +130,7 @@ already_AddRefed<nsIURI> ParseURLFromChrome(const nsAString& aInput,
ErrorResult& aRv) {
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIURI> uri;
aRv = NS_NewURI(getter_AddRefs(uri), aInput, nullptr, nullptr);
aRv = NS_NewURI(getter_AddRefs(uri), aInput);
if (aRv.Failed()) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
}

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

@ -300,7 +300,7 @@ nsresult CheckScope(nsIPrincipal* aPrincipal, const nsACString& aScope) {
MOZ_ASSERT(aPrincipal);
nsCOMPtr<nsIURI> scopeURI;
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -11,7 +11,6 @@
#include "mozilla/dom/URL.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsContentUtils.h"
namespace mozilla {
namespace dom {
@ -79,7 +78,7 @@ bool MerchantValidationEvent::init(
nsresult rv;
nsCOMPtr<nsIURI> validationUri;
rv = NS_NewURI(getter_AddRefs(validationUri), aEventInitDict.mValidationURL,
nullptr, baseURI, nsContentUtils::GetIOService());
nullptr, baseURI);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aEventInitDict.mValidationURL);
return false;

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

@ -195,9 +195,7 @@ void SendReport(ReportDeliver::ReportData& aReportData,
// URL and fragments
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri),
NS_ConvertUTF8toUTF16(aReportData.mEndpointURL), nullptr,
nullptr);
rv = NS_NewURI(getter_AddRefs(uri), aReportData.mEndpointURL);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}

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

@ -373,7 +373,7 @@ class StartResponse final : public Runnable {
// Synthetic response. The buck stops at the worker script.
url = mScriptSpec;
}
rv = NS_NewURI(getter_AddRefs(uri), url, nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(uri), url);
NS_ENSURE_SUCCESS(rv, false);
int16_t decision = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(uri, aLoadInfo, EmptyCString(), &decision);

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

@ -741,15 +741,14 @@ RefPtr<ServiceWorkerRegistrationPromise> ServiceWorkerManager::Register(
const ClientInfo& aClientInfo, const nsACString& aScopeURL,
const nsACString& aScriptURL, ServiceWorkerUpdateViaCache aUpdateViaCache) {
nsCOMPtr<nsIURI> scopeURI;
nsresult rv =
NS_NewURI(getter_AddRefs(scopeURI), aScopeURL, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScopeURL);
if (NS_FAILED(rv)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
CopyableErrorResult(rv), __func__);
}
nsCOMPtr<nsIURI> scriptURI;
rv = NS_NewURI(getter_AddRefs(scriptURI), aScriptURL, nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(scriptURI), aScriptURL);
if (NS_FAILED(rv)) {
return ServiceWorkerRegistrationPromise::CreateAndReject(
CopyableErrorResult(rv), __func__);
@ -851,8 +850,7 @@ class GetRegistrationsRunnable final : public Runnable {
NS_ConvertUTF8toUTF16 scope(data->mOrderedScopes[i]);
nsCOMPtr<nsIURI> scopeURI;
nsresult rv =
NS_NewURI(getter_AddRefs(scopeURI), scope, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), scope);
if (NS_WARN_IF(NS_FAILED(rv))) {
break;
}
@ -914,7 +912,7 @@ class GetRegistrationRunnable final : public Runnable {
}
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), mURL, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), mURL);
if (NS_WARN_IF(NS_FAILED(rv))) {
mPromise->Reject(rv, __func__);
return NS_OK;
@ -1133,8 +1131,7 @@ void ServiceWorkerManager::NoteInheritedController(
NS_ENSURE_TRUE_VOID(principal);
nsCOMPtr<nsIURI> scope;
nsresult rv =
NS_NewURI(getter_AddRefs(scope), aController.Scope(), nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scope), aController.Scope());
NS_ENSURE_SUCCESS_VOID(rv);
RefPtr<ServiceWorkerRegistrationInfo> registration =
@ -1151,7 +1148,7 @@ ServiceWorkerInfo* ServiceWorkerManager::GetActiveWorkerInfoForScope(
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIURI> scopeURI;
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
if (NS_FAILED(rv)) {
return nullptr;
}
@ -1216,7 +1213,7 @@ ServiceWorkerManager::Unregister(nsIPrincipal* aPrincipal,
// a correct URI, so this is wrapped in DEBUG
#ifdef DEBUG
nsCOMPtr<nsIURI> scopeURI;
rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1254,7 +1251,7 @@ nsresult ServiceWorkerManager::NotifyUnregister(nsIPrincipal* aPrincipal,
// a correct URI, so this is wrapped in DEBUG
#ifdef DEBUG
nsCOMPtr<nsIURI> scopeURI;
rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -1500,8 +1497,7 @@ ServiceWorkerManager::GetServiceWorkerRegistrationInfo(
NS_ENSURE_TRUE(principal, nullptr);
nsCOMPtr<nsIURI> uri;
nsresult rv =
NS_NewURI(getter_AddRefs(uri), aClientInfo.URL(), nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), aClientInfo.URL());
NS_ENSURE_SUCCESS(rv, nullptr);
return GetServiceWorkerRegistrationInfo(principal, uri);
@ -1755,8 +1751,7 @@ bool ServiceWorkerManager::StartControlling(
NS_ENSURE_TRUE(principal, false);
nsCOMPtr<nsIURI> scope;
nsresult rv = NS_NewURI(getter_AddRefs(scope), aServiceWorker.Scope(),
nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scope), aServiceWorker.Scope());
NS_ENSURE_SUCCESS(rv, false);
RefPtr<ServiceWorkerRegistrationInfo> registration =
@ -1812,7 +1807,7 @@ ServiceWorkerManager::GetScopeForUrl(nsIPrincipal* aPrincipal,
MOZ_ASSERT(aPrincipal);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUrl, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUrl);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NS_ERROR_FAILURE;
}
@ -2501,7 +2496,7 @@ ServiceWorkerManager::GetRegistrationByPrincipal(
MOZ_ASSERT(aInfo);
nsCOMPtr<nsIURI> scopeURI;
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
@ -2537,7 +2532,7 @@ ServiceWorkerManager::CreateNewRegistration(
#ifdef DEBUG
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIURI> scopeURI;
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
MOZ_ASSERT(NS_SUCCEEDED(rv));
RefPtr<ServiceWorkerRegistrationInfo> tmp =
@ -2655,8 +2650,7 @@ void ServiceWorkerManager::Remove(const nsACString& aHost) {
for (auto it2 = data->mInfos.Iter(); !it2.Done(); it2.Next()) {
ServiceWorkerRegistrationInfo* reg = it2.UserData();
nsCOMPtr<nsIURI> scopeURI;
nsresult rv =
NS_NewURI(getter_AddRefs(scopeURI), it2.Key(), nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), it2.Key());
if (NS_WARN_IF(NS_FAILED(rv))) {
continue;
}

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

@ -1675,8 +1675,7 @@ nsresult ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
Unused << NS_WARN_IF(!IndexedDatabaseManager::GetOrCreate());
WorkerLoadInfo info;
nsresult rv = NS_NewURI(getter_AddRefs(info.mBaseURI), mInfo->ScriptSpec(),
nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(info.mBaseURI), mInfo->ScriptSpec());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;

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

@ -621,7 +621,7 @@ nsresult CompareNetwork::Initialize(nsIPrincipal* aPrincipal,
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -51,8 +51,7 @@ already_AddRefed<URL> URL::Constructor(nsISupports* aParent,
const nsAString& aBase,
ErrorResult& aRv) {
nsCOMPtr<nsIURI> baseUri;
nsresult rv = NS_NewURI(getter_AddRefs(baseUri), aBase, nullptr, nullptr,
nsContentUtils::GetIOService());
nsresult rv = NS_NewURI(getter_AddRefs(baseUri), aBase);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aBase);
return nullptr;
@ -66,8 +65,7 @@ already_AddRefed<URL> URL::Constructor(nsISupports* aParent,
const nsAString& aURL, nsIURI* aBase,
ErrorResult& aRv) {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, aBase,
nsContentUtils::GetIOService());
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, aBase);
if (NS_FAILED(rv)) {
// No need to warn in this case. It's common to use the URL constructor
// to determine if a URL is valid and an exception will be propagated.
@ -158,8 +156,7 @@ void URL::GetHref(nsAString& aHref) const { URL_GETTER(aHref, GetSpec); }
void URL::SetHref(const nsAString& aHref, ErrorResult& aRv) {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aHref, nullptr, nullptr,
nsContentUtils::GetIOService());
nsresult rv = NS_NewURI(getter_AddRefs(uri), aHref);
if (NS_FAILED(rv)) {
aRv.ThrowTypeError<MSG_INVALID_URL>(aHref);
return;

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

@ -1220,8 +1220,7 @@ WebBrowserPersistLocalDocument::WriteContent(
nsAutoCString targetURISpec;
rv = aMap->GetTargetBaseURI(targetURISpec);
if (NS_SUCCEEDED(rv) && !targetURISpec.IsEmpty()) {
rv = NS_NewURI(getter_AddRefs(targetURI), targetURISpec,
/* charset: */ nullptr, /* base: */ nullptr);
rv = NS_NewURI(getter_AddRefs(targetURI), targetURISpec);
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
} else if (mPersistFlags &
nsIWebBrowserPersist::PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION) {

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

@ -1315,8 +1315,7 @@ class ScriptLoaderRunnable final : public nsIRunnable, public nsINamed {
}
if (NS_SUCCEEDED(rv) && IsMainWorkerScript()) {
nsCOMPtr<nsIURI> finalURI;
rv = NS_NewURI(getter_AddRefs(finalURI), loadInfo.mFullURL, nullptr,
nullptr);
rv = NS_NewURI(getter_AddRefs(finalURI), loadInfo.mFullURL);
if (NS_SUCCEEDED(rv)) {
mWorkerPrivate->SetBaseURI(finalURI);
}

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

@ -230,7 +230,7 @@ nsresult nsAutoConfig::downloadAutoConfig() {
nsCOMPtr<nsIURI> url;
nsCOMPtr<nsIChannel> channel;
rv = NS_NewURI(getter_AddRefs(url), mConfigURL.get(), nullptr, nullptr);
rv = NS_NewURI(getter_AddRefs(url), mConfigURL);
if (NS_FAILED(rv)) {
MOZ_LOG(
MCD, LogLevel::Debug,

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

@ -397,7 +397,7 @@ nsresult mozJSSubScriptLoader::DoLoadSubScriptWithOptions(
// Make sure to explicitly create the URI, since we'll need the
// canonicalized spec.
rv = NS_NewURI(getter_AddRefs(uri), asciiUrl.get(), nullptr, serv);
rv = NS_NewURI(getter_AddRefs(uri), asciiUrl);
if (NS_FAILED(rv)) {
ReportError(cx, NS_LITERAL_CSTRING(LOAD_ERROR_NOURI));
return NS_OK;

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

@ -46,7 +46,6 @@
#include "nsStyleUtil.h"
#include "nsTransform2D.h"
#include "nsImageMap.h"
#include "nsIIOService.h"
#include "nsILoadGroup.h"
#include "nsISupportsPriority.h"
#include "nsNetUtil.h"
@ -107,9 +106,6 @@ using mozilla::layout::TextDrawTarget;
// static icon information
StaticRefPtr<nsImageFrame::IconLoad> nsImageFrame::gIconLoad;
// cached IO service for loading icons
nsIIOService* nsImageFrame::sIOService;
// test if the width and height are fixed, looking at the style data
// This is used by nsImageFrame::ShouldCreateImageFrameFor and should
// not be used for layout decisions.
@ -2381,16 +2377,10 @@ nsresult nsImageFrame::GetIntrinsicImageSize(nsSize& aSize) {
nsresult nsImageFrame::LoadIcon(const nsAString& aSpec,
nsPresContext* aPresContext,
imgRequestProxy** aRequest) {
nsresult rv = NS_OK;
MOZ_ASSERT(!aSpec.IsEmpty(), "What happened??");
if (!sIOService) {
rv = CallGetService(NS_IOSERVICE_CONTRACTID, &sIOService);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIURI> realURI;
SpecToURI(aSpec, sIOService, getter_AddRefs(realURI));
SpecToURI(aSpec, getter_AddRefs(realURI));
RefPtr<imgLoader> il =
nsContentUtils::GetImgLoaderForDocument(aPresContext->Document());
@ -2424,16 +2414,14 @@ void nsImageFrame::GetDocumentCharacterSet(nsACString& aCharset) const {
}
}
void nsImageFrame::SpecToURI(const nsAString& aSpec, nsIIOService* aIOService,
nsIURI** aURI) {
void nsImageFrame::SpecToURI(const nsAString& aSpec, nsIURI** aURI) {
nsCOMPtr<nsIURI> baseURI;
if (mContent) {
baseURI = mContent->GetBaseURI();
}
nsAutoCString charset;
GetDocumentCharacterSet(charset);
NS_NewURI(aURI, aSpec, charset.IsEmpty() ? nullptr : charset.get(), baseURI,
aIOService);
NS_NewURI(aURI, aSpec, charset.IsEmpty() ? nullptr : charset.get(), baseURI);
}
void nsImageFrame::GetLoadGroup(nsPresContext* aPresContext,

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

@ -10,7 +10,6 @@
#define nsImageFrame_h___
#include "nsAtomicContainerFrame.h"
#include "nsIIOService.h"
#include "nsIObserver.h"
#include "imgINotificationObserver.h"
@ -131,7 +130,6 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
gIconLoad->Shutdown();
gIconLoad = nullptr;
}
NS_IF_RELEASE(sIOService);
}
virtual nsresult RestartAnimation();
@ -290,8 +288,7 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
private:
// random helpers
inline void SpecToURI(const nsAString& aSpec, nsIIOService* aIOService,
nsIURI** aURI);
inline void SpecToURI(const nsAString& aSpec, nsIURI** aURI);
inline void GetLoadGroup(nsPresContext* aPresContext,
nsILoadGroup** aLoadGroup);
@ -377,8 +374,6 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
bool mReflowCallbackPosted;
bool mForceSyncDecoding;
static nsIIOService* sIOService;
/* loading / broken image icon support */
// XXXbz this should be handled by the prescontext, I think; that

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

@ -540,7 +540,7 @@ void nsLayoutStylesheetCache::BuildPreferenceSheet(
StyleSheet* sheet = *aSheet;
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr);
NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet");
MOZ_ASSERT(uri, "URI creation shouldn't fail");
sheet->SetURIs(uri, uri, uri);

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

@ -108,14 +108,12 @@ static bool sEsniEnabled = false;
// Get the full origin (scheme, host, port) out of a URI (maybe should be part
// of nsIURI instead?)
static nsresult ExtractOrigin(nsIURI* uri, nsIURI** originUri,
nsIIOService* ioService) {
static nsresult ExtractOrigin(nsIURI* uri, nsIURI** originUri) {
nsAutoCString s;
s.Truncate();
nsresult rv = nsContentUtils::GetASCIIOrigin(uri, s);
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewURI(originUri, s, nullptr, nullptr, ioService);
return NS_NewURI(originUri, s);
}
// All URIs we get passed *must* be http or https if they're not null. This
@ -420,14 +418,10 @@ nsresult Predictor::Init() {
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
mIOService = do_GetService("@mozilla.org/network/io-service;1", &rv);
mSpeculativeService = do_GetService("@mozilla.org/network/io-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewURI(getter_AddRefs(mStartupURI), "predictor://startup", nullptr,
mIOService);
NS_ENSURE_SUCCESS(rv, rv);
mSpeculativeService = do_QueryInterface(mIOService, &rv);
rv = NS_NewURI(getter_AddRefs(mStartupURI), "predictor://startup");
NS_ENSURE_SUCCESS(rv, rv);
mDnsService = do_GetService("@mozilla.org/network/dns-service;1", &rv);
@ -762,7 +756,7 @@ Predictor::PredictNative(nsIURI* targetURI, nsIURI* sourceURI,
// Now we do the origin-only (and therefore predictor-only) entry
nsCOMPtr<nsIURI> targetOrigin;
rv = ExtractOrigin(uriKey, getter_AddRefs(targetOrigin), mIOService);
rv = ExtractOrigin(uriKey, getter_AddRefs(targetOrigin));
NS_ENSURE_SUCCESS(rv, rv);
if (!originKey) {
originKey = targetOrigin;
@ -1206,24 +1200,21 @@ void Predictor::SetupPrediction(int32_t confidence, uint32_t flags,
if (prefetchOk) {
nsCOMPtr<nsIURI> prefetchURI;
rv = NS_NewURI(getter_AddRefs(prefetchURI), uri, nullptr, nullptr,
mIOService);
rv = NS_NewURI(getter_AddRefs(prefetchURI), uri);
if (NS_SUCCEEDED(rv)) {
mPrefetches.AppendElement(prefetchURI);
}
} else if (confidence >=
StaticPrefs::network_predictor_preconnect_min_confidence()) {
nsCOMPtr<nsIURI> preconnectURI;
rv = NS_NewURI(getter_AddRefs(preconnectURI), uri, nullptr, nullptr,
mIOService);
rv = NS_NewURI(getter_AddRefs(preconnectURI), uri);
if (NS_SUCCEEDED(rv)) {
mPreconnects.AppendElement(preconnectURI);
}
} else if (confidence >=
StaticPrefs::network_predictor_preresolve_min_confidence()) {
nsCOMPtr<nsIURI> preresolveURI;
rv = NS_NewURI(getter_AddRefs(preresolveURI), uri, nullptr, nullptr,
mIOService);
rv = NS_NewURI(getter_AddRefs(preresolveURI), uri);
if (NS_SUCCEEDED(rv)) {
mPreresolves.AppendElement(preresolveURI);
}
@ -1465,7 +1456,7 @@ Predictor::LearnNative(nsIURI* targetURI, nsIURI* sourceURI,
PREDICTOR_LOG((" load toplevel invalid URI state"));
return NS_ERROR_INVALID_ARG;
}
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin), mIOService);
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin));
NS_ENSURE_SUCCESS(rv, rv);
uriKey = targetURI;
originKey = targetOrigin;
@ -1475,7 +1466,7 @@ Predictor::LearnNative(nsIURI* targetURI, nsIURI* sourceURI,
PREDICTOR_LOG((" startup invalid URI state"));
return NS_ERROR_INVALID_ARG;
}
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin), mIOService);
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin));
NS_ENSURE_SUCCESS(rv, rv);
uriKey = mStartupURI;
originKey = mStartupURI;
@ -1486,9 +1477,9 @@ Predictor::LearnNative(nsIURI* targetURI, nsIURI* sourceURI,
PREDICTOR_LOG((" redirect/subresource invalid URI state"));
return NS_ERROR_INVALID_ARG;
}
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin), mIOService);
rv = ExtractOrigin(targetURI, getter_AddRefs(targetOrigin));
NS_ENSURE_SUCCESS(rv, rv);
rv = ExtractOrigin(sourceURI, getter_AddRefs(sourceOrigin), mIOService);
rv = ExtractOrigin(sourceURI, getter_AddRefs(sourceOrigin));
NS_ENSURE_SUCCESS(rv, rv);
uriKey = sourceURI;
originKey = sourceOrigin;

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

@ -437,7 +437,6 @@ class Predictor final : public nsINetworkPredictor,
nsCOMPtr<nsICacheStorageService> mCacheStorageService;
nsCOMPtr<nsIIOService> mIOService;
nsCOMPtr<nsISpeculativeConnect> mSpeculativeService;
nsCOMPtr<nsIURI> mStartupURI;

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

@ -796,7 +796,7 @@ class AutoIncrement {
nsresult nsIOService::NewURI(const nsACString& aSpec, const char* aCharset,
nsIURI* aBaseURI, nsIURI** result) {
return NS_NewURI(result, aSpec, aCharset, aBaseURI, nullptr);
return NS_NewURI(result, aSpec, aCharset, aBaseURI);
}
NS_IMETHODIMP

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

@ -1625,50 +1625,37 @@ nsresult NS_ReadInputStreamToString(nsIInputStream* aInputStream,
return NS_OK;
}
nsresult NS_NewURI(
nsIURI** result, const nsACString& spec, NotNull<const Encoding*> encoding,
nsIURI* baseURI /* = nullptr */,
nsIIOService*
ioService /* = nullptr */) // pass in nsIIOService to optimize callers
{
nsresult NS_NewURI(nsIURI** result, const nsACString& spec,
NotNull<const Encoding*> encoding,
nsIURI* baseURI /* = nullptr */) {
nsAutoCString charset;
encoding->Name(charset);
return NS_NewURI(result, spec, charset.get(), baseURI, ioService);
return NS_NewURI(result, spec, charset.get(), baseURI);
}
nsresult NS_NewURI(
nsIURI** result, const nsAString& aSpec,
const char* charset /* = nullptr */, nsIURI* baseURI /* = nullptr */,
nsIIOService*
ioService /* = nullptr */) // pass in nsIIOService to optimize callers
{
nsresult NS_NewURI(nsIURI** result, const nsAString& aSpec,
const char* charset /* = nullptr */,
nsIURI* baseURI /* = nullptr */) {
nsAutoCString spec;
if (!AppendUTF16toUTF8(aSpec, spec, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_NewURI(result, spec, charset, baseURI, ioService);
return NS_NewURI(result, spec, charset, baseURI);
}
nsresult NS_NewURI(
nsIURI** result, const nsAString& aSpec, NotNull<const Encoding*> encoding,
nsIURI* baseURI /* = nullptr */,
nsIIOService*
ioService /* = nullptr */) // pass in nsIIOService to optimize callers
{
nsresult NS_NewURI(nsIURI** result, const nsAString& aSpec,
NotNull<const Encoding*> encoding,
nsIURI* baseURI /* = nullptr */) {
nsAutoCString spec;
if (!AppendUTF16toUTF8(aSpec, spec, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_NewURI(result, spec, encoding, baseURI, ioService);
return NS_NewURI(result, spec, encoding, baseURI);
}
nsresult NS_NewURI(
nsIURI** result, const char* spec, nsIURI* baseURI /* = nullptr */,
nsIIOService*
ioService /* = nullptr */) // pass in nsIIOService to optimize callers
{
return NS_NewURI(result, nsDependentCString(spec), nullptr, baseURI,
ioService);
nsresult NS_NewURI(nsIURI** result, const char* spec,
nsIURI* baseURI /* = nullptr */) {
return NS_NewURI(result, nsDependentCString(spec), nullptr, baseURI);
}
static nsresult NewStandardURI(const nsACString& aSpec, const char* aCharset,
@ -1706,8 +1693,7 @@ class TlsAutoIncrement {
nsresult NS_NewURI(nsIURI** aURI, const nsACString& aSpec,
const char* aCharset /* = nullptr */,
nsIURI* aBaseURI /* = nullptr */,
nsIIOService* aIOService /* = nullptr */) {
nsIURI* aBaseURI /* = nullptr */) {
TlsAutoIncrement<decltype(gTlsURLRecursionCount)> inc(gTlsURLRecursionCount);
if (inc.value() >= MAX_RECURSION_COUNT) {
return NS_ERROR_MALFORMED_URI;
@ -1866,7 +1852,7 @@ nsresult NS_NewURI(nsIURI** aURI, const nsACString& aSpec,
}
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
rv = NS_NewMailnewsURI(aURI, aSpec, aCharset, aBaseURI, aIOService);
rv = NS_NewMailnewsURI(aURI, aSpec, aCharset, aBaseURI);
if (rv != NS_ERROR_UNKNOWN_PROTOCOL) {
return rv;
}

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

@ -76,30 +76,21 @@ already_AddRefed<nsINetUtil> do_GetNetUtil(nsresult* error = nullptr);
nsresult net_EnsureIOService(nsIIOService** ios, nsCOMPtr<nsIIOService>& grip);
nsresult NS_NewURI(nsIURI** result, const nsACString& spec,
const char* charset = nullptr, nsIURI* baseURI = nullptr,
nsIIOService* ioService =
nullptr); // pass in nsIIOService to optimize callers
const char* charset = nullptr, nsIURI* baseURI = nullptr);
nsresult NS_NewURI(nsIURI** result, const nsACString& spec,
mozilla::NotNull<const mozilla::Encoding*> encoding,
nsIURI* baseURI = nullptr,
nsIIOService* ioService =
nullptr); // pass in nsIIOService to optimize callers
nsIURI* baseURI = nullptr);
nsresult NS_NewURI(nsIURI** result, const nsAString& spec,
const char* charset = nullptr, nsIURI* baseURI = nullptr,
nsIIOService* ioService =
nullptr); // pass in nsIIOService to optimize callers
const char* charset = nullptr, nsIURI* baseURI = nullptr);
nsresult NS_NewURI(nsIURI** result, const nsAString& spec,
mozilla::NotNull<const mozilla::Encoding*> encoding,
nsIURI* baseURI = nullptr,
nsIIOService* ioService =
nullptr); // pass in nsIIOService to optimize callers
nsIURI* baseURI = nullptr);
nsresult NS_NewURI(nsIURI** result, const char* spec, nsIURI* baseURI = nullptr,
nsIIOService* ioService =
nullptr); // pass in nsIIOService to optimize callers
nsresult NS_NewURI(nsIURI** result, const char* spec,
nsIURI* baseURI = nullptr);
nsresult NS_NewFileURI(
nsIURI** result, nsIFile* spec,

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

@ -217,8 +217,7 @@ OCSPRequest::Run() {
}
nsCOMPtr<nsIURI> uri;
nsresult rv =
NS_NewURI(getter_AddRefs(uri), mAIALocation, nullptr, nullptr, ios);
nsresult rv = NS_NewURI(getter_AddRefs(uri), mAIALocation);
if (NS_FAILED(rv)) {
return NotifyDone(NS_ERROR_MALFORMED_URI, lock);
}

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

@ -373,7 +373,7 @@ bool MatchPattern::MatchesDomain(const nsACString& aDomain) const {
bool MatchPattern::Matches(const nsAString& aURL, bool aExplicit,
ErrorResult& aRv) const {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return false;
@ -511,7 +511,7 @@ already_AddRefed<MatchPatternSet> MatchPatternSet::Constructor(
bool MatchPatternSet::Matches(const nsAString& aURL, bool aExplicit,
ErrorResult& aRv) const {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, nullptr);
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return false;