Bug 1382555 - Remove diagnostic asserts.r=mcmanus
authorDragana Damjanovic <dd.mozilla@gmail.com>
Mon, 31 Jul 2017 19:20:08 +0200
changeset 420834 2bb82c799d1a6cca273d59401eb06842b9ed0ea1
parent 420796 a431c842cc50cfd446af8d48593bfda68a9e127f
child 420835 4446ecfee3d7530ae423be58cd0c34f054564d8a
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1382555
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382555 - Remove diagnostic asserts.r=mcmanus
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -139,17 +139,17 @@ nsHttpConnection::Init(nsHttpConnectionI
                        PRIntervalTime rtt)
 {
     LOG(("nsHttpConnection::Init this=%p", this));
     NS_ENSURE_ARG_POINTER(info);
     NS_ENSURE_TRUE(!mConnInfo, NS_ERROR_ALREADY_INITIALIZED);
 
     mConnectedTransport = connectedTransport;
     mConnInfo = info;
-    MOZ_DIAGNOSTIC_ASSERT(mConnInfo);
+    MOZ_ASSERT(mConnInfo);
     mLastWriteTime = mLastReadTime = PR_IntervalNow();
     mRtt = rtt;
     mMaxHangTime = PR_SecondsToInterval(maxHangTime);
 
     mSocketTransport = transport;
     mSocketIn = instream;
     mSocketOut = outstream;
 
@@ -310,17 +310,17 @@ nsHttpConnection::StartSpdy(uint8_t spdy
     bool spdyProxy = mConnInfo->UsingHttpsProxy() && !mTLSFilter;
     if (spdyProxy) {
         RefPtr<nsHttpConnectionInfo> wildCardProxyCi;
         rv = mConnInfo->CreateWildCard(getter_AddRefs(wildCardProxyCi));
         MOZ_ASSERT(NS_SUCCEEDED(rv));
         gHttpHandler->ConnMgr()->MoveToWildCardConnEntry(mConnInfo,
                                                          wildCardProxyCi, this);
         mConnInfo = wildCardProxyCi;
-        MOZ_DIAGNOSTIC_ASSERT(mConnInfo);
+        MOZ_ASSERT(mConnInfo);
     }
 
     if (!mDid0RTTSpdy) {
         rv = MoveTransactionsToSpdy(status, list);
         if (NS_FAILED(rv)) {
             return;
         }
     }
@@ -1936,17 +1936,17 @@ nsHttpConnection::SetupSecondaryTLS()
 
     nsHttpConnectionInfo *ci = nullptr;
     if (mTransaction) {
         ci = mTransaction->ConnectionInfo();
     }
     if (!ci) {
         ci = mConnInfo;
     }
-    MOZ_DIAGNOSTIC_ASSERT(ci);
+    MOZ_ASSERT(ci);
 
     mTLSFilter = new TLSFilterTransaction(mTransaction,
                                           ci->Origin(), ci->OriginPort(), this, this);
 
     if (mTransaction) {
         mTransaction = mTLSFilter;
     }
 }
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -614,17 +614,16 @@ nsHttpConnectionMgr::ClearConnectionHist
         RefPtr<nsConnectionEntry> ent = iter.Data();
         if (ent->mIdleConns.Length()    == 0 &&
             ent->mActiveConns.Length()  == 0 &&
             ent->mHalfOpens.Length()    == 0 &&
             ent->mUrgentStartQ.Length() == 0 &&
             ent->PendingQLength()       == 0 &&
             ent->mHalfOpenFastOpenBackups.Length() == 0 &&
             !ent->mDoNotDestroy) {
-            ent->mHowItWasRemoved = nsConnectionEntry::CONN_ENTRY_CLEAR_CONNECTION_HISTORY;
             iter.Remove();
         }
     }
 
     return NS_OK;
 }
 
 nsresult
@@ -783,19 +782,18 @@ nsHttpConnectionMgr::FindCoalescableConn
 
 void
 nsHttpConnectionMgr::UpdateCoalescingForNewConn(nsHttpConnection *newConn,
                                                 nsConnectionEntry *ent)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
     MOZ_ASSERT(newConn);
     MOZ_ASSERT(newConn->ConnectionInfo());
-    MOZ_DIAGNOSTIC_ASSERT(ent);
+    MOZ_ASSERT(ent);
     MOZ_ASSERT(mCT.GetWeak(newConn->ConnectionInfo()->HashKey()) == ent);
-    CheckConnEntryMustBeInmCT(ent);
 
     nsHttpConnection *existingConn = FindCoalescableConnection(ent, true);
     if (existingConn) {
         LOG(("UpdateCoalescingForNewConn() found existing active conn that could have served newConn "
              "graceful close of newConn=%p to migrate to existingConn %p\n", newConn, existingConn));
         newConn->DontReuse();
         return;
     }
