From d15b5eb695229118e090ca7251ee83cf55e8d338 Mon Sep 17 00:00:00 2001 From: sunil mayya Date: Fri, 15 Sep 2023 10:18:02 +0000 Subject: [PATCH] Bug 1853025 - send Caps parameter in PHttpTransaction::OnStartRequest message instead of PHttpTransaction::OnStopRequest message. r=necko-reviewers,kershaw Differential Revision: https://phabricator.services.mozilla.com/D188114 --- .../protocol/http/HttpTransactionChild.cpp | 4 ++-- .../protocol/http/HttpTransactionParent.cpp | 22 +++++++++---------- netwerk/protocol/http/HttpTransactionParent.h | 10 +++++---- netwerk/protocol/http/PHttpTransaction.ipdl | 4 ++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/netwerk/protocol/http/HttpTransactionChild.cpp b/netwerk/protocol/http/HttpTransactionChild.cpp index 69ec175f6771..9e7a5999bbd2 100644 --- a/netwerk/protocol/http/HttpTransactionChild.cpp +++ b/netwerk/protocol/http/HttpTransactionChild.cpp @@ -485,7 +485,7 @@ HttpTransactionChild::OnStartRequest(nsIRequest* aRequest) { ToTimingStructArgs(mTransaction->Timings()), proxyConnectResponseCode, dataForSniffer, optionalAltSvcUsed, !!mDataBridgeParent, mTransaction->TakeRestartedState(), mTransaction->HTTPSSVCReceivedStage(), - mTransaction->GetSupportsHTTP3(), mode, reason); + mTransaction->GetSupportsHTTP3(), mode, reason, mTransaction->Caps()); return NS_OK; } @@ -565,7 +565,7 @@ HttpTransactionChild::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) { mTransaction->GetTransferSize(), ToTimingStructArgs(mTransaction->Timings()), responseTrailers, mTransactionObserverResult, - lastActTabOpt, mTransaction->Caps(), infoArgs); + lastActTabOpt, infoArgs); return NS_OK; } diff --git a/netwerk/protocol/http/HttpTransactionParent.cpp b/netwerk/protocol/http/HttpTransactionParent.cpp index 13d356862467..e8a38e3439a6 100644 --- a/netwerk/protocol/http/HttpTransactionParent.cpp +++ b/netwerk/protocol/http/HttpTransactionParent.cpp @@ -413,7 +413,8 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStartRequest( nsTArray&& aDataForSniffer, const Maybe& aAltSvcUsed, const bool& aDataToChildProcess, const bool& aRestarted, const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3, - const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aTrrSkipReason) { + const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aTrrSkipReason, + const uint32_t& aCaps) { mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent( this, [self = UnsafePtr(this), aStatus, aResponseHead, @@ -421,12 +422,12 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStartRequest( aProxyConnectResponseCode, aDataForSniffer = CopyableTArray{std::move(aDataForSniffer)}, aAltSvcUsed, aDataToChildProcess, aRestarted, aHTTPSSVCReceivedStage, - aSupportsHttp3, aMode, aTrrSkipReason]() mutable { + aSupportsHttp3, aMode, aTrrSkipReason, aCaps]() mutable { self->DoOnStartRequest( aStatus, aResponseHead, securityInfo, aProxyConnectFailed, aTimings, aProxyConnectResponseCode, std::move(aDataForSniffer), aAltSvcUsed, aDataToChildProcess, aRestarted, aHTTPSSVCReceivedStage, - aSupportsHttp3, aMode, aTrrSkipReason); + aSupportsHttp3, aMode, aTrrSkipReason, aCaps); })); return IPC_OK(); } @@ -457,7 +458,8 @@ void HttpTransactionParent::DoOnStartRequest( nsTArray&& aDataForSniffer, const Maybe& aAltSvcUsed, const bool& aDataToChildProcess, const bool& aRestarted, const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3, - const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason) { + const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason, + const uint32_t& aCaps) { LOG(("HttpTransactionParent::DoOnStartRequest [this=%p aStatus=%" PRIx32 "]\n", this, static_cast(aStatus))); @@ -474,7 +476,7 @@ void HttpTransactionParent::DoOnStartRequest( mSupportsHTTP3 = aSupportsHttp3; mEffectiveTRRMode = aMode; mTRRSkipReason = aSkipReason; - + mCaps = aCaps; mSecurityInfo = aSecurityInfo; if (aResponseHead.isSome()) { @@ -594,7 +596,7 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStopRequest( const int64_t& aTransferSize, const TimingStructArgs& aTimings, const Maybe& aResponseTrailers, Maybe&& aTransactionObserverResult, - const TimeStamp& aLastActiveTabOptHit, const uint32_t& aCaps, + const TimeStamp& aLastActiveTabOptHit, const HttpConnectionInfoCloneArgs& aArgs) { LOG(("HttpTransactionParent::RecvOnStopRequest [this=%p status=%" PRIx32 "]\n", @@ -611,11 +613,10 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStopRequest( this, [self = UnsafePtr(this), aStatus, aResponseIsComplete, aTransferSize, aTimings, aResponseTrailers, aTransactionObserverResult{std::move(aTransactionObserverResult)}, - aCaps, cinfo{std::move(cinfo)}]() mutable { + cinfo{std::move(cinfo)}]() mutable { self->DoOnStopRequest(aStatus, aResponseIsComplete, aTransferSize, aTimings, aResponseTrailers, - std::move(aTransactionObserverResult), aCaps, - cinfo); + std::move(aTransactionObserverResult), cinfo); })); return IPC_OK(); } @@ -625,7 +626,7 @@ void HttpTransactionParent::DoOnStopRequest( const int64_t& aTransferSize, const TimingStructArgs& aTimings, const Maybe& aResponseTrailers, Maybe&& aTransactionObserverResult, - const uint32_t& aCaps, nsHttpConnectionInfo* aConnInfo) { + nsHttpConnectionInfo* aConnInfo) { LOG(("HttpTransactionParent::DoOnStopRequest [this=%p]\n", this)); if (mCanceled) { return; @@ -645,7 +646,6 @@ void HttpTransactionParent::DoOnStopRequest( if (aResponseTrailers.isSome()) { mResponseTrailers = MakeUnique(aResponseTrailers.ref()); } - mCaps = aCaps; mConnInfo = aConnInfo; if (aTransactionObserverResult.isSome()) { TransactionObserverFunc obs = nullptr; diff --git a/netwerk/protocol/http/HttpTransactionParent.h b/netwerk/protocol/http/HttpTransactionParent.h index 2707075a2406..626cc0ec169a 100644 --- a/netwerk/protocol/http/HttpTransactionParent.h +++ b/netwerk/protocol/http/HttpTransactionParent.h @@ -55,7 +55,8 @@ class HttpTransactionParent final : public PHttpTransactionParent, nsTArray&& aDataForSniffer, const Maybe& aAltSvcUsed, const bool& aDataToChildProcess, const bool& aRestarted, const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3, - const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason); + const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason, + const uint32_t& aCaps); mozilla::ipc::IPCResult RecvOnTransportStatus( const nsresult& aStatus, const int64_t& aProgress, const int64_t& aProgressMax, @@ -68,7 +69,7 @@ class HttpTransactionParent final : public PHttpTransactionParent, const int64_t& aTransferSize, const TimingStructArgs& aTimings, const Maybe& responseTrailers, Maybe&& aTransactionObserverResult, - const TimeStamp& aLastActiveTabOptHit, const uint32_t& aCaps, + const TimeStamp& aLastActiveTabOptHit, const HttpConnectionInfoCloneArgs& aArgs); mozilla::ipc::IPCResult RecvOnInitFailed(const nsresult& aStatus); @@ -105,7 +106,8 @@ class HttpTransactionParent final : public PHttpTransactionParent, nsTArray&& aDataForSniffer, const Maybe& aAltSvcUsed, const bool& aDataToChildProcess, const bool& aRestarted, const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3, - const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason); + const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason, + const uint32_t& aCaps); void DoOnDataAvailable(const nsCString& aData, const uint64_t& aOffset, const uint32_t& aCount); void DoOnStopRequest( @@ -113,7 +115,7 @@ class HttpTransactionParent final : public PHttpTransactionParent, const int64_t& aTransferSize, const TimingStructArgs& aTimings, const Maybe& responseTrailers, Maybe&& aTransactionObserverResult, - const uint32_t& aCaps, nsHttpConnectionInfo* aConnInfo); + nsHttpConnectionInfo* aConnInfo); void DoNotifyListener(); void ContinueDoNotifyListener(); // Get event target for ODA. diff --git a/netwerk/protocol/http/PHttpTransaction.ipdl b/netwerk/protocol/http/PHttpTransaction.ipdl index bb39f7dd19a7..000c390a657a 100644 --- a/netwerk/protocol/http/PHttpTransaction.ipdl +++ b/netwerk/protocol/http/PHttpTransaction.ipdl @@ -58,7 +58,8 @@ parent: uint32_t HTTPSSVCReceivedStage, bool supportsHttp3, TRRMode trrMode, - TRRSkippedReason trrSkipReason); + TRRSkippedReason trrSkipReason, + uint32_t caps); async OnTransportStatus(nsresult status, int64_t progress, int64_t progressMax, @@ -73,7 +74,6 @@ parent: nsHttpHeaderArray? responseTrailers, TransactionObserverResult? transactionObserverResult, TimeStamp lastActiveTabOptimization, - uint32_t caps, HttpConnectionInfoCloneArgs connInfoArgs); async OnInitFailed(nsresult status); async OnH2PushStream(uint32_t pushedStreamId,