Backed out 3 changesets (bug 1525640) for causing leaks a=backout

Backed out changeset efdd32c00dc6 (bug 1525640)
Backed out changeset e71641f0465b (bug 1525640)
Backed out changeset e3539a40afdf (bug 1525640)
This commit is contained in:
Coroiu Cristina 2019-04-13 14:57:11 +03:00
parent 8fa5eb9862
commit 8442bbf9c9
23 changed files with 35 additions and 113 deletions

View File

@ -182,10 +182,6 @@ class FakeSocketTransportProvider : public nsISocketTransport {
MOZ_ASSERT(false);
return NS_OK;
}
NS_IMETHOD ResolvedByTRR(bool *aResolvedByTRR) override {
MOZ_ASSERT(false);
return NS_OK;
}
// nsITransport
NS_IMETHOD OpenInputStream(uint32_t aFlags, uint32_t aSegmentSize,

View File

@ -314,9 +314,4 @@ interface nsISocketTransport : nsITransport
* The value is set after PR_Connect is called.
*/
readonly attribute boolean esniUsed;
/**
* IP address resolved using TRR.
*/
bool resolvedByTRR();
};

View File

@ -708,7 +708,6 @@ nsSocketTransport::nsSocketTransport()
mInputClosed(true),
mOutputClosed(true),
mResolving(false),
mResolvedByTRR(false),
mDNSLookupStatus(NS_OK),
mDNSARequestFinished(0),
mEsniQueried(false),
@ -1804,7 +1803,6 @@ bool nsSocketTransport::RecoverFromError() {
// try next ip address only if past the resolver stage...
if (mState == STATE_CONNECTING && mDNSRecord) {
nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
mDNSRecord->IsTRR(&mResolvedByTRR);
if (NS_SUCCEEDED(rv)) {
SOCKET_LOG((" trying again with next ip address\n"));
tryAgain = true;
@ -2098,7 +2096,6 @@ void nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status,
mDNSTxtRequest = nullptr;
if (mDNSRecord) {
mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
mDNSRecord->IsTRR(&mResolvedByTRR);
}
// status contains DNS lookup status
if (NS_FAILED(status)) {
@ -3526,11 +3523,5 @@ nsSocketTransport::GetEsniUsed(bool *aEsniUsed) {
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::ResolvedByTRR(bool *aResolvedByTRR) {
*aResolvedByTRR = mResolvedByTRR;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -328,7 +328,6 @@ class nsSocketTransport final : public nsASocketHandler,
nsCOMPtr<nsICancelable> mDNSRequest;
nsCOMPtr<nsIDNSRecord> mDNSRecord;
bool mResolvedByTRR;
nsresult mDNSLookupStatus;
PRIntervalTime mDNSARequestFinished;

View File

@ -275,7 +275,7 @@ nsresult TRR::SendHTTPRequest() {
// update with each HEADERS or reply to a DATA with a WINDOW UPDATE
rv = internalChannel->SetInitialRwin(127 * 1024);
NS_ENSURE_SUCCESS(rv, rv);
rv = internalChannel->SetIsTRRServiceChannel(true);
rv = internalChannel->SetTrr(true);
NS_ENSURE_SUCCESS(rv, rv);
mAllowRFC1918 = gTRRService->AllowRFC1918();

View File

@ -118,7 +118,6 @@ nsDNSRecord::IsTRR(bool *retval) {
}
return NS_OK;
}
NS_IMETHODIMP
nsDNSRecord::GetNextAddr(uint16_t port, NetAddr *addr) {
if (mDone) {

View File

@ -476,19 +476,10 @@ ClassifierDummyChannel::SetBeConservative(bool aBeConservative) {
}
NS_IMETHODIMP
ClassifierDummyChannel::GetIsTRRServiceChannel(bool* aTrr) {
return NS_ERROR_NOT_IMPLEMENTED;
}
ClassifierDummyChannel::GetTrr(bool* aTrr) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
ClassifierDummyChannel::SetIsTRRServiceChannel(bool aTrr) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
ClassifierDummyChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
return NS_ERROR_NOT_IMPLEMENTED;
}
ClassifierDummyChannel::SetTrr(bool aTrr) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
ClassifierDummyChannel::GetTlsFlags(uint32_t* aTlsFlags) {

View File

@ -416,7 +416,7 @@ uint32_t Http2Session::RegisterStreamID(Http2Stream *stream, uint32_t aNewID) {
// don't count push streams here
MOZ_ASSERT(stream->Transaction(), "no transation for the stream!");
RefPtr<nsHttpConnectionInfo> ci(stream->Transaction()->ConnectionInfo());
if (ci && ci->GetIsTrrServiceChannel()) {
if (ci && ci->GetTrrUsed()) {
IncrementTrrCounter();
}
}

View File

@ -496,7 +496,7 @@ nsresult Http2Stream::ParseHttpRequestHeaders(const char *buf, uint32_t avail,
// if the "mother stream" had TRR, this one is a TRR stream too!
RefPtr<nsHttpConnectionInfo> ci(Transaction()->ConnectionInfo());
if (ci && ci->GetIsTrrServiceChannel()) {
if (ci && ci->GetTrrUsed()) {
mSession->IncrementTrrCounter();
}

View File

@ -196,8 +196,7 @@ HttpBaseChannel::HttpBaseChannel()
mAllowSpdy(true),
mAllowAltSvc(true),
mBeConservative(false),
mIsTRRServiceChannel(false),
mResolvedByTRR(false),
mTRR(false),
mResponseTimeoutEnabled(true),
mAllRedirectsSameOrigin(true),
mAllRedirectsPassTimingAllowCheck(true),
@ -2702,23 +2701,16 @@ HttpBaseChannel::SetBeConservative(bool aBeConservative) {
}
NS_IMETHODIMP
HttpBaseChannel::GetIsTRRServiceChannel(bool* aIsTRRServiceChannel) {
NS_ENSURE_ARG_POINTER(aIsTRRServiceChannel);
HttpBaseChannel::GetTrr(bool* aTRR) {
NS_ENSURE_ARG_POINTER(aTRR);
*aIsTRRServiceChannel = mIsTRRServiceChannel;
*aTRR = mTRR;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::SetIsTRRServiceChannel(bool aIsTRRServiceChannel) {
mIsTRRServiceChannel = aIsTRRServiceChannel;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
NS_ENSURE_ARG_POINTER(aResolvedByTRR);
*aResolvedByTRR = mResolvedByTRR;
HttpBaseChannel::SetTrr(bool aTRR) {
mTRR = aTRR;
return NS_OK;
}
@ -3585,7 +3577,7 @@ nsresult HttpBaseChannel::SetupReplacementChannel(nsIURI* newURI,
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetBeConservative(mBeConservative);
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetIsTRRServiceChannel(mIsTRRServiceChannel);
rv = httpInternal->SetTrr(mTRR);
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetTlsFlags(mTlsFlags);
MOZ_ASSERT(NS_SUCCEEDED(rv));

View File

@ -276,9 +276,8 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD SetAllowAltSvc(bool aAllowAltSvc) override;
NS_IMETHOD GetBeConservative(bool *aBeConservative) override;
NS_IMETHOD SetBeConservative(bool aBeConservative) override;
NS_IMETHOD GetIsTRRServiceChannel(bool *aTRR) override;
NS_IMETHOD SetIsTRRServiceChannel(bool aTRR) override;
NS_IMETHOD GetIsResolvedByTRR(bool *aResolvedByTRR) override;
NS_IMETHOD GetTrr(bool *aTRR) override;
NS_IMETHOD SetTrr(bool aTRR) override;
NS_IMETHOD GetTlsFlags(uint32_t *aTlsFlags) override;
NS_IMETHOD SetTlsFlags(uint32_t aTlsFlags) override;
NS_IMETHOD GetApiRedirectToURI(nsIURI **aApiRedirectToURI) override;
@ -702,12 +701,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
// classification. If this is changed or removed, make sure we also update
// NS_ShouldClassifyChannel accordingly !!!
uint32_t mBeConservative : 1;
// If the current channel is used to as a TRR connection.
uint32_t mIsTRRServiceChannel : 1;
// If the request was performed to a TRR resolved IP address.
// Will be false if loading the resource does not create a connection
// (for example when it's loaded from the cache).
uint32_t mResolvedByTRR : 1;
uint32_t mTRR : 1;
uint32_t mResponseTimeoutEnabled : 1;
// A flag that should be false only if a cross-domain redirect occurred
uint32_t mAllRedirectsSameOrigin : 1;

View File

@ -406,7 +406,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
const NetAddr& aPeerAddr, const uint32_t& aCacheKey,
const nsCString& altDataType, const int64_t& altDataLen,
const bool& deliveringAltData, const bool& aApplyConversion,
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming)
const ResourceTimingStruct& aTiming)
: NeckoTargetChannelEvent<HttpChannelChild>(aChild),
mChannelStatus(aChannelStatus),
mResponseHead(aResponseHead),
@ -427,7 +427,6 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
mAltDataLen(altDataLen),
mDeliveringAltData(deliveringAltData),
mLoadInfoForwarder(loadInfoForwarder),
mIsResolvedByTRR(aIsResolvedByTRR),
mTiming(aTiming) {}
void Run() override {
@ -438,7 +437,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
mCacheFetchCount, mCacheExpirationTime, mCachedCharset,
mSecurityInfoSerialization, mSelfAddr, mPeerAddr, mCacheKey,
mAltDataType, mAltDataLen, mDeliveringAltData, mApplyConversion,
mIsResolvedByTRR, mTiming);
mTiming);
}
private:
@ -461,7 +460,6 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
int64_t mAltDataLen;
bool mDeliveringAltData;
ParentLoadInfoForwarderArgs mLoadInfoForwarder;
bool mIsResolvedByTRR;
ResourceTimingStruct mTiming;
};
@ -476,8 +474,7 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequest(
const NetAddr& peerAddr, const int16_t& redirectCount,
const uint32_t& cacheKey, const nsCString& altDataType,
const int64_t& altDataLen, const bool& deliveringAltData,
const bool& aApplyConversion, const bool& aIsResolvedByTRR,
const ResourceTimingStruct& aTiming) {
const bool& aApplyConversion, const ResourceTimingStruct& aTiming) {
AUTO_PROFILER_LABEL("HttpChannelChild::RecvOnStartRequest", NETWORK);
LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
@ -496,8 +493,7 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequest(
loadInfoForwarder, isFromCache, cacheEntryAvailable, cacheEntryId,
cacheFetchCount, cacheExpirationTime, cachedCharset,
securityInfoSerialization, selfAddr, peerAddr, cacheKey, altDataType,
altDataLen, deliveringAltData, aApplyConversion, aIsResolvedByTRR,
aTiming));
altDataLen, deliveringAltData, aApplyConversion, aTiming));
{
// Child's mEventQ is to control the execution order of the IPC messages
@ -531,7 +527,7 @@ void HttpChannelChild::OnStartRequest(
const NetAddr& peerAddr, const uint32_t& cacheKey,
const nsCString& altDataType, const int64_t& altDataLen,
const bool& deliveringAltData, const bool& aApplyConversion,
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming) {
const ResourceTimingStruct& aTiming) {
LOG(("HttpChannelChild::OnStartRequest [this=%p]\n", this));
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
@ -584,7 +580,6 @@ void HttpChannelChild::OnStartRequest(
mAvailableCachedAltDataType = altDataType;
mDeliveringAltData = deliveringAltData;
mAltDataLength = altDataLen;
mResolvedByTRR = aIsResolvedByTRR;
SetApplyConversion(aApplyConversion);

View File

@ -145,7 +145,7 @@ class HttpChannelChild final : public PHttpChannelChild,
const NetAddr& peerAddr, const int16_t& redirectCount,
const uint32_t& cacheKey, const nsCString& altDataType,
const int64_t& altDataLen, const bool& deliveringAltData,
const bool& aApplyConversion, const bool& aIsResolvedByTRR,
const bool& aApplyConversion,
const ResourceTimingStruct& aTiming) override;
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& status) override;
mozilla::ipc::IPCResult RecvRedirect1Begin(
@ -470,7 +470,7 @@ class HttpChannelChild final : public PHttpChannelChild,
const NetAddr& peerAddr, const uint32_t& cacheKey,
const nsCString& altDataType, const int64_t& altDataLen,
const bool& deliveringAltData, const bool& aApplyConversion,
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming);
const ResourceTimingStruct& aTiming);
void MaybeDivertOnData(const nsCString& data, const uint64_t& offset,
const uint32_t& count);
void OnTransportAndData(const nsresult& channelStatus, const nsresult& status,

View File

@ -1461,9 +1461,6 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
ResourceTimingStruct timing;
GetTimingAttributes(mChannel, timing);
bool isResolvedByTRR = false;
chan->GetIsResolvedByTRR(&isResolvedByTRR);
rv = NS_OK;
if (mIPCClosed ||
!SendOnStartRequest(
@ -1473,7 +1470,7 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
cacheEntryId, fetchCount, expirationTime, cachedCharset,
secInfoSerialization, chan->GetSelfAddr(), chan->GetPeerAddr(),
redirectCount, cacheKey, altDataType, altDataLen, deliveringAltData,
applyConversion, isResolvedByTRR, timing)) {
applyConversion, timing)) {
rv = NS_ERROR_UNEXPECTED;
}
requestHead->Exit();

View File

@ -126,7 +126,6 @@ child:
int64_t altDataLength,
bool deliveringAltData,
bool applyConversion,
bool isResolvedByTRR,
ResourceTimingStruct timing);
// Used to cancel child channel if we hit errors during creating and

View File

@ -1827,14 +1827,6 @@ SocketTransportShim::GetEsniUsed(bool *aEsniUsed) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
SocketTransportShim::ResolvedByTRR(bool *aResolvedByTRR) {
if (mIsWebsocket) {
LOG3(("WARNING: SocketTransportShim::IsTRR %p", this));
}
return NS_ERROR_NOT_IMPLEMENTED;
}
#define FWD_TS_PTR(fx, ts) \
NS_IMETHODIMP \
SocketTransportShim::fx(ts *arg) { return mWrapped->fx(arg); }

View File

@ -617,7 +617,7 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
}
}
if (mIsTRRServiceChannel) {
if (mTRR) {
mCaps |= NS_HTTP_LARGE_KEEPALIVE | NS_HTTP_DISABLE_TRR;
}
@ -632,7 +632,7 @@ nsresult nsHttpChannel::ContinueOnBeforeConnect(bool aShouldUpgrade,
mConnectionInfo->SetBeConservative((mCaps & NS_HTTP_BE_CONSERVATIVE) ||
mBeConservative);
mConnectionInfo->SetTlsFlags(mTlsFlags);
mConnectionInfo->SetIsTrrServiceChannel(mIsTRRServiceChannel);
mConnectionInfo->SetTrrUsed(mTRR);
mConnectionInfo->SetTrrDisabled(mCaps & NS_HTTP_DISABLE_TRR);
mConnectionInfo->SetIPv4Disabled(mCaps & NS_HTTP_DISABLE_IPV4);
mConnectionInfo->SetIPv6Disabled(mCaps & NS_HTTP_DISABLE_IPV6);
@ -4037,7 +4037,7 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(
if (mPostID) {
extension.Append(nsPrintfCString("%d", mPostID));
}
if (mIsTRRServiceChannel) {
if (mTRR) {
extension.Append("TRR");
}
@ -8429,15 +8429,11 @@ nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status,
status == NS_NET_STATUS_WAITING_FOR) {
if (mTransaction) {
mTransaction->GetNetworkAddresses(mSelfAddr, mPeerAddr);
mResolvedByTRR = mTransaction->ResolvedByTRR();
} else {
nsCOMPtr<nsISocketTransport> socketTransport = do_QueryInterface(trans);
if (socketTransport) {
socketTransport->GetSelfAddr(&mSelfAddr);
socketTransport->GetPeerAddr(&mPeerAddr);
bool isTrr = false;
socketTransport->ResolvedByTRR(&isTrr);
mResolvedByTRR = isTrr;
}
}
}

View File

@ -139,7 +139,7 @@ nsHttpConnection::~nsHttpConnection() {
}
MOZ_ASSERT(ci);
if (ci->GetIsTrrServiceChannel()) {
if (ci->GetTrrUsed()) {
Telemetry::Accumulate(Telemetry::DNS_TRR_REQUEST_PER_CONN,
mHttp1xTransactionCount);
}

View File

@ -81,7 +81,7 @@ void nsHttpConnectionInfo::Init(const nsACString &host, int32_t port,
mNPNToken = npnToken;
mOriginAttributes = originAttributes;
mTlsFlags = 0x0;
mIsTrrServiceChannel = false;
mTrrUsed = false;
mTrrDisabled = false;
mIPv4Disabled = false;
mIPv6Disabled = false;
@ -250,7 +250,7 @@ already_AddRefed<nsHttpConnectionInfo> nsHttpConnectionInfo::Clone() const {
clone->SetNoSpdy(GetNoSpdy());
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
clone->SetTrrUsed(GetTrrUsed());
clone->SetTrrDisabled(GetTrrDisabled());
clone->SetIPv4Disabled(GetIPv4Disabled());
clone->SetIPv6Disabled(GetIPv6Disabled());
@ -276,7 +276,7 @@ void nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo **outCI) {
clone->SetNoSpdy(GetNoSpdy());
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
clone->SetIsTrrServiceChannel(GetIsTrrServiceChannel());
clone->SetTrrUsed(GetTrrUsed());
clone->SetTrrDisabled(GetTrrDisabled());
clone->SetIPv4Disabled(GetIPv4Disabled());
clone->SetIPv6Disabled(GetIPv6Disabled());

View File

@ -125,12 +125,9 @@ class nsHttpConnectionInfo final : public ARefBase {
void SetTlsFlags(uint32_t aTlsFlags);
uint32_t GetTlsFlags() const { return mTlsFlags; }
// IsTrrServiceChannel means that this connection is used to send TRR requests
// over
void SetIsTrrServiceChannel(bool aIsTRRChannel) {
mIsTrrServiceChannel = aIsTRRChannel;
}
bool GetIsTrrServiceChannel() const { return mIsTrrServiceChannel; }
// TrrUsed means that this connection is used to send TRR requests over
void SetTrrUsed(bool aUsed) { mTrrUsed = aUsed; }
bool GetTrrUsed() const { return mTrrUsed; }
// SetTrrDisabled means don't use TRR to resolve host names for this
// connection
@ -198,7 +195,7 @@ class nsHttpConnectionInfo final : public ARefBase {
OriginAttributes mOriginAttributes;
uint32_t mTlsFlags;
uint16_t mIsTrrServiceChannel : 1;
uint16_t mTrrUsed : 1;
uint16_t mTrrDisabled : 1;
uint16_t mIPv4Disabled : 1;
uint16_t mIPv6Disabled : 1;

View File

@ -143,7 +143,6 @@ nsHttpTransaction::nsHttpTransaction()
mPassedRatePacing(false),
mSynchronousRatePaceRequest(false),
mClassOfService(0),
mResolvedByTRR(false),
m0RTTInProgress(false),
mDoNotTryEarlyData(false),
mEarlyDataDisposition(EARLY_NONE),
@ -592,7 +591,6 @@ void nsHttpTransaction::OnTransportStatus(nsITransport *transport,
MutexAutoLock lock(mLock);
socketTransport->GetSelfAddr(&mSelfAddr);
socketTransport->GetPeerAddr(&mPeerAddr);
socketTransport->ResolvedByTRR(&mResolvedByTRR);
}
}

View File

@ -464,12 +464,10 @@ class nsHttpTransaction final : public nsAHttpTransaction,
public:
void GetNetworkAddresses(NetAddr &self, NetAddr &peer);
bool ResolvedByTRR() { return mResolvedByTRR; }
private:
NetAddr mSelfAddr;
NetAddr mPeerAddr;
bool mResolvedByTRR;
bool m0RTTInProgress;
bool mDoNotTryEarlyData;

View File

@ -243,14 +243,7 @@ interface nsIHttpChannelInternal : nsISupports
* True if channel is used by the internal trusted recursive resolver
* This flag places data for the request in a cache segment specific to TRR
*/
[noscript, must_use] attribute boolean isTRRServiceChannel;
/**
* If the channel's remote IP was resolved using TRR.
* Is false for resources loaded from the cache or resources that have an
* IP literal host.
*/
[noscript, must_use] readonly attribute boolean isResolvedByTRR;
[noscript, must_use] attribute boolean trr;
/**
* An opaque flags for non-standard behavior of the TLS system.