@@ -822,21 +820,16 @@ nsHttpConnectionMgr::UpdateCoalescingFor
 
     // Cancel any other pending connections - their associated transactions
     // are in the pending queue and will be dispatched onto this new connection
     for (int32_t index = ent->mHalfOpens.Length() - 1; index >= 0; --index) {
         RefPtr<nsHalfOpenSocket> half = ent->mHalfOpens[index];
         LOG(("UpdateCoalescingForNewConn() forcing halfopen abandon %p\n",
              half.get()));
         ent->mHalfOpens[index]->Abandon();
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupTransport);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamOut);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamIn);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mSynTimer);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mEnt);
     }
 
     if (ent->mActiveConns.Length() > 1) {
         // this is a new connection that can be coalesced onto. hooray!
         // if there are other connection to this entry (e.g.
         // some could still be handshaking, shutting down, etc..) then close
         // them down after any transactions that are on them are complete.
         // This probably happened due to the parallel connection algorithm
@@ -852,21 +845,16 @@ nsHttpConnectionMgr::UpdateCoalescingFor
     }
 
     for (int32_t index = ent->mHalfOpenFastOpenBackups.Length() - 1; index >= 0; --index) {
         LOG(("UpdateCoalescingForNewConn() shutting down connection in fast "
              "open state (%p) because new spdy connection (%p) takes "
              "precedence\n", ent->mHalfOpenFastOpenBackups[index].get(), newConn));
         RefPtr<nsHalfOpenSocket> half = ent->mHalfOpenFastOpenBackups[index];
         half->CancelFastOpenConnection();
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupTransport);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamOut);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamIn);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mSynTimer);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mEnt);
     }
 }
 
 // This function lets a connection, after completing the NPN phase,
 // report whether or not it is using spdy through the usingSpdy
 // argument. It would not be necessary if NPN were driven out of
 // the connection manager. The connection entry associated with the
 // connection is then updated to indicate whether or not we want to use
@@ -1248,35 +1236,31 @@ nsHttpConnectionMgr::AtActiveConnectionL
     bool result = (totalCount >= maxPersistConns);
     LOG(("AtActiveConnectionLimit result: %s", result ? "true" : "false"));
     return result;
 }
 
 void
 nsHttpConnectionMgr::ClosePersistentConnections(nsConnectionEntry *ent)
 {
-    CheckConnEntryMustBeInmCT(ent);
     LOG(("nsHttpConnectionMgr::ClosePersistentConnections [ci=%s]\n",
          ent->mConnInfo->HashKey().get()));
     while (ent->mIdleConns.Length()) {
         RefPtr<nsHttpConnection> conn(ent->mIdleConns[0]);
         ent->mIdleConns.RemoveElementAt(0);
         mNumIdleConns--;
         conn->Close(NS_ERROR_ABORT);
     }
 
     int32_t activeCount = ent->mActiveConns.Length();
     for (int32_t i=0; i < activeCount; i++)
         ent->mActiveConns[i]->DontReuse();
     for (int32_t index = ent->mHalfOpenFastOpenBackups.Length() - 1; index >= 0; --index) {
         RefPtr<nsHalfOpenSocket> half = ent->mHalfOpenFastOpenBackups[index];
         half->CancelFastOpenConnection();
-        MOZ_DIAGNOSTIC_ASSERT(!half->mBackupTransport);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mSynTimer);
-        MOZ_DIAGNOSTIC_ASSERT(!half->mEnt);
     }
 }
 
 bool
 nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
@@ -1657,17 +1641,16 @@ nsHttpConnectionMgr::TryDispatchTransact
     return NS_ERROR_NOT_AVAILABLE;                /* queue it */
 }
 
 nsresult
 nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
                                          nsHttpTransaction *trans,
                                          nsHttpConnection *conn)
 {
-    CheckConnEntryMustBeInmCT(ent);
     uint32_t caps = trans->Caps();
     int32_t priority = trans->Priority();
     nsresult rv;
 
     LOG(("nsHttpConnectionMgr::DispatchTransaction "
          "[ent-ci=%s %p trans=%p caps=%x conn=%p priority=%d]\n",
          ent->mConnInfo->HashKey().get(), ent, trans, caps, conn, priority));
 
@@ -1752,18 +1735,18 @@ NS_IMPL_ISUPPORTS0(ConnectionHandle)
 // concrete nsHttpTransaction
 nsresult
 nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
                                                  nsAHttpTransaction *aTrans,
                                                  uint32_t caps,
                                                  nsHttpConnection *conn,
                                                  int32_t priority)
 {
-    MOZ_DIAGNOSTIC_ASSERT(ent);
-    CheckConnEntryMustBeInmCT(ent);
+    MOZ_ASSERT(ent);
+
     nsresult rv;
     MOZ_ASSERT(!conn->UsingSpdy(),
                "Spdy Must Not Use DispatchAbstractTransaction");
     LOG(("nsHttpConnectionMgr::DispatchAbstractTransaction "
          "[ci=%s trans=%p caps=%x conn=%p]\n",
          ent->mConnInfo->HashKey().get(), aTrans, caps, conn));
 
     RefPtr<nsAHttpTransaction> transaction(aTrans);
@@ -1829,17 +1812,17 @@ nsHttpConnectionMgr::ProcessNewTransacti
     }
 
     nsresult rv = NS_OK;
     nsHttpConnectionInfo *ci = trans->ConnectionInfo();
     MOZ_ASSERT(ci);
 
     nsConnectionEntry *ent =
         GetOrCreateConnectionEntry(ci, !!trans->TunnelProvider());
