Bug 1625727 - Only pass ChildLoadInfoForwarderArgs when mRedirectChannelChild implements nsIChannel r=ckerschb,kershaw

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2020-03-31 07:56:11 +00:00
Родитель 038d0f0c06
Коммит c0aef79fdb
4 изменённых файлов: 15 добавлений и 13 удалений

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

@ -2245,16 +2245,15 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult aResult) {
mLoadInfo->GetRequestBlockingReason(&sourceRequestBlockingReason);
}
nsCOMPtr<nsILoadInfo> newChannelLoadInfo = nullptr;
Maybe<ChildLoadInfoForwarderArgs> targetLoadInfoForwarder;
nsCOMPtr<nsIChannel> newChannel = do_QueryInterface(mRedirectChannelChild);
if (newChannel) {
newChannelLoadInfo = newChannel->LoadInfo();
ChildLoadInfoForwarderArgs args;
nsCOMPtr<nsILoadInfo> loadInfo = newChannel->LoadInfo();
LoadInfoToChildLoadInfoForwarder(loadInfo, &args);
targetLoadInfoForwarder.emplace(args);
}
ChildLoadInfoForwarderArgs targetLoadInfoForwarder;
LoadInfoToChildLoadInfoForwarder(newChannelLoadInfo,
&targetLoadInfoForwarder);
if (CanSend())
SendRedirect2Verify(aResult, *headerTuples, sourceRequestBlockingReason,
targetLoadInfoForwarder, loadFlags, referrerInfo,

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

@ -843,7 +843,7 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvSetCacheTokenCachedCharset(
mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
const nsresult& aResult, const RequestHeaderTuples& changedHeaders,
const uint32_t& aSourceRequestBlockingReason,
const ChildLoadInfoForwarderArgs& aTargetLoadInfoForwarder,
const Maybe<ChildLoadInfoForwarderArgs>& aTargetLoadInfoForwarder,
const uint32_t& loadFlags, nsIReferrerInfo* aReferrerInfo,
const Maybe<URIParams>& aAPIRedirectURI,
const Maybe<CorsPreflightArgs>& aCorsPreflightArgs,
@ -927,10 +927,13 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
appCacheChannel->SetChooseApplicationCache(setChooseAppCache);
}
nsCOMPtr<nsILoadInfo> newLoadInfo = newHttpChannel->LoadInfo();
rv = MergeChildLoadInfoForwarder(aTargetLoadInfoForwarder, newLoadInfo);
if (NS_FAILED(rv) && NS_SUCCEEDED(result)) {
result = rv;
if (aTargetLoadInfoForwarder.isSome()) {
nsCOMPtr<nsILoadInfo> newLoadInfo = newHttpChannel->LoadInfo();
rv = MergeChildLoadInfoForwarder(aTargetLoadInfoForwarder.ref(),
newLoadInfo);
if (NS_FAILED(rv) && NS_SUCCEEDED(result)) {
result = rv;
}
}
}
}

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

@ -192,7 +192,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
virtual mozilla::ipc::IPCResult RecvRedirect2Verify(
const nsresult& result, const RequestHeaderTuples& changedHeaders,
const uint32_t& aSourceRequestBlockingReason,
const ChildLoadInfoForwarderArgs& aTargetLoadInfoForwarder,
const Maybe<ChildLoadInfoForwarderArgs>& aTargetLoadInfoForwarder,
const uint32_t& loadFlags, nsIReferrerInfo* aReferrerInfo,
const Maybe<URIParams>& apiRedirectUri,
const Maybe<CorsPreflightArgs>& aCorsPreflightArgs,

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

@ -47,7 +47,7 @@ parent:
// Reports approval/veto of redirect by child process redirect observers
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
uint32_t sourceRequestBlockingReason,
ChildLoadInfoForwarderArgs targetLoadInfoForwarder,
ChildLoadInfoForwarderArgs? targetLoadInfoForwarder,
uint32_t loadFlags, nsIReferrerInfo referrerInfo,
URIParams? apiRedirectTo,
CorsPreflightArgs? corsPreflightArgs,