Bug 1623038 Replace URIParams with nsIURI in PHttpChannel.ipdl r=valentin

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
anjali1903 2020-03-25 19:56:02 +00:00
Родитель 6ebf909eb0
Коммит fc974d51f2
5 изменённых файлов: 28 добавлений и 49 удалений

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

@ -1571,7 +1571,7 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvReportSecurityMessage(
}
mozilla::ipc::IPCResult HttpChannelChild::RecvRedirect1Begin(
const uint32_t& aRegistrarId, const URIParams& aNewUri,
const uint32_t& aRegistrarId, nsIURI* aNewUri,
const uint32_t& aNewLoadFlags, const uint32_t& aRedirectFlags,
const ParentLoadInfoForwarderArgs& aLoadInfoForwarder,
const nsHttpResponseHead& aResponseHead,
@ -1659,7 +1659,7 @@ nsresult HttpChannelChild::SetupRedirect(nsIURI* uri,
}
void HttpChannelChild::Redirect1Begin(
const uint32_t& registrarId, const URIParams& newOriginalURI,
const uint32_t& registrarId, nsIURI* newOriginalURI,
const uint32_t& newLoadFlags, const uint32_t& redirectFlags,
const ParentLoadInfoForwarderArgs& loadInfoForwarder,
const nsHttpResponseHead& responseHead,
@ -1671,14 +1671,12 @@ void HttpChannelChild::Redirect1Begin(
ipc::MergeParentLoadInfoForwarder(loadInfoForwarder, mLoadInfo);
nsCOMPtr<nsIURI> uri = DeserializeURI(newOriginalURI);
ResourceTimingStructArgsToTimingsStruct(timing, mTransactionTimings);
PROFILER_ADD_NETWORK_MARKER(mURI, mPriority, mChannelId,
NetworkLoadType::LOAD_REDIRECT,
mLastStatusReported, TimeStamp::Now(), 0,
kCacheUnknown, mLoadInfo->GetInnerWindowID(),
&mTransactionTimings, uri, std::move(mSource));
PROFILER_ADD_NETWORK_MARKER(
mURI, mPriority, mChannelId, NetworkLoadType::LOAD_REDIRECT,
mLastStatusReported, TimeStamp::Now(), 0, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, newOriginalURI,
std::move(mSource));
if (!securityInfoSerialization.IsEmpty()) {
rv = NS_DeserializeObject(securityInfoSerialization,
@ -1688,7 +1686,7 @@ void HttpChannelChild::Redirect1Begin(
}
nsCOMPtr<nsIChannel> newChannel;
rv = SetupRedirect(uri, &responseHead, redirectFlags,
rv = SetupRedirect(newOriginalURI, &responseHead, redirectFlags,
getter_AddRefs(newChannel));
if (NS_SUCCEEDED(rv)) {
@ -2147,7 +2145,7 @@ NS_IMETHODIMP
HttpChannelChild::OnRedirectVerifyCallback(nsresult aResult) {
LOG(("HttpChannelChild::OnRedirectVerifyCallback [this=%p]\n", this));
MOZ_ASSERT(NS_IsMainThread());
Maybe<URIParams> redirectURI;
nsCOMPtr<nsIURI> redirectURI;
nsresult rv;
nsCOMPtr<nsIHttpChannel> newHttpChannel =
@ -2212,10 +2210,6 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult aResult) {
newHttpChannelChild->GetClientSetCorsPreflightParameters(corsPreflightArgs);
}
/* If the redirect was canceled, bypass OMR and send an empty API
* redirect URI */
SerializeURI(nullptr, redirectURI);
if (NS_SUCCEEDED(aResult)) {
// Note: this is where we would notify "http-on-modify-response" observers.
// We have deliberately disabled this for child processes (see bug 806753)
@ -2227,14 +2221,8 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult aResult) {
nsCOMPtr<nsIHttpChannelInternal> newHttpChannelInternal =
do_QueryInterface(mRedirectChannelChild);
if (newHttpChannelInternal) {
nsCOMPtr<nsIURI> apiRedirectURI;
rv = newHttpChannelInternal->GetApiRedirectToURI(
getter_AddRefs(apiRedirectURI));
if (NS_SUCCEEDED(rv) && apiRedirectURI) {
/* If there was an API redirect of this channel, we need to send it
* up here, since it can't be sent via SendAsyncOpen. */
SerializeURI(apiRedirectURI, redirectURI);
}
Unused << newHttpChannelInternal->GetApiRedirectToURI(
getter_AddRefs(redirectURI));
}
nsCOMPtr<nsIRequest> request = do_QueryInterface(mRedirectChannelChild);
@ -3399,9 +3387,8 @@ void HttpChannelChild::GetClientSetCorsPreflightParameters(
NS_IMETHODIMP
HttpChannelChild::RemoveCorsPreflightCacheEntry(nsIURI* aURI,
nsIPrincipal* aPrincipal) {
URIParams uri;
SerializeURI(aURI, uri);
PrincipalInfo principalInfo;
MOZ_ASSERT(aURI, "aURI should not be null");
nsresult rv = PrincipalToPrincipalInfo(aPrincipal, &principalInfo);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -3410,7 +3397,7 @@ HttpChannelChild::RemoveCorsPreflightCacheEntry(nsIURI* aURI,
// Be careful to not attempt to send a message to the parent after the
// actor has been destroyed.
if (CanSend()) {
result = SendRemoveCorsPreflightCacheEntry(uri, principalInfo);
result = SendRemoveCorsPreflightCacheEntry(aURI, principalInfo);
}
return result ? NS_OK : NS_ERROR_FAILURE;
}

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

@ -160,7 +160,7 @@ class HttpChannelChild final : public PHttpChannelChild,
nsTArray<ConsoleReportCollected>&& aConsoleReports) override;
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& status) override;
mozilla::ipc::IPCResult RecvRedirect1Begin(
const uint32_t& registrarId, const URIParams& newURI,
const uint32_t& registrarId, nsIURI* newOriginalURI,
const uint32_t& newLoadFlags, const uint32_t& redirectFlags,
const ParentLoadInfoForwarderArgs& loadInfoForwarder,
const nsHttpResponseHead& responseHead,
@ -526,7 +526,7 @@ class HttpChannelChild final : public PHttpChannelChild,
void MaybeDivertOnStop(const nsresult& aChannelStatus);
void FailedAsyncOpen(const nsresult& status);
void HandleAsyncAbort();
void Redirect1Begin(const uint32_t& registrarId, const URIParams& newUri,
void Redirect1Begin(const uint32_t& registrarId, nsIURI* newOriginalURI,
const uint32_t& newLoadFlags,
const uint32_t& redirectFlags,
const ParentLoadInfoForwarderArgs& loadInfoForwarder,

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

@ -845,8 +845,7 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
const uint32_t& aSourceRequestBlockingReason,
const Maybe<ChildLoadInfoForwarderArgs>& aTargetLoadInfoForwarder,
const uint32_t& loadFlags, nsIReferrerInfo* aReferrerInfo,
const Maybe<URIParams>& aAPIRedirectURI,
const Maybe<CorsPreflightArgs>& aCorsPreflightArgs,
nsIURI* aAPIRedirectURI, const Maybe<CorsPreflightArgs>& aCorsPreflightArgs,
const bool& aChooseAppcache) {
LOG(("HttpChannelParent::RecvRedirect2Verify [this=%p result=%" PRIx32 "]\n",
this, static_cast<uint32_t>(aResult)));
@ -863,10 +862,8 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
do_QueryInterface(mRedirectChannel);
if (newHttpChannel) {
nsCOMPtr<nsIURI> apiRedirectUri = DeserializeURI(aAPIRedirectURI);
if (apiRedirectUri) {
rv = newHttpChannel->RedirectTo(apiRedirectUri);
if (aAPIRedirectURI) {
rv = newHttpChannel->RedirectTo(aAPIRedirectURI);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
@ -1285,10 +1282,8 @@ void HttpChannelParent::ResponseSynthesized() {
}
mozilla::ipc::IPCResult HttpChannelParent::RecvRemoveCorsPreflightCacheEntry(
const URIParams& uri,
const mozilla::ipc::PrincipalInfo& requestingPrincipal) {
nsCOMPtr<nsIURI> deserializedURI = DeserializeURI(uri);
if (!deserializedURI) {
nsIURI* uri, const mozilla::ipc::PrincipalInfo& requestingPrincipal) {
if (!uri) {
return IPC_FAIL_NO_REASON(this);
}
nsCOMPtr<nsIPrincipal> principal =
@ -1296,7 +1291,7 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvRemoveCorsPreflightCacheEntry(
if (!principal) {
return IPC_FAIL_NO_REASON(this);
}
nsCORSListenerProxy::RemoveFromCorsPreflightCache(deserializedURI, principal);
nsCORSListenerProxy::RemoveFromCorsPreflightCache(uri, principal);
return IPC_OK();
}
@ -2064,9 +2059,6 @@ HttpChannelParent::StartRedirect(nsIChannel* newChannel, uint32_t redirectFlags,
nsCOMPtr<nsIURI> newOriginalURI;
newChannel->GetOriginalURI(getter_AddRefs(newOriginalURI));
URIParams uriParams;
SerializeURI(newOriginalURI, uriParams);
uint32_t newLoadFlags = nsIRequest::LOAD_NORMAL;
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadFlags(&newLoadFlags));
@ -2105,7 +2097,7 @@ HttpChannelParent::StartRedirect(nsIChannel* newChannel, uint32_t redirectFlags,
bool result = false;
if (!mIPCClosed) {
result = SendRedirect1Begin(
mRedirectChannelId, uriParams, newLoadFlags, redirectFlags,
mRedirectChannelId, newOriginalURI, newLoadFlags, redirectFlags,
loadInfoForwarderArg, *responseHead, secInfoSerialization, channelId,
mChannel->GetPeerAddr(), GetTimingAttributes(mChannel));
}

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

@ -194,7 +194,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
const uint32_t& aSourceRequestBlockingReason,
const Maybe<ChildLoadInfoForwarderArgs>& aTargetLoadInfoForwarder,
const uint32_t& loadFlags, nsIReferrerInfo* aReferrerInfo,
const Maybe<URIParams>& apiRedirectUri,
nsIURI* apiRedirectUri,
const Maybe<CorsPreflightArgs>& aCorsPreflightArgs,
const bool& aChooseAppcache) override;
virtual mozilla::ipc::IPCResult RecvDocumentChannelCleanup(
@ -207,7 +207,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
const nsresult& statusCode) override;
virtual mozilla::ipc::IPCResult RecvDivertComplete() override;
virtual mozilla::ipc::IPCResult RecvRemoveCorsPreflightCacheEntry(
const URIParams& uri,
nsIURI* uri,
const mozilla::ipc::PrincipalInfo& requestingPrincipal) override;
virtual mozilla::ipc::IPCResult RecvBytesRead(const int32_t& aCount) override;
virtual mozilla::ipc::IPCResult RecvOpenOriginalCacheInputStream() override;

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

@ -8,7 +8,6 @@
include protocol PNecko;
include protocol PStreamFilter;
include InputStreamParams;
include URIParams;
include PBackgroundSharedTypes;
include NeckoChannelParams;
include IPCServiceWorkerDescriptor;
@ -20,6 +19,7 @@ include "mozilla/net/NeckoMessageUtils.h";
using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
using refcounted class nsIReferrerInfo from "mozilla/dom/ReferrerInfoUtils.h";
using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
using nsIHttpChannel::FlashPluginState from "mozilla/net/NeckoMessageUtils.h";
using nsILoadInfo::CrossOriginOpenerPolicy from "nsILoadInfo.h";
@ -49,7 +49,7 @@ parent:
uint32_t sourceRequestBlockingReason,
ChildLoadInfoForwarderArgs? targetLoadInfoForwarder,
uint32_t loadFlags, nsIReferrerInfo referrerInfo,
URIParams? apiRedirectTo,
nsIURI apiRedirectTo,
CorsPreflightArgs? corsPreflightArgs,
bool chooseAppcache);
@ -86,7 +86,7 @@ parent:
// Child has detected a CORS check failure, so needs to tell the parent
// to remove any matching entry from the CORS preflight cache.
async RemoveCorsPreflightCacheEntry(URIParams uri,
async RemoveCorsPreflightCacheEntry(nsIURI uri,
PrincipalInfo requestingPrincipal);
// After receiving this message, the parent calls SendDeleteSelf, and makes
@ -161,7 +161,7 @@ child:
// Called to initiate content channel redirect, starts talking to sinks
// on the content process and reports result via Redirect2Verify above
async Redirect1Begin(uint32_t registrarId,
URIParams newOriginalUri,
nsIURI newOriginalUri,
uint32_t newLoadFlags,
uint32_t redirectFlags,
ParentLoadInfoForwarderArgs loadInfoForwarder,