-    MOZ_DIAGNOSTIC_ASSERT(ent);
+    MOZ_ASSERT(ent);
 
     ReportProxyTelemetry(ent);
 
     // Check if the transaction already has a sticky reference to a connection.
     // If so, then we can just use it directly by transferring its reference
     // to the new connection variable instead of searching for a new one
 
     nsAHttpConnection *wrappedConnection = trans->Connection();
@@ -1902,17 +1885,16 @@ nsHttpConnectionMgr::ProcessNewTransacti
     return rv;
 }
 
 
 void
 nsHttpConnectionMgr::AddActiveConn(nsHttpConnection *conn,
                                    nsConnectionEntry *ent)
 {
-    CheckConnEntryMustBeInmCT(ent);
     ent->mActiveConns.AppendElement(conn);
     mNumActiveConns++;
     ActivateTimeoutTick();
 }
 
 void
 nsHttpConnectionMgr::DecrementActiveConnCount(nsHttpConnection *conn)
 {
@@ -2090,18 +2072,17 @@ nsHttpConnectionMgr::OnMsgProcessAllSpdy
 }
 
 // Given a connection entry, return an active h2 connection
 // that can be directly activated or null
 nsHttpConnection *
 nsHttpConnectionMgr::GetSpdyActiveConn(nsConnectionEntry *ent)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
-    MOZ_DIAGNOSTIC_ASSERT(ent);
-    CheckConnEntryMustBeInmCT(ent);
+    MOZ_ASSERT(ent);
 
     nsHttpConnection *experienced = nullptr;
     nsHttpConnection *noExperience = nullptr;
     uint32_t activeLen = ent->mActiveConns.Length();
     nsHttpConnectionInfo *ci = ent->mConnInfo;
     uint32_t index;
 
     // activeLen should generally be 1.. this is a setup race being resolved
@@ -2128,22 +2109,16 @@ nsHttpConnectionMgr::GetSpdyActiveConn(n
         }
         for (int32_t index = ent->mHalfOpenFastOpenBackups.Length() - 1; index >= 0; --index) {
              LOG(("GetSpdyActiveConn() shutting down connection in fast "
                  "open state (%p) because we have an experienced spdy "
                  "connection (%p).\n",
                  ent->mHalfOpenFastOpenBackups[index].get(), experienced));
              RefPtr<nsHalfOpenSocket> half = ent->mHalfOpenFastOpenBackups[index];
              half->CancelFastOpenConnection();
-
-             MOZ_DIAGNOSTIC_ASSERT(!half->mBackupTransport);
-             MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamOut);
-             MOZ_DIAGNOSTIC_ASSERT(!half->mBackupStreamIn);
-             MOZ_DIAGNOSTIC_ASSERT(!half->mSynTimer);
-             MOZ_DIAGNOSTIC_ASSERT(!half->mEnt);
         }
 
         LOG(("GetSpdyActiveConn() request for ent %p %s "
              "found an active experienced connection %p in native connection entry\n",
              ent, ci->HashKey().get(), experienced));
         return experienced;
     }
 
@@ -2226,19 +2201,18 @@ nsHttpConnectionMgr::OnMsgShutdown(int32
         }
         ent->mPendingTransactionTable.Clear();
 
         // Close all half open tcp connections.
         for (int32_t i = int32_t(ent->mHalfOpens.Length()) - 1; i >= 0; i--) {
             ent->mHalfOpens[i]->Abandon();
         }
 
-        MOZ_DIAGNOSTIC_ASSERT(ent->mHalfOpenFastOpenBackups.Length() == 0 &&
-                              !ent->mDoNotDestroy);
-        ent->mHowItWasRemoved = nsConnectionEntry::CONN_ENTRY_REMOVED_SHUTDOWN;
+        MOZ_ASSERT(ent->mHalfOpenFastOpenBackups.Length() == 0 &&
+                   !ent->mDoNotDestroy);
         iter.Remove();
     }
 
     if (mTimeoutTick) {
         mTimeoutTick->Cancel();
         mTimeoutTick = nullptr;
         mTimeoutTickArmed = false;
     }
@@ -2413,17 +2387,16 @@ nsHttpConnectionMgr::OnMsgCancelTransact
         // so we want to cancel any null transactions related to this connection
         // entry. They are just optimizations, but they aren't hooked up to
         // anything that might get canceled from the rest of gecko, so best
         // to assume that's what was meant by the cancel we did receive if
         // it only applied to something in the queue.
         for (uint32_t index = 0;
              ent && (index < ent->mActiveConns.Length());
              ++index) {
-            CheckConnEntryMustBeInmCT(ent);
             nsHttpConnection *activeConn = ent->mActiveConns[index];
             nsAHttpTransaction *liveTransaction = activeConn->Transaction();
             if (liveTransaction && liveTransaction->IsNullTransaction()) {
                 LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p] "
                      "also canceling Null Transaction %p on conn %p\n",
                      trans, liveTransaction, activeConn));
                 activeConn->CloseTransaction(liveTransaction, closeCode);
             }
@@ -2708,17 +2681,17 @@ nsHttpConnectionMgr::OnMsgReclaimConnect
     nsHttpConnection *conn = static_cast<nsHttpConnection *>(param);
 
     //
     // 1) remove the connection from the active list
     // 2) if keep-alive, add connection to idle list
     // 3) post event to process the pending transaction queue
     //
 
-    MOZ_DIAGNOSTIC_ASSERT(conn);
+    MOZ_ASSERT(conn);
     nsConnectionEntry *ent = conn->ConnectionInfo() ?
         mCT.GetWeak(conn->ConnectionInfo()->HashKey()) : nullptr;
 
     if (!ent) {
         // this can happen if the connection is made outside of the
         // connection manager and is being "reclaimed" for use with
         // future transactions. HTTP/2 tunnels work like this.
         ent = GetOrCreateConnectionEntry(conn->ConnectionInfo(), true);
@@ -2863,23 +2836,23 @@ nsHttpConnectionMgr::OnMsgUpdateParam(in
     }
 }
 
 // nsHttpConnectionMgr::nsConnectionEntry
 nsHttpConnectionMgr::nsConnectionEntry::~nsConnectionEntry()
 {
     LOG(("nsConnectionEntry::~nsConnectionEntry this=%p", this));
 
-    MOZ_DIAGNOSTIC_ASSERT(!mIdleConns.Length());
-    MOZ_DIAGNOSTIC_ASSERT(!mActiveConns.Length());
-    MOZ_DIAGNOSTIC_ASSERT(!mHalfOpens.Length());
-    MOZ_DIAGNOSTIC_ASSERT(!mUrgentStartQ.Length());
-    MOZ_DIAGNOSTIC_ASSERT(!PendingQLength());
-    MOZ_DIAGNOSTIC_ASSERT(!mHalfOpenFastOpenBackups.Length());
-    MOZ_DIAGNOSTIC_ASSERT(!mDoNotDestroy);
+    MOZ_ASSERT(!mIdleConns.Length());
+    MOZ_ASSERT(!mActiveConns.Length());
+    MOZ_ASSERT(!mHalfOpens.Length());
+    MOZ_ASSERT(!mUrgentStartQ.Length());
+    MOZ_ASSERT(!PendingQLength());
+    MOZ_ASSERT(!mHalfOpenFastOpenBackups.Length());
+    MOZ_ASSERT(!mDoNotDestroy);
 
     MOZ_COUNT_DTOR(nsConnectionEntry);
 }
 
 // Read Timeout Tick handlers
 
 void
 nsHttpConnectionMgr::ActivateTimeoutTick()
@@ -3694,40 +3667,40 @@ nsHalfOpenSocket::nsHalfOpenSocket(nsCon
         ++totalSpeculativeConn;
 
         if (isFromPredictor) {
           Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_CREATED> totalPreconnectsCreated;
           ++totalPreconnectsCreated;
         }
     }
 
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
+    MOZ_ASSERT(mEnt);
 }
 
 nsHttpConnectionMgr::nsHalfOpenSocket::~nsHalfOpenSocket()
 {
-    MOZ_DIAGNOSTIC_ASSERT(!mStreamOut);
-    MOZ_DIAGNOSTIC_ASSERT(!mBackupStreamOut);
-    MOZ_DIAGNOSTIC_ASSERT(!mSynTimer);
+    MOZ_ASSERT(!mStreamOut);
+    MOZ_ASSERT(!mBackupStreamOut);
+    MOZ_ASSERT(!mSynTimer);
     LOG(("Destroying nsHalfOpenSocket [this=%p]\n", this));
 
     if (mEnt)
         mEnt->RemoveHalfOpen(this);
 }
 
 nsresult
 nsHttpConnectionMgr::
 nsHalfOpenSocket::SetupStreams(nsISocketTransport **transport,
                                nsIAsyncInputStream **instream,
                                nsIAsyncOutputStream **outstream,
                                bool isBackup)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
+    MOZ_ASSERT(mEnt);
     nsresult rv;
     const char *socketTypes[1];
     uint32_t typeCount = 0;
     const nsHttpConnectionInfo *ci = mEnt->mConnInfo;
     if (ci->FirstHopSSL()) {
         socketTypes[typeCount++] = "ssl";
     } else {
         socketTypes[typeCount] = gHttpHandler->DefaultSocketType();
@@ -3902,19 +3875,19 @@ nsHttpConnectionMgr::nsHalfOpenSocket::S
         mBackupTransport = nullptr;
     }
     return rv;
 }
 
 void
 nsHttpConnectionMgr::nsHalfOpenSocket::SetupBackupTimer()
 {
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
+    MOZ_ASSERT(mEnt);
     uint16_t timeout = gHttpHandler->GetIdleSynTimeout();
-    MOZ_DIAGNOSTIC_ASSERT(!mSynTimer, "timer already initd");
+    MOZ_ASSERT(!mSynTimer, "timer already initd");
     if (!timeout && mFastOpenInProgress) {
         timeout = 250;
     }
     // When using Fast Open the correct transport will be setup for sure (it is
     // guaranteed), but it can be that it will happened a bit later.
     if (mFastOpenInProgress ||
         (timeout && !mSpeculative)) {
         // Setup the timer that will establish a backup socket
@@ -4019,21 +3992,21 @@ nsHttpConnectionMgr::nsHalfOpenSocket::D
     return (epoch - mPrimarySynStarted).ToMilliseconds();
 }
 
 
 NS_IMETHODIMP // method for nsITimerCallback
 nsHttpConnectionMgr::nsHalfOpenSocket::Notify(nsITimer *timer)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
-    MOZ_DIAGNOSTIC_ASSERT(timer == mSynTimer, "wrong timer");
-
-    MOZ_DIAGNOSTIC_ASSERT(!mBackupTransport);
-    MOZ_DIAGNOSTIC_ASSERT(mSynTimer);
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
+    MOZ_ASSERT(timer == mSynTimer, "wrong timer");
+
+    MOZ_ASSERT(!mBackupTransport);
+    MOZ_ASSERT(mSynTimer);
+    MOZ_ASSERT(mEnt);
 
     DebugOnly<nsresult> rv = SetupBackupStreams();
     MOZ_ASSERT(NS_SUCCEEDED(rv));
 
     mSynTimer = nullptr;
     return NS_OK;
 }
 
@@ -4066,29 +4039,20 @@ nsHalfOpenSocket::FindTransactionHelper(
 }
 
 // method for nsIAsyncOutputStreamCallback
 NS_IMETHODIMP
 nsHttpConnectionMgr::
 nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
-    MOZ_DIAGNOSTIC_ASSERT(mStreamOut || mBackupStreamOut);
-    MOZ_DIAGNOSTIC_ASSERT(out == mStreamOut || out == mBackupStreamOut,
+    MOZ_ASSERT(mStreamOut || mBackupStreamOut);
+    MOZ_ASSERT(out == mStreamOut || out == mBackupStreamOut,
                           "stream mismatch");
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-    if (out == mStreamOut) {
-        LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n",
-             this, mEnt->mConnInfo->Origin(), "primary"));
-        gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
-    } else {
-        LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n",
-             this, mEnt->mConnInfo->Origin(), "backup"));
-        gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
-    }
+    MOZ_ASSERT(mEnt);
 
     LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n",
          this, mEnt->mConnInfo->Origin(),
          out == mStreamOut ? "primary" : "backup"));
 
     mEnt->mDoNotDestroy = true;
     gHttpHandler->ConnMgr()->RecvdConnect();
 
@@ -4138,34 +4102,30 @@ nsHalfOpenSocket::OnOutputStreamReady(ns
             gHttpHandler->IncrementFastOpenConsecutiveFailureCounter();
             mEnt->mUseFastOpen = false;
         }
 
         mFastOpenInProgress = false;
         mConnectionNegotiatingFastOpen = nullptr;
     }
 
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-    gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
     nsresult rv =  SetupConn(out, false);
     if (mEnt) {
         mEnt->mDoNotDestroy = false;
     }
     return rv;
 }
 
 bool
 nsHttpConnectionMgr::
 nsHalfOpenSocket::FastOpenEnabled()
 {
     LOG(("nsHalfOpenSocket::FastOpenEnabled [this=%p]\n", this));
 
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-
-    gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
+    MOZ_ASSERT(mEnt);
 
     if (!mEnt) {
         return false;
     }
 
     // If mEnt is present this HalfOpen must be in the mHalfOpens,
     // but we want to be sure!!!
     if (!mEnt->mHalfOpens.Contains(this)) {
@@ -4205,21 +4165,19 @@ nsHalfOpenSocket::FastOpenEnabled()
 
     return true;
 }
 
 nsresult
 nsHttpConnectionMgr::
 nsHalfOpenSocket::StartFastOpen()
 {
-    MOZ_DIAGNOSTIC_ASSERT(mStreamOut);
-    MOZ_DIAGNOSTIC_ASSERT(!mBackupTransport);
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-
-    gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
+    MOZ_ASSERT(mStreamOut);
+    MOZ_ASSERT(!mBackupTransport);
+    MOZ_ASSERT(mEnt);
 
     LOG(("nsHalfOpenSocket::StartFastOpen [this=%p]\n",
          this));
 
     RefPtr<nsHalfOpenSocket> deleteProtector(this);
 
     mFastOpenInProgress = true;
     mEnt->mDoNotDestroy = true;
@@ -4263,18 +4221,16 @@ nsHalfOpenSocket::StartFastOpen()
 
         // The connection is responsible to take care of the halfOpen so we
         // need to clean it up.
         Abandon();
     } else {
         LOG(("nsHalfOpenSocket::StartFastOpen [this=%p conn=%p]\n",
              this, mConnectionNegotiatingFastOpen.get()));
 
-        gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
-
         mEnt->mHalfOpenFastOpenBackups.AppendElement(this);
         // SetupBackupTimer should setup timer which will hold a ref to this
         // halfOpen. It will failed only if it cannot create timer. Anyway just
         // to be sure I will add this deleteProtector!!!
         if (!mSynTimer) {
             // For Fast Open we will setup backup timer also for
             // NullTransaction.
             // So maybe it is not set and we need to set it here.
@@ -4286,20 +4242,18 @@ nsHalfOpenSocket::StartFastOpen()
     }
     return rv;
 }
 
 void
 nsHttpConnectionMgr::
 nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
 {
-    MOZ_DIAGNOSTIC_ASSERT(mFastOpenInProgress);
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-
-    gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
+    MOZ_ASSERT(mFastOpenInProgress);
+    MOZ_ASSERT(mEnt);
 
     LOG(("nsHalfOpenSocket::SetFastOpenConnected [this=%p conn=%p error=%x]\n",
          this, mConnectionNegotiatingFastOpen.get(),
          static_cast<uint32_t>(aError)));
 
     // mConnectionNegotiatingFastOpen is set after a StartFastOpen creates
     // and activates a nsHttpConnection successfully (SetupConn calls
     // DispatchTransaction and DispatchAbstractTransaction which calls
@@ -4351,17 +4305,16 @@ nsHalfOpenSocket::SetFastOpenConnected(n
             }
         }
         // We are doing a restart without fast open, so the easiest way is to
         // return mSocketTransport to the halfOpenSock and destroy connection.
         // This makes http2 implemenntation easier.
         // mConnectionNegotiatingFastOpen is going away and halfOpen is taking
         // this mSocketTransport so add halfOpen to mEnt and update
         // mNumActiveConns.
-        gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
         mEnt->mHalfOpens.AppendElement(this);
         gHttpHandler->ConnMgr()->mNumHalfOpenConns++;
         gHttpHandler->ConnMgr()->StartedConnect();
 
         // Restore callbacks.
         mStreamOut->AsyncWait(this, 0, 0, nullptr);
         mSocketTransport->SetEventSink(this, nullptr);
         mSocketTransport->SetSecurityCallbacks(this);
@@ -4384,44 +4337,42 @@ nsHalfOpenSocket::SetFastOpenConnected(n
 
         Abandon();
     }
 
     mFastOpenInProgress = false;
     mConnectionNegotiatingFastOpen = nullptr;
     if (mEnt) {
         mEnt->mDoNotDestroy = false;
-        MOZ_DIAGNOSTIC_ASSERT(mEnt->mHalfOpens.Contains(this));
+        MOZ_ASSERT(mEnt->mHalfOpens.Contains(this));
     } else {
-        MOZ_DIAGNOSTIC_ASSERT(!mSynTimer);
-        MOZ_DIAGNOSTIC_ASSERT(!mBackupTransport);
-        MOZ_DIAGNOSTIC_ASSERT(!mBackupStreamOut);
+        MOZ_ASSERT(!mSynTimer);
+        MOZ_ASSERT(!mBackupTransport);
+        MOZ_ASSERT(!mBackupStreamOut);
     }
 }
 
 void
 nsHttpConnectionMgr::
 nsHalfOpenSocket::SetFastOpenStatus(uint8_t tfoStatus)
 {
     MOZ_ASSERT(mFastOpenInProgress);
     mConnectionNegotiatingFastOpen->SetFastOpenStatus(tfoStatus);
     mConnectionNegotiatingFastOpen->Transaction()->SetFastOpenStatus(tfoStatus);
 }
 
 void
 nsHttpConnectionMgr::
 nsHalfOpenSocket::CancelFastOpenConnection()
 {
-    MOZ_DIAGNOSTIC_ASSERT(mFastOpenInProgress);
+    MOZ_ASSERT(mFastOpenInProgress);
 
     LOG(("nsHalfOpenSocket::CancelFastOpenConnection [this=%p conn=%p]\n",
          this, mConnectionNegotiatingFastOpen.get()));
 
-    gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
-
     RefPtr<nsHalfOpenSocket> deleteProtector(this);
     mEnt->mHalfOpenFastOpenBackups.RemoveElement(this);
     mSocketTransport->SetFastOpenCallback(nullptr);
     mConnectionNegotiatingFastOpen->SetFastOpen(false);
     RefPtr<nsAHttpTransaction> trans =
         mConnectionNegotiatingFastOpen->CloseConnectionFastOpenTakesTooLongOrError(true);
     mSocketTransport = nullptr;
     mStreamOut = nullptr;
@@ -4437,19 +4388,19 @@ nsHalfOpenSocket::CancelFastOpenConnecti
         } else {
             mEnt->InsertTransaction(pendingTransInfo, true);
         }
     }
 
     mFastOpenInProgress = false;
     mConnectionNegotiatingFastOpen = nullptr;
     Abandon();
-    MOZ_DIAGNOSTIC_ASSERT(!mSynTimer);
-    MOZ_DIAGNOSTIC_ASSERT(!mBackupTransport);
-    MOZ_DIAGNOSTIC_ASSERT(!mBackupStreamOut);
+    MOZ_ASSERT(!mSynTimer);
+    MOZ_ASSERT(!mBackupTransport);
+    MOZ_ASSERT(!mBackupStreamOut);
 }
 
 void
 nsHttpConnectionMgr::
 nsHalfOpenSocket::FastOpenNotSupported()
 {
   MOZ_ASSERT(mFastOpenInProgress);
   gHttpHandler->SetFastOpenNotSupported();
@@ -4617,21 +4568,20 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutp
                 }
             }
         }
     }
 
     // If this connection has a transaction get reference to its
     // ConnectionHandler.
     if (aFastOpen) {
-        MOZ_DIAGNOSTIC_ASSERT(mEnt);
-        MOZ_DIAGNOSTIC_ASSERT(static_cast<int32_t>(mEnt->mIdleConns.IndexOf(conn)) == -1);
+        MOZ_ASSERT(mEnt);
+        MOZ_ASSERT(static_cast<int32_t>(mEnt->mIdleConns.IndexOf(conn)) == -1);
         int32_t idx = mEnt->mActiveConns.IndexOf(conn);
         if (NS_SUCCEEDED(rv) && (idx != -1)) {
-            gHttpHandler->ConnMgr()->CheckConnEntryMustBeInmCT(mEnt);
             mConnectionNegotiatingFastOpen = conn;
         } else {
             conn->SetFastOpen(false);
         }
     }
 
     // If this halfOpenConn was speculative, but at the ende the conn got a
     // non-null transaction than this halfOpen is not speculative anymore!
@@ -4673,24 +4623,19 @@ nsHttpConnectionMgr::RegisterOriginCoale
 NS_IMETHODIMP
 nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans,
                                                          nsresult status,
                                                          int64_t progress,
                                                          int64_t progressMax)
 {
     MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
-    MOZ_DIAGNOSTIC_ASSERT((trans == mSocketTransport) || (trans == mBackupTransport));
-    MOZ_DIAGNOSTIC_ASSERT(mEnt);
-
-    if (mEnt->mHowItWasRemoved == nsConnectionEntry::CONN_ENTRY_CLEAR_CONNECTION_HISTORY) {
-        MOZ_DIAGNOSTIC_ASSERT(false);
-    } else if (mEnt->mHowItWasRemoved == nsConnectionEntry::CONN_ENTRY_REMOVED_SHUTDOWN) {
-        MOZ_DIAGNOSTIC_ASSERT(false);
-    }
+    MOZ_ASSERT((trans == mSocketTransport) || (trans == mBackupTransport));
+    MOZ_ASSERT(mEnt);
+
     if (mTransaction) {
         RefPtr<PendingTransactionInfo> info = FindTransactionHelper(false);
         if ((trans == mSocketTransport) ||
             ((trans == mBackupTransport) && (status == NS_NET_STATUS_CONNECTED_TO) &&
             info)) {
             // Send this status event only if the transaction is still pending,
             // i.e. it has not found a free already connected socket.
             // Sockets in halfOpen state can only get following events:
@@ -4867,17 +4812,16 @@ ConnectionHandle::HttpConnection()
 nsHttpConnectionMgr::
 nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
     : mConnInfo(ci)
     , mUsingSpdy(false)
     , mPreferIPv4(false)
     , mPreferIPv6(false)
     , mUsedForConnection(false)
     , mDoNotDestroy(false)
-    , mHowItWasRemoved(CONN_ENTRY_NOT_REMOVED)
 {
     MOZ_COUNT_CTOR(nsConnectionEntry);
     mUseFastOpen = gHttpHandler->UseFastOpen();
 
     LOG(("nsConnectionEntry::nsConnectionEntry this=%p key=%s",
          this, ci->HashKey().get()));
 }
 
@@ -5181,23 +5125,10 @@ nsHttpConnectionMgr::MoveToWildCardConnE
         if (ent->mIdleConns[i] == proxyConn) {
             ent->mIdleConns.RemoveElementAt(i);
             wcEnt->mIdleConns.InsertElementAt(0, proxyConn);
             return;
         }
     }
 }
 
-void
-nsHttpConnectionMgr::CheckConnEntryMustBeInmCT(nsConnectionEntry *ent)
-{
-    if (ent->mHowItWasRemoved == nsConnectionEntry::CONN_ENTRY_CLEAR_CONNECTION_HISTORY) {
-        MOZ_DIAGNOSTIC_ASSERT(false);
-    } else if (ent->mHowItWasRemoved == nsConnectionEntry::CONN_ENTRY_REMOVED_SHUTDOWN) {
-        MOZ_DIAGNOSTIC_ASSERT(false);
-    }
-    MOZ_DIAGNOSTIC_ASSERT(ent->mConnInfo);
-    nsConnectionEntry *ent2 = mCT.GetWeak(ent->mConnInfo->HashKey());
-    MOZ_DIAGNOSTIC_ASSERT(ent2);
-}
-
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
@@ -332,21 +332,17 @@ private:
         // focused and non-focused windows.
         void AppendPendingQForNonFocusedWindows(
             uint64_t windowId,
             nsTArray<RefPtr<PendingTransactionInfo>> &result,
             uint32_t maxCount = 0);
 
         // Remove the empty pendingQ in |mPendingTransactionTable|.
         void RemoveEmptyPendingQ();
-        enum {
-          CONN_ENTRY_NOT_REMOVED,
-          CONN_ENTRY_CLEAR_CONNECTION_HISTORY,
-          CONN_ENTRY_REMOVED_SHUTDOWN,
-        }  mHowItWasRemoved;
+
     private:
         ~nsConnectionEntry();
     };
 
 public:
     static nsAHttpConnection *MakeConnectionHandle(nsHttpConnection *aWrapped);
     void RegisterOriginCoalescingKey(nsHttpConnection *, const nsACString &host, int32_t port);
 
@@ -464,22 +460,16 @@ private:
         // case we can free this transaction to be claimed by other
         // transactions.
         bool                           mFreeToUse;
         nsresult                       mPrimaryStreamStatus;
 
         bool                           mFastOpenInProgress;
         RefPtr<nsHttpConnection>       mConnectionNegotiatingFastOpen;
 
-    private:
-        // nsHttpConnectionMgr is friend class so that we can access them for
-        // diagnostic asserts. The this asserts are removed the following line
-        // needs to be removed.
-        friend class nsHttpConnectionMgr;
-
         RefPtr<nsConnectionEntry>      mEnt;
         nsCOMPtr<nsITimer>             mSynTimer;
         nsCOMPtr<nsISocketTransport>   mBackupTransport;
         nsCOMPtr<nsIAsyncOutputStream> mBackupStreamOut;
         nsCOMPtr<nsIAsyncInputStream>  mBackupStreamIn;
     };
     friend class nsHalfOpenSocket;
 
@@ -746,18 +736,16 @@ private:
     bool mActiveTabTransactionsExist;
     bool mActiveTabUnthrottledTransactionsExist;
 
     void LogActiveTransactions(char);
 
     nsTArray<RefPtr<PendingTransactionInfo>>*
     GetTransactionPendingQHelper(nsConnectionEntry *ent, nsAHttpTransaction *trans);
 
-    // This is only a diagnostic check end it will e removed soon.
-    void CheckConnEntryMustBeInmCT(nsConnectionEntry *ent);
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsHttpConnectionMgr::nsHalfOpenSocket, NS_HALFOPENSOCKET_IID)
 
 } // namespace net
 } // namespace mozilla
 
 #endif // !nsHttpConnectionMgr_h__