Bug 1546913 - Remove GetLoadInfo callsites r=ckerschb

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sebastian Streich 2019-04-25 12:16:35 +00:00
Родитель 19d60ce7a3
Коммит a2d3e618af
11 изменённых файлов: 42 добавлений и 81 удалений

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

@ -356,8 +356,7 @@ bool InternalRequest::IsClientRequest() const {
RequestMode InternalRequest::MapChannelToRequestMode(nsIChannel* aChannel) {
MOZ_ASSERT(aChannel);
nsCOMPtr<nsILoadInfo> loadInfo;
MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
nsContentPolicyType contentPolicy = loadInfo->InternalContentPolicyType();
if (IsNavigationContentPolicy(contentPolicy)) {
@ -394,8 +393,7 @@ RequestCredentials InternalRequest::MapChannelToRequestCredentials(
nsIChannel* aChannel) {
MOZ_ASSERT(aChannel);
nsCOMPtr<nsILoadInfo> loadInfo;
MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
uint32_t cookiePolicy = loadInfo->GetCookiePolicy();

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

@ -1248,10 +1248,7 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable,
uint32_t loadFlags;
rv = channel->GetLoadFlags(&loadFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo;
rv = channel->GetLoadInfo(getter_AddRefs(loadInfo));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(loadInfo);
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
mContentPolicyType = loadInfo->InternalContentPolicyType();
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);

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

@ -73,13 +73,10 @@ class PrivateBrowsingChannel : public nsIPrivateBrowsingChannel {
return;
}
nsCOMPtr<nsILoadInfo> loadInfo;
Unused << channel->GetLoadInfo(getter_AddRefs(loadInfo));
if (loadInfo) {
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
OriginAttributes attrs = loadInfo->GetOriginAttributes();
mPrivateBrowsing = attrs.mPrivateBrowsingId > 0;
}
}
bool CanSetCallbacks(nsIInterfaceRequestor* aCallbacks) const {
// Make sure that the private bit override flag is not set.

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

@ -186,8 +186,7 @@ FTPChannelChild::AsyncOpen(nsIStreamListener* aListener) {
openArgs.uploadStream() = autoStream.TakeOptionalValue();
openArgs.loadFlags() = loadFlags;
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
rv = mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &openArgs.loadInfo());
NS_ENSURE_SUCCESS(rv, rv);
@ -811,10 +810,7 @@ void FTPChannelChild::SetupNeckoTarget() {
if (mNeckoTarget) {
return;
}
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
mNeckoTarget =
nsContentUtils::GetEventTargetByLoadInfo(loadInfo, TaskCategory::Network);
if (!mNeckoTarget) {

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

@ -1884,8 +1884,7 @@ static nsresult CreateHTTPProxiedChannel(nsIChannel *channel, nsIProxyInfo *pi,
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsILoadInfo> loadInfo;
channel->GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
return pph->NewProxiedChannel(uri, pi, 0, nullptr, loadInfo, newChannel);
}

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

@ -2545,8 +2545,7 @@ nsresult HttpBaseChannel::AddSecurityMessage(
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
auto innerWindowID = loadInfo->GetInnerWindowID();
@ -3695,11 +3694,10 @@ nsresult HttpBaseChannel::SetupReplacementChannel(nsIURI* newURI,
// Execute the timing allow check to determine whether
// to report the redirect timing info
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
// TYPE_DOCUMENT loads don't have a loadingPrincipal, so we can't set
// AllRedirectsPassTimingAllowCheck on them.
if (loadInfo && loadInfo->GetExternalContentPolicyType() !=
if (loadInfo->GetExternalContentPolicyType() !=
nsIContentPolicy::TYPE_DOCUMENT) {
nsCOMPtr<nsIPrincipal> principal = loadInfo->LoadingPrincipal();
newTimedChannel->SetAllRedirectsPassTimingAllowCheck(

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

@ -1772,9 +1772,8 @@ void HttpChannelChild::BeginNonIPCRedirect(
// redirect, though, we are performing a redirect to communicate the URL of
// the service worker synthetic response itself. This redirect still
// represents the synthetic response, so we must preserve the flag.
if (mLoadInfo && mLoadInfo->GetServiceWorkerTaintingSynthesized()) {
nsCOMPtr<nsILoadInfo> newChannelLoadInfo;
Unused << newChannel->GetLoadInfo(getter_AddRefs(newChannelLoadInfo));
if (mLoadInfo->GetServiceWorkerTaintingSynthesized()) {
nsCOMPtr<nsILoadInfo> newChannelLoadInfo = newChannel->LoadInfo();
if (newChannelLoadInfo) {
newChannelLoadInfo->SynthesizeServiceWorkerTainting(
mLoadInfo->GetTainting());
@ -2276,10 +2275,10 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result) {
appCacheChannel->GetChooseApplicationCache(&chooseAppcache);
}
nsCOMPtr<nsILoadInfo> newChannelLoadInfo;
nsCOMPtr<nsILoadInfo> newChannelLoadInfo = nullptr;
nsCOMPtr<nsIChannel> newChannel = do_QueryInterface(mRedirectChannelChild);
if (newChannel) {
Unused << newChannel->GetLoadInfo(getter_AddRefs(newChannelLoadInfo));
newChannelLoadInfo = newChannel->LoadInfo();
}
ChildLoadInfoForwarderArgs loadInfoForwarder;
@ -2569,8 +2568,7 @@ HttpChannelChild::AsyncOpen(nsIStreamListener* aListener) {
// Assigns an nsIEventTarget to our IPDL actor so that IPC messages are sent to
// the correct DocGroup/TabGroup.
void HttpChannelChild::SetEventTarget() {
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = LoadInfo();
nsCOMPtr<nsIEventTarget> target =
nsContentUtils::GetEventTargetByLoadInfo(loadInfo, TaskCategory::Network);

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

@ -369,12 +369,6 @@ void HttpChannelParent::InvokeAsyncOpen(nsresult rv) {
return;
}
nsCOMPtr<nsILoadInfo> loadInfo;
rv = mChannel->GetLoadInfo(getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) {
AsyncOpenFailed(rv);
return;
}
rv = mChannel->AsyncOpen(mParentListener);
if (NS_FAILED(rv)) {
AsyncOpenFailed(rv);
@ -905,8 +899,7 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
appCacheChannel->SetChooseApplicationCache(aChooseAppcache);
}
nsCOMPtr<nsILoadInfo> newLoadInfo;
Unused << newHttpChannel->GetLoadInfo(getter_AddRefs(newLoadInfo));
nsCOMPtr<nsILoadInfo> newLoadInfo = newHttpChannel->LoadInfo();
rv = MergeChildLoadInfoForwarder(aLoadInfoForwarder, newLoadInfo);
if (NS_FAILED(rv) && NS_SUCCEEDED(result)) {
result = rv;
@ -1435,8 +1428,7 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
int64_t altDataLen = chan->GetAltDataLength();
bool deliveringAltData = chan->IsDeliveringAltData();
nsCOMPtr<nsILoadInfo> loadInfo;
Unused << chan->GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = chan->LoadInfo();
ParentLoadInfoForwarderArgs loadInfoForwarderArg;
mozilla::ipc::LoadInfoToParentLoadInfoForwarder(loadInfo,
@ -1554,14 +1546,10 @@ HttpChannelParent::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
Suspended);
// Only analyze non-local suspended cases, which we are interested in.
nsCOMPtr<nsILoadInfo> loadInfo;
if (NS_SUCCEEDED(mChannel->GetLoadInfo(getter_AddRefs(loadInfo)))) {
nsContentPolicyType type = loadInfo
? loadInfo->InternalContentPolicyType()
: nsIContentPolicy::TYPE_OTHER;
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->LoadInfo();
Telemetry::Accumulate(
Telemetry::NETWORK_BACK_PRESSURE_SUSPENSION_CP_TYPE, type);
}
Telemetry::NETWORK_BACK_PRESSURE_SUSPENSION_CP_TYPE,
loadInfo->InternalContentPolicyType());
}
} else {
if (!mHasSuspendedByBackPressure) {
@ -1940,23 +1928,20 @@ HttpChannelParent::StartRedirect(uint32_t registrarId, nsIChannel* newChannel,
// to the new channel. Normally this would be handled by the child
// ClientChannelHelper, but that is not notified of this redirect since
// we're not propagating it back to the child process.
nsCOMPtr<nsILoadInfo> oldLoadInfo;
Unused << mChannel->GetLoadInfo(getter_AddRefs(oldLoadInfo));
nsCOMPtr<nsILoadInfo> newLoadInfo;
Unused << newChannel->GetLoadInfo(getter_AddRefs(newLoadInfo));
if (oldLoadInfo && newLoadInfo) {
nsCOMPtr<nsILoadInfo> oldLoadInfo = mChannel->LoadInfo();
nsCOMPtr<nsILoadInfo> newLoadInfo = newChannel->LoadInfo();
Maybe<ClientInfo> reservedClientInfo(
oldLoadInfo->GetReservedClientInfo());
if (reservedClientInfo.isSome()) {
newLoadInfo->SetReservedClientInfo(reservedClientInfo.ref());
}
Maybe<ClientInfo> initialClientInfo(
oldLoadInfo->GetInitialClientInfo());
Maybe<ClientInfo> initialClientInfo(oldLoadInfo->GetInitialClientInfo());
if (initialClientInfo.isSome()) {
newLoadInfo->SetInitialClientInfo(initialClientInfo.ref());
}
}
// Re-link the HttpChannelParent to the new InterceptedHttpChannel.
nsCOMPtr<nsIChannel> linkedChannel;
@ -2001,8 +1986,7 @@ HttpChannelParent::StartRedirect(uint32_t registrarId, nsIChannel* newChannel,
NS_ENSURE_SUCCESS(rv, NS_BINDING_ABORTED);
}
nsCOMPtr<nsILoadInfo> loadInfo;
Unused << mChannel->GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->LoadInfo();
ParentLoadInfoForwarderArgs loadInfoForwarderArg;
mozilla::ipc::LoadInfoToParentLoadInfoForwarder(loadInfo,

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

@ -373,13 +373,9 @@ InterceptedChannelContent::GetInternalContentPolicyType(
nsContentPolicyType* aPolicyType) {
NS_ENSURE_ARG(aPolicyType);
nsCOMPtr<nsILoadInfo> loadInfo;
nsresult rv = mChannel->GetLoadInfo(getter_AddRefs(loadInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo = mChannel->LoadInfo();
if (loadInfo) {
*aPolicyType = loadInfo->InternalContentPolicyType();
}
return NS_OK;
}

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

@ -1420,11 +1420,11 @@ NS_IMETHODIMP nsDocLoader::AsyncOnChannelRedirect(
}
nsCOMPtr<nsIURI> newURI;
nsCOMPtr<nsILoadInfo> info;
nsCOMPtr<nsILoadInfo> info = nullptr;
if (delegate) {
// No point in getting the URI if we don't have a LoadURIDelegate.
aNewChannel->GetURI(getter_AddRefs(newURI));
aNewChannel->GetLoadInfo(getter_AddRefs(info));
info = aNewChannel->LoadInfo();
}
RefPtr<Document> loadingDoc;

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

@ -292,9 +292,7 @@ class LoaderListener final : public nsIStreamListener,
NS_ENSURE_SUCCESS(rv, rv);
// Redirected
nsCOMPtr<nsILoadInfo> loadInfo;
rv = channel->GetLoadInfo(getter_AddRefs(loadInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
builder->Redirected(!loadInfo->RedirectChain().IsEmpty());