diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index a76b06044f06..7077794c394a 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -4030,6 +4030,7 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) mFastOpenInProgress = false; mConnectionNegotiatingFastOpen = nullptr; } + MOZ_DIAGNOSTIC_ASSERT(mEnt); nsresult rv = SetupConn(out, false); if (mEnt) { mEnt->mDoNotDestroy = false; @@ -4043,6 +4044,8 @@ nsHalfOpenSocket::FastOpenEnabled() { LOG(("nsHalfOpenSocket::FastOpenEnabled [this=%p]\n", this)); + MOZ_DIAGNOSTIC_ASSERT(mEnt); + if (!mEnt) { return false; } @@ -4534,6 +4537,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans, { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); + MOZ_DIAGNOSTIC_ASSERT(mEnt); if (mTransaction) { RefPtr info = FindTransactionHelper(false); if ((trans == mSocketTransport) || diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index 7a1feee8df35..4feca8af02b7 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -244,9 +244,10 @@ private: // contains list of active and idle connections as well as the list of // pending transactions. // - class nsConnectionEntry + class nsConnectionEntry : public SupportsWeakPtr { public: + MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsConnectionEntry) explicit nsConnectionEntry(nsHttpConnectionInfo *ci); ~nsConnectionEntry(); @@ -415,7 +416,7 @@ private: already_AddRefed FindTransactionHelper(bool removeWhenFound); - nsConnectionEntry *mEnt; + WeakPtr mEnt; RefPtr mTransaction; bool mDispatchedMTransaction; nsCOMPtr mSocketTransport;