bug 871289 [1 of 2] standardize netwerk/protocol/http on moz_assert r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Thu, 16 May 2013 09:30:41 -0400
changeset 132080 7400723d23bc45e3f57f776047fba23e4632fc2f
parent 132079 867619e912080d61dfafe32577472fed2ae76fef
child 132081 c87ddaff7aa4c8c432093fecb807b6b5e9cf5fc1
push id28105
push usermcmanus@ducksong.com
push dateThu, 16 May 2013 13:31:04 +0000
treeherdermozilla-inbound@c87ddaff7aa4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs871289
milestone24.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 871289 [1 of 2] standardize netwerk/protocol/http on moz_assert r=jduell
netwerk/protocol/http/ASpdySession.cpp
netwerk/protocol/http/ConnectionDiagnostics.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParentListener.cpp
netwerk/protocol/http/PHttpChannelParams.h
netwerk/protocol/http/SpdySession2.cpp
netwerk/protocol/http/SpdySession3.cpp
netwerk/protocol/http/SpdyStream2.cpp
netwerk/protocol/http/SpdyStream2.h
netwerk/protocol/http/SpdyStream3.cpp
netwerk/protocol/http/SpdyStream3.h
netwerk/protocol/http/nsHttp.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHeaderArray.h
netwerk/protocol/http/nsHttpPipeline.cpp
netwerk/protocol/http/nsHttpResponseHead.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
--- a/netwerk/protocol/http/ASpdySession.cpp
+++ b/netwerk/protocol/http/ASpdySession.cpp
@@ -19,19 +19,19 @@ namespace net {
 ASpdySession *
 ASpdySession::NewSpdySession(uint32_t version,
                              nsAHttpTransaction *aTransaction,
                              nsISocketTransport *aTransport,
                              int32_t aPriority)
 {
   // This is a necko only interface, so we can enforce version
   // requests as a precondition
-  NS_ABORT_IF_FALSE(version == SpdyInformation::SPDY_VERSION_2 ||
-                    version == SpdyInformation::SPDY_VERSION_3,
-                    "Unsupported spdy version");
+  MOZ_ASSERT(version == SpdyInformation::SPDY_VERSION_2 ||
+             version == SpdyInformation::SPDY_VERSION_3,
+             "Unsupported spdy version");
 
   // Don't do a runtime check of IsSpdyV?Enabled() here because pref value
   // may have changed since starting negotiation. The selected protocol comes
   // from a list provided in the SERVER HELLO filtered by our acceptable
   // versions, so there is no risk of the server ignoring our prefs.
 
   Telemetry::Accumulate(Telemetry::SPDY_VERSION2, version);
     
@@ -57,17 +57,17 @@ bool
 SpdyInformation::ProtocolEnabled(uint32_t index)
 {
   if (index == 0)
     return gHttpHandler->IsSpdyV3Enabled();
 
   if (index == 1)
     return gHttpHandler->IsSpdyV2Enabled();
 
-  NS_ABORT_IF_FALSE(false, "index out of range");
+  MOZ_ASSERT(false, "index out of range");
   return false;
 }
 
 nsresult
 SpdyInformation::GetNPNVersionIndex(const nsACString &npnString,
                                     uint8_t *result)
 {
   if (npnString.IsEmpty())
--- a/netwerk/protocol/http/ConnectionDiagnostics.cpp
+++ b/netwerk/protocol/http/ConnectionDiagnostics.cpp
@@ -19,18 +19,17 @@ void
 nsHttpConnectionMgr::PrintDiagnostics()
 {
   PostEvent(&nsHttpConnectionMgr::OnMsgPrintDiagnostics, 0, nullptr);
 }
 
 void
 nsHttpConnectionMgr::OnMsgPrintDiagnostics(int32_t, void *)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   nsCOMPtr<nsIConsoleService> consoleService =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID);
   if (!consoleService)
     return;
 
   mLogData.AppendPrintf("HTTP Connection Diagnostics\n---------------------\n");
   mLogData.AppendPrintf("IsSpdyEnabled() = %d\n", gHttpHandler->IsSpdyEnabled());
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -758,17 +758,17 @@ NS_IMPL_ISUPPORTS1(HttpBaseChannel::nsCo
 
 //-----------------------------------------------------------------------------
 // HttpBaseChannel::nsContentEncodings <private>
 //-----------------------------------------------------------------------------
 
 nsresult
 HttpBaseChannel::nsContentEncodings::PrepareForNext(void)
 {
-  NS_ASSERTION(mCurStart == mCurEnd, "Indeterminate state");
+  MOZ_ASSERT(mCurStart == mCurEnd, "Indeterminate state");
     
   // At this point both mCurStart and mCurEnd point to somewhere
   // past the end of the next thing we want to return
     
   while (mCurEnd != mEncodingHeader) {
     --mCurEnd;
     if (*mCurEnd != ',' && !nsCRT::IsAsciiSpace(*mCurEnd))
       break;
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -102,25 +102,25 @@ NS_INTERFACE_MAP_END_INHERITING(HttpBase
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::PHttpChannelChild
 //-----------------------------------------------------------------------------
 
 void
 HttpChannelChild::AddIPDLReference()
 {
-  NS_ABORT_IF_FALSE(!mIPCOpen, "Attempt to retain more than one IPDL reference");
+  MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference");
   mIPCOpen = true;
   AddRef();
 }
 
 void
 HttpChannelChild::ReleaseIPDLReference()
 {
-  NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference");
+  MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference");
   mIPCOpen = false;
   Release();
 }
 
 class AssociateApplicationCacheEvent : public ChannelEvent
 {
   public:
     AssociateApplicationCacheEvent(HttpChannelChild* child,
@@ -367,28 +367,27 @@ HttpChannelChild::OnTransportAndData(con
   // - JDUELL: may not need mStatus/mIsPending checks, given this is always called
   //   during OnDataAvailable, and we've already checked mCanceled.  Code
   //   dupe'd from nsHttpChannel
   if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
       !(mLoadFlags & LOAD_BACKGROUND))
   {
     // OnStatus
     //
-    NS_ASSERTION(status == NS_NET_STATUS_RECEIVING_FROM ||
-                 status == NS_NET_STATUS_READING,
-                 "unexpected status code");
+    MOZ_ASSERT(status == NS_NET_STATUS_RECEIVING_FROM ||
+               status == NS_NET_STATUS_READING);
 
     nsAutoCString host;
     mURI->GetHost(host);
     mProgressSink->OnStatus(this, nullptr, status,
                             NS_ConvertUTF8toUTF16(host).get());
     // OnProgress
     //
     if (progress > 0) {
-      NS_ASSERTION(progress <= progressMax, "unexpected progress values");
+      MOZ_ASSERT(progress <= progressMax, "unexpected progress values");
       mProgressSink->OnProgress(this, nullptr, progress, progressMax);
     }
   }
 
   // OnDataAvailable
   //
   // NOTE: the OnDataAvailable contract requires the client to read all the data
   // in the inputstream.  This code relies on that ('data' will go away after
@@ -517,17 +516,17 @@ HttpChannelChild::OnProgress(const uint6
   AutoEventEnqueuer ensureSerialDispatch(mEventQ);
 
   // block socket status event after Cancel or OnStopRequest has been called,
   // or if channel has LOAD_BACKGROUND set
   if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && 
       !(mLoadFlags & LOAD_BACKGROUND)) 
   {
     if (progress > 0) {
-      NS_ASSERTION(progress <= progressMax, "unexpected progress values");
+      MOZ_ASSERT(progress <= progressMax, "unexpected progress values");
       mProgressSink->OnProgress(this, nullptr, progress, progressMax);
     }
   }
 }
 
 class StatusEvent : public ChannelEvent
 {
  public:
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -42,17 +42,17 @@ HttpChannelParent::HttpChannelParent(PBr
   , mSentRedirect1BeginFailed(false)
   , mReceivedRedirect2Verify(false)
   , mPBOverride(aOverrideStatus)
   , mLoadContext(aLoadContext)
 {
   // Ensure gHttpHandler is initialized: we need the atom table up and running.
   nsIHttpProtocolHandler* handler;
   CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &handler);
-  NS_ASSERTION(handler, "no http handler");
+  MOZ_ASSERT(handler);
 
   mTabParent = static_cast<mozilla::dom::TabParent*>(iframeEmbedding);
 }
 
 HttpChannelParent::~HttpChannelParent()
 {
   gHttpHandler->Release();
 }
--- a/netwerk/protocol/http/HttpChannelParentListener.cpp
+++ b/netwerk/protocol/http/HttpChannelParentListener.cpp
@@ -177,32 +177,32 @@ HttpChannelParentListener::OnRedirectRes
                                      getter_AddRefs(redirectChannel));
     if (NS_FAILED(rv) || !redirectChannel) {
       // Redirect might get canceled before we got AsyncOnChannelRedirect
       LOG(("Registered parent channel not found under id=%d", mRedirectChannelId));
 
       nsCOMPtr<nsIChannel> newChannel;
       rv = registrar->GetRegisteredChannel(mRedirectChannelId,
                                            getter_AddRefs(newChannel));
-      NS_ASSERTION(newChannel, "Already registered channel not found");
+      MOZ_ASSERT(newChannel, "Already registered channel not found");
 
       if (NS_SUCCEEDED(rv))
         newChannel->Cancel(NS_BINDING_ABORTED);
     }
 
     // Release all previously registered channels, they are no longer need to be
     // kept in the registrar from this moment.
     registrar->DeregisterChannels(mRedirectChannelId);
 
     mRedirectChannelId = 0;
   }
 
   nsCOMPtr<nsIParentRedirectingChannel> activeRedirectingChannel =
       do_QueryInterface(mActiveChannel);
-  NS_ABORT_IF_FALSE(activeRedirectingChannel,
+  MOZ_ASSERT(activeRedirectingChannel,
     "Channel finished a redirect response, but doesn't implement "
     "nsIParentRedirectingChannel to complete it.");
 
   activeRedirectingChannel->CompleteRedirect(succeeded);
 
   if (succeeded) {
     // Switch to redirect channel and delete the old one.
     mActiveChannel->Delete();
--- a/netwerk/protocol/http/PHttpChannelParams.h
+++ b/netwerk/protocol/http/PHttpChannelParams.h
@@ -60,29 +60,29 @@ struct ParamTraits<mozilla::net::Request
 template<>
 struct ParamTraits<nsHttpAtom>
 {
   typedef nsHttpAtom paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     // aParam.get() cannot be null.
-    NS_ASSERTION(aParam.get(), "null nsHTTPAtom value");
+    MOZ_ASSERT(aParam.get(), "null nsHTTPAtom value");
     nsAutoCString value(aParam.get());
     WriteParam(aMsg, value);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     nsAutoCString value;
     if (!ReadParam(aMsg, aIter, &value))
       return false;
 
     *aResult = nsHttp::ResolveAtom(value.get());
-    NS_ASSERTION(aResult->get(), "atom table not initialized");
+    MOZ_ASSERT(aResult->get(), "atom table not initialized");
     return true;
   }
 };
 
 template<>
 struct ParamTraits<nsHttpHeaderArray::nsEntry>
 {
   typedef nsHttpHeaderArray::nsEntry paramType;
--- a/netwerk/protocol/http/SpdySession2.cpp
+++ b/netwerk/protocol/http/SpdySession2.cpp
@@ -58,17 +58,17 @@ SpdySession2::SpdySession2(nsAHttpTransa
     mServerPushedResources(0),
     mOutputQueueSize(kDefaultQueueSize),
     mOutputQueueUsed(0),
     mOutputQueueSent(0),
     mLastReadEpoch(PR_IntervalNow()),
     mPingSentEpoch(0),
     mNextPingID(1)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdySession2::SpdySession2 %p transaction 1 = %p",
         this, aHttpTransaction));
   
   mStreamIDHash.Init();
   mStreamTransactionHash.Init();
   mConnection = aHttpTransaction->Connection();
   mInputFrameBuffer = new char[mInputFrameBufferSize];
@@ -187,17 +187,17 @@ static Control_FX sControlFunctions[] =
   SpdySession2::HandleGoAway,
   SpdySession2::HandleHeaders,
   SpdySession2::HandleWindowUpdate
 };
 
 bool
 SpdySession2::RoomForMoreConcurrent()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   return (mConcurrent < mMaxConcurrent);
 }
 
 bool
 SpdySession2::RoomForMoreStreams()
 {
   if (mNextStreamID + mStreamTransactionHash.Count() * 2 > kMaxStreamID)
@@ -210,18 +210,18 @@ PRIntervalTime
 SpdySession2::IdleTime()
 {
   return PR_IntervalNow() - mLastDataReadEpoch;
 }
 
 void
 SpdySession2::ReadTimeoutTick(PRIntervalTime now)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(mNextPingID & 1, "Ping Counter Not Odd");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mNextPingID & 1, "Ping Counter Not Odd");
 
     if (!mPingThreshold)
       return;
 
     LOG(("SpdySession2::ReadTimeoutTick %p delta since last read %ds\n",
          this, PR_IntervalToSeconds(now - mLastReadEpoch)));
 
     if ((now - mLastReadEpoch) < mPingThreshold) {
@@ -263,55 +263,54 @@ SpdySession2::ReadTimeoutTick(PRInterval
            "ping ids exhausted marking goaway\n", this));
       mShouldGoAway = true;
     }
 }
 
 uint32_t
 SpdySession2::RegisterStreamID(SpdyStream2 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdySession2::RegisterStreamID session=%p stream=%p id=0x%X "
         "concurrent=%d",this, stream, mNextStreamID, mConcurrent));
 
-  NS_ABORT_IF_FALSE(mNextStreamID < 0xfffffff0,
-                    "should have stopped admitting streams");
+  MOZ_ASSERT(mNextStreamID < 0xfffffff0, "should have stopped admitting streams");
   
   uint32_t result = mNextStreamID;
   mNextStreamID += 2;
 
   // We've used up plenty of ID's on this session. Start
   // moving to a new one before there is a crunch involving
   // server push streams or concurrent non-registered submits
   if (mNextStreamID >= kMaxStreamID)
     mShouldGoAway = true;
 
   // integrity check
   if (mStreamIDHash.Get(result)) {
     LOG3(("   New ID already present\n"));
-    NS_ABORT_IF_FALSE(false, "New ID already present in mStreamIDHash");
+    MOZ_ASSERT(false, "New ID already present in mStreamIDHash");
     mShouldGoAway = true;
     return kDeadStreamID;
   }
 
   mStreamIDHash.Put(result, stream);
   return result;
 }
 
 bool
 SpdySession2::AddStream(nsAHttpTransaction *aHttpTransaction,
                        int32_t aPriority)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   // integrity check
   if (mStreamTransactionHash.Get(aHttpTransaction)) {
     LOG3(("   New transaction already present\n"));
-    NS_ABORT_IF_FALSE(false, "AddStream duplicate transaction pointer");
+    MOZ_ASSERT(false, "AddStream duplicate transaction pointer");
     return false;
   }
 
   aHttpTransaction->SetConnection(this);
   SpdyStream2 *stream = new SpdyStream2(aHttpTransaction,
                                       this,
                                       mSocketTransport,
                                       mSendingChunkSize,
@@ -336,17 +335,17 @@ SpdySession2::AddStream(nsAHttpTransacti
   }
   
   return true;
 }
 
 void
 SpdySession2::ActivateStream(SpdyStream2 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   mConcurrent++;
   if (mConcurrent > mConcurrentHighWater)
     mConcurrentHighWater = mConcurrent;
   LOG3(("SpdySession2::AddStream %p activating stream %p Currently %d "
         "streams in session, high water mark is %d",
         this, stream, mConcurrent, mConcurrentHighWater));
 
@@ -360,33 +359,33 @@ SpdySession2::ActivateStream(SpdyStream2
     uint32_t countRead;
     ReadSegments(nullptr, kDefaultBufferSize, &countRead);
   }
 }
 
 void
 SpdySession2::ProcessPending()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   while (RoomForMoreConcurrent()) {
     SpdyStream2 *stream = static_cast<SpdyStream2 *>(mQueuedStreams.PopFront());
     if (!stream)
       return;
     LOG3(("SpdySession2::ProcessPending %p stream %p activated from queue.",
           this, stream));
     ActivateStream(stream);
   }
 }
 
 nsresult
 SpdySession2::NetworkRead(nsAHttpSegmentWriter *writer, char *buf,
                          uint32_t count, uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   if (!count) {
     *countWritten = 0;
     return NS_OK;
   }
 
   nsresult rv = writer->OnWriteSegment(buf, count, countWritten);
   if (NS_SUCCEEDED(rv) && *countWritten > 0)
@@ -454,35 +453,35 @@ SpdySession2::DontReuse()
   mShouldGoAway = true;
   if (!mStreamTransactionHash.Count())
     Close(NS_OK);
 }
 
 uint32_t
 SpdySession2::GetWriteQueueSize()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   return mUrgentForWrite.GetSize() + mReadyForWrite.GetSize();
 }
 
 void
 SpdySession2::ChangeDownstreamState(enum stateType newState)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream2::ChangeDownstreamState() %p from %X to %X",
         this, mDownstreamState, newState));
   mDownstreamState = newState;
 }
 
 void
 SpdySession2::ResetDownstreamState()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream2::ResetDownstreamState() %p", this));
   ChangeDownstreamState(BUFFERING_FRAME_HEADER);
 
   if (mInputFrameDataLast && mInputFrameDataStream) {
     mInputFrameDataLast = false;
     if (!mInputFrameDataStream->RecvdFin()) {
       mInputFrameDataStream->SetRecvdFin(true);
@@ -744,17 +743,17 @@ SpdySession2::ConvertHeaders(nsDependent
         mFlatHTTPResponseHeaders.get()));
   
   return NS_OK;
 }
 
 void
 SpdySession2::GeneratePing(uint32_t aID)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::GeneratePing %p 0x%X\n", this, aID));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 12;
 
   packet[0] = kFlag_Control;
@@ -770,17 +769,17 @@ SpdySession2::GeneratePing(uint32_t aID)
   memcpy(packet + 8, &aID, 4);
 
   FlushOutputQueue();
 }
 
 void
 SpdySession2::GenerateRstStream(uint32_t aStatusCode, uint32_t aID)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::GenerateRst %p 0x%X %d\n", this, aID, aStatusCode));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 16;
 
   packet[0] = kFlag_Control;
@@ -798,17 +797,17 @@ SpdySession2::GenerateRstStream(uint32_t
   memcpy(packet + 12, &aStatusCode, 4);
 
   FlushOutputQueue();
 }
 
 void
 SpdySession2::GenerateGoAway()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::GenerateGoAway %p\n", this));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 12;
 
   memset(packet, 0, 12);
@@ -824,17 +823,17 @@ SpdySession2::GenerateGoAway()
 }
 
 // perform a bunch of integrity checks on the stream.
 // returns true if passed, false (plus LOG and ABORT) if failed.
 bool
 SpdySession2::VerifyStream(SpdyStream2 *aStream, uint32_t aOptionalID = 0)
 {
   // This is annoying, but at least it is O(1)
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
 #ifndef DEBUG
   // Only do the real verification in debug builds
   return true;
 #endif
 
   if (!aStream)
     return true;
@@ -872,25 +871,25 @@ SpdySession2::VerifyStream(SpdyStream2 *
     // tests passed
     return true;
   } while (0);
 
   LOG(("SpdySession %p VerifyStream Failure %p stream->id=0x%x "
        "optionalID=0x%x trans=%p test=%d\n",
        this, aStream, aStream->StreamID(),
        aOptionalID, aStream->Transaction(), test));
-  NS_ABORT_IF_FALSE(false, "VerifyStream");
+  MOZ_ASSERT(false, "VerifyStream");
   return false;
 }
 
 void
 SpdySession2::CleanupStream(SpdyStream2 *aStream, nsresult aResult,
                            rstReason aResetCode)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::CleanupStream %p %p 0x%x %X\n",
         this, aStream, aStream->StreamID(), aResult));
 
   if (!VerifyStream(aStream)) {
     LOG(("SpdySession2::CleanupStream failed to verify stream\n"));
     return;
   }
 
@@ -915,17 +914,17 @@ SpdySession2::CleanupStream(SpdyStream2 
 
   if (mShouldGoAway && !mStreamTransactionHash.Count())
     Close(NS_OK);
 }
 
 void
 SpdySession2::CloseStream(SpdyStream2 *aStream, nsresult aResult)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::CloseStream %p %p 0x%x %X\n",
         this, aStream, aStream->StreamID(), aResult));
 
   // Check if partial frame reader
   if (aStream == mInputFrameDataStream) {
     LOG3(("Stream had active partial read frame on close"));
     ChangeDownstreamState(DISCARDING_DATA_FRAME);
     mInputFrameDataStream = nullptr;
@@ -960,18 +959,17 @@ SpdySession2::CloseStream(SpdyStream2 *a
 
   // Send the stream the close() indication
   aStream->Close(aResult);
 }
 
 nsresult
 SpdySession2::HandleSynStream(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM);
   
   if (self->mInputFrameDataSize < 18) {
     LOG3(("SpdySession2::HandleSynStream %p SYN_STREAM too short data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t streamID =
@@ -1022,18 +1020,17 @@ SpdySession2::SetInputFrameDataStream(ui
        streamID));
   mInputFrameDataStream = nullptr;
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
 SpdySession2::HandleSynReply(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY);
 
   if (self->mInputFrameDataSize < 8) {
     LOG3(("SpdySession2::HandleSynReply %p SYN REPLY too short data=%d",
           self, self->mInputFrameDataSize));
     // A framing error is a session wide error that cannot be recovered
     return NS_ERROR_ILLEGAL_VALUE;
   }
   
@@ -1139,18 +1136,17 @@ SpdySession2::HandleSynReplyForValidStre
   mLastDataReadEpoch = mLastReadEpoch;
   ChangeDownstreamState(PROCESSING_CONTROL_SYN_REPLY);
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleRstStream(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_RST_STREAM,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_RST_STREAM);
 
   if (self->mInputFrameDataSize != 8) {
     LOG3(("SpdySession2::HandleRstStream %p RST_STREAM wrong length data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint8_t flags = reinterpret_cast<uint8_t *>(self->mInputFrameBuffer.get())[4];
@@ -1194,18 +1190,17 @@ SpdySession2::HandleRstStream(SpdySessio
 
   self->ChangeDownstreamState(PROCESSING_CONTROL_RST_STREAM);
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleSettings(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SETTINGS,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SETTINGS);
 
   if (self->mInputFrameDataSize < 4) {
     LOG3(("SpdySession2::HandleSettings %p SETTINGS wrong length data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t numEntries =
@@ -1277,36 +1272,34 @@ SpdySession2::HandleSettings(SpdySession
   
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleNoop(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_NOOP,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_NOOP);
 
   if (self->mInputFrameDataSize != 0) {
     LOG3(("SpdySession2::HandleNoop %p NOP had data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   LOG3(("SpdySession2::HandleNoop %p NOP.", self));
 
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandlePing(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_PING,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_PING);
 
   if (self->mInputFrameDataSize != 4) {
     LOG3(("SpdySession2::HandlePing %p PING had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t pingID =
@@ -1325,18 +1318,17 @@ SpdySession2::HandlePing(SpdySession2 *s
     
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleGoAway(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_GOAWAY,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_GOAWAY);
 
   if (self->mInputFrameDataSize != 4) {
     LOG3(("SpdySession2::HandleGoAway %p GOAWAY had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   self->mShouldGoAway = true;
@@ -1378,18 +1370,17 @@ SpdySession2::HandleGoAway(SpdySession2 
   self->ResumeRecv();
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleHeaders(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_HEADERS,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_HEADERS);
 
   if (self->mInputFrameDataSize < 10) {
     LOG3(("SpdySession2::HandleHeaders %p HEADERS had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t streamID =
@@ -1407,18 +1398,18 @@ SpdySession2::HandleHeaders(SpdySession2
   self->mLastDataReadEpoch = self->mLastReadEpoch;
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession2::HandleWindowUpdate(SpdySession2 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE);
+
   LOG3(("SpdySession2::HandleWindowUpdate %p WINDOW UPDATE was "
         "received. WINDOW UPDATE is no longer defined in v2. Ignoring.",
         self));
 
   self->ResetDownstreamState();
   return NS_OK;
 }
 
@@ -1427,17 +1418,17 @@ SpdySession2::HandleWindowUpdate(SpdySes
 // of these methods
 //-----------------------------------------------------------------------------
 
 void
 SpdySession2::OnTransportStatus(nsITransport* aTransport,
                                nsresult aStatus,
                                uint64_t aProgress)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   switch (aStatus) {
     // These should appear only once, deliver to the first
     // transaction on the session.
   case NS_NET_STATUS_RESOLVING_HOST:
   case NS_NET_STATUS_RESOLVED_HOST:
   case NS_NET_STATUS_CONNECTING_TO:
   case NS_NET_STATUS_CONNECTED_TO:
@@ -1482,20 +1473,20 @@ SpdySession2::OnTransportStatus(nsITrans
 // converted to SPDY data. Sometimes control data like window-update are
 // generated instead.
 
 nsresult
 SpdySession2::ReadSegments(nsAHttpSegmentReader *reader,
                           uint32_t count,
                           uint32_t *countRead)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
-  NS_ABORT_IF_FALSE(!mSegmentReader || !reader || (mSegmentReader == reader),
-                    "Inconsistent Write Function Callback");
+  MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader),
+             "Inconsistent Write Function Callback");
 
   if (reader)
     mSegmentReader = reader;
 
   nsresult rv;
   *countRead = 0;
 
   // First priority goes to frames that were writing to the network but were
@@ -1589,17 +1580,17 @@ SpdySession2::ReadSegments(nsAHttpSegmen
 // call stream->WriteSegemnts which can call this::OnWriteSegment to get the
 // data. It always gets full frames if they are part of the stream
 
 nsresult
 SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer,
                            uint32_t count,
                            uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv;
   *countWritten = 0;
 
   if (mClosed)
     return NS_ERROR_FAILURE;
 
   SetWriteCallbacks();
@@ -1608,18 +1599,18 @@ SpdySession2::WriteSegments(nsAHttpSegme
   // We buffer the first 8 bytes of data frames (the header) but
   // the actual data is passed through unprocessed.
   
   if (mDownstreamState == BUFFERING_FRAME_HEADER) {
     // The first 8 bytes of every frame is header information that
     // we are going to want to strip before passing to http. That is
     // true of both control and data packets.
     
-    NS_ABORT_IF_FALSE(mInputFrameBufferUsed < 8,
-                      "Frame Buffer Used Too Large for State");
+    MOZ_ASSERT(mInputFrameBufferUsed < 8,
+               "Frame Buffer Used Too Large for State");
 
     rv = NetworkRead(writer, mInputFrameBuffer + mInputFrameBufferUsed,
                      8 - mInputFrameBufferUsed, countWritten);
 
     if (NS_FAILED(rv)) {
       LOG3(("SpdySession2 %p buffering frame header read failure %x\n",
             this, rv));
       // maybe just blocked reading from network
@@ -1736,17 +1727,17 @@ SpdySession2::WriteSegments(nsAHttpSegme
     return NS_OK;
   }
 
   if (mDownstreamState == PROCESSING_DATA_FRAME ||
       mDownstreamState == PROCESSING_CONTROL_SYN_REPLY) {
 
     // The cleanup stream should only be set while stream->WriteSegments is
     // on the stack and then cleaned up in this code block afterwards.
-    NS_ABORT_IF_FALSE(!mNeedsCleanup, "cleanup stream set unexpectedly");
+    MOZ_ASSERT(!mNeedsCleanup, "cleanup stream set unexpectedly");
     mNeedsCleanup = nullptr;                     /* just in case */
 
     mSegmentWriter = writer;
     rv = mInputFrameDataStream->WriteSegments(this, count, countWritten);
     mSegmentWriter = nullptr;
 
     mLastDataReadEpoch = mLastReadEpoch;
 
@@ -1757,17 +1748,17 @@ SpdySession2::WriteSegments(nsAHttpSegme
       if (mInputFrameDataRead == mInputFrameDataSize)
         ResetDownstreamState();
       LOG3(("SpdySession2::WriteSegments session=%p stream=%p 0x%X "
             "needscleanup=%p. cleanup stream based on "
             "stream->writeSegments returning BASE_STREAM_CLOSED\n",
             this, stream, stream ? stream->StreamID() : 0,
             mNeedsCleanup));
       CleanupStream(stream, NS_OK, RST_CANCEL);
-      NS_ABORT_IF_FALSE(!mNeedsCleanup, "double cleanup out of data frame");
+      MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame");
       mNeedsCleanup = nullptr;                     /* just in case */
       return NS_OK;
     }
     
     if (mNeedsCleanup) {
       LOG3(("SpdySession2::WriteSegments session=%p stream=%p 0x%X "
             "cleanup stream based on mNeedsCleanup.\n",
             this, mNeedsCleanup, mNeedsCleanup ? mNeedsCleanup->StreamID() : 0));
@@ -1806,22 +1797,22 @@ SpdySession2::WriteSegments(nsAHttpSegme
 
     if (mInputFrameDataRead == mInputFrameDataSize)
       ResetDownstreamState();
     return rv;
   }
   
   if (mDownstreamState != BUFFERING_CONTROL_FRAME) {
     // this cannot happen
-    NS_ABORT_IF_FALSE(false, "Not in Bufering Control Frame State");
+    MOZ_ASSERT(false, "Not in Bufering Control Frame State");
     return NS_ERROR_UNEXPECTED;
   }
 
-  NS_ABORT_IF_FALSE(mInputFrameBufferUsed == 8,
-                    "Frame Buffer Header Not Present");
+  MOZ_ASSERT(mInputFrameBufferUsed == 8,
+             "Frame Buffer Header Not Present");
 
   rv = NetworkRead(writer, mInputFrameBuffer + 8 + mInputFrameDataRead,
                    mInputFrameDataSize - mInputFrameDataRead, countWritten);
 
   if (NS_FAILED(rv)) {
     LOG3(("SpdySession2 %p buffering control frame read failure %x\n",
           this, rv));
     // maybe just blocked reading from network
@@ -1839,34 +1830,34 @@ SpdySession2::WriteSegments(nsAHttpSegme
     return NS_OK;
 
   // This check is actually redundant, the control type was previously
   // checked to make sure it was in range, but we will check it again
   // at time of use to make sure a regression doesn't creep in.
   if (mFrameControlType >= CONTROL_TYPE_LAST ||
       mFrameControlType <= CONTROL_TYPE_FIRST) 
   {
-    NS_ABORT_IF_FALSE(false, "control type out of range");
+    MOZ_ASSERT(false, "control type out of range");
     return NS_ERROR_ILLEGAL_VALUE;
   }
   rv = sControlFunctions[mFrameControlType](this);
 
-  NS_ABORT_IF_FALSE(NS_FAILED(rv) ||
-                    mDownstreamState != BUFFERING_CONTROL_FRAME,
-                    "Control Handler returned OK but did not change state");
+  MOZ_ASSERT(NS_FAILED(rv) ||
+             mDownstreamState != BUFFERING_CONTROL_FRAME,
+             "Control Handler returned OK but did not change state");
 
   if (mShouldGoAway && !mStreamTransactionHash.Count())
     Close(NS_OK);
   return rv;
 }
 
 void
 SpdySession2::Close(nsresult aReason)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   if (mClosed)
     return;
 
   LOG3(("SpdySession2::Close %p %X", this, aReason));
 
   mClosed = true;
 
@@ -1880,17 +1871,17 @@ SpdySession2::Close(nsresult aReason)
   mSegmentReader = nullptr;
   mSegmentWriter = nullptr;
 }
 
 void
 SpdySession2::CloseTransaction(nsAHttpTransaction *aTransaction,
                               nsresult aResult)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::CloseTransaction %p %p %x", this, aTransaction, aResult));
 
   // Generally this arrives as a cancel event from the connection manager.
 
   // need to find the stream and call CleanupStream() on it.
   SpdyStream2 *stream = mStreamTransactionHash.Get(aTransaction);
   if (!stream) {
     LOG3(("SpdySession2::CloseTransaction %p %p %x - not found.",
@@ -1909,17 +1900,17 @@ SpdySession2::CloseTransaction(nsAHttpTr
 // nsAHttpSegmentReader
 //-----------------------------------------------------------------------------
 
 nsresult
 SpdySession2::OnReadSegment(const char *buf,
                            uint32_t count,
                            uint32_t *countRead)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv;
   
   // If we can release old queued data then we can try and write the new
   // data directly to the network without using the output queue at all
   if (mOutputQueueUsed)
     FlushOutputQueue();
 
@@ -1991,33 +1982,32 @@ SpdySession2::CommitToSegmentSize(uint32
     if ((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved))
       return NS_OK;
   }
 
   // resize the buffers as needed
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + count + kQueueReserved,
                mOutputQueueUsed, mOutputQueueSize);
 
-  NS_ABORT_IF_FALSE((mOutputQueueUsed + count) <=
-                    (mOutputQueueSize - kQueueReserved),
-                    "buffer not as large as expected");
+  MOZ_ASSERT((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved),
+             "buffer not as large as expected");
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsAHttpSegmentWriter
 //-----------------------------------------------------------------------------
 
 nsresult
 SpdySession2::OnWriteSegment(char *buf,
                             uint32_t count,
                             uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   nsresult rv;
 
   if (!mSegmentWriter) {
     // the only way this could happen would be if Close() were called on the
     // stack with WriteSegments()
     return NS_ERROR_FAILURE;
   }
   
@@ -2077,29 +2067,29 @@ SpdySession2::OnWriteSegment(char *buf,
 void
 SpdySession2::SetNeedsCleanup()
 {
   LOG3(("SpdySession2::SetNeedsCleanup %p - recorded downstream fin of "
         "stream %p 0x%X", this, mInputFrameDataStream,
         mInputFrameDataStream->StreamID()));
 
   // This will result in Close() being called
-  NS_ABORT_IF_FALSE(!mNeedsCleanup, "mNeedsCleanup unexpectedly set");
+  MOZ_ASSERT(!mNeedsCleanup, "mNeedsCleanup unexpectedly set");
   mNeedsCleanup = mInputFrameDataStream;
   ResetDownstreamState();
 }
 
 //-----------------------------------------------------------------------------
 // Modified methods of nsAHttpConnection
 //-----------------------------------------------------------------------------
 
 void
 SpdySession2::TransactionHasDataToWrite(nsAHttpTransaction *caller)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::TransactionHasDataToWrite %p trans=%p", this, caller));
 
   // a trapped signal from the http transaction to the connection that
   // it is no longer blocked on read.
 
   SpdyStream2 *stream = mStreamTransactionHash.Get(caller);
   if (!stream || !VerifyStream(stream)) {
     LOG3(("SpdySession2::TransactionHasDataToWrite %p caller %p not found",
@@ -2111,17 +2101,17 @@ SpdySession2::TransactionHasDataToWrite(
         this, stream->StreamID()));
 
   mReadyForWrite.Push(stream);
 }
 
 void
 SpdySession2::TransactionHasDataToWrite(SpdyStream2 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession2::TransactionHasDataToWrite %p stream=%p ID=%x",
         this, stream, stream->StreamID()));
 
   mReadyForWrite.Push(stream);
   SetWriteCallbacks();
 }
 
 bool
@@ -2130,24 +2120,24 @@ SpdySession2::IsPersistent()
   return true;
 }
 
 nsresult
 SpdySession2::TakeTransport(nsISocketTransport **,
                            nsIAsyncInputStream **,
                            nsIAsyncOutputStream **)
 {
-  NS_ABORT_IF_FALSE(false, "TakeTransport of SpdySession2");
+  MOZ_ASSERT(false, "TakeTransport of SpdySession2");
   return NS_ERROR_UNEXPECTED;
 }
 
 nsHttpConnection *
 SpdySession2::TakeHttpConnection()
 {
-  NS_ABORT_IF_FALSE(false, "TakeHttpConnection of SpdySession2");
+  MOZ_ASSERT(false, "TakeHttpConnection of SpdySession2");
   return nullptr;
 }
 
 uint32_t
 SpdySession2::CancelPipeline(nsresult reason)
 {
   // we don't pipeline inside spdy, so this isn't an issue
   return 0;
@@ -2166,66 +2156,66 @@ SpdySession2::Classification()
 // We can be sure of this because SpdySession2 is only constructed in
 // nsHttpConnection and is never passed out of that object
 //-----------------------------------------------------------------------------
 
 void
 SpdySession2::SetConnection(nsAHttpConnection *)
 {
   // This is unexpected
-  NS_ABORT_IF_FALSE(false, "SpdySession2::SetConnection()");
+  MOZ_ASSERT(false, "SpdySession2::SetConnection()");
 }
 
 void
 SpdySession2::GetSecurityCallbacks(nsIInterfaceRequestor **)
 {
   // This is unexpected
-  NS_ABORT_IF_FALSE(false, "SpdySession2::GetSecurityCallbacks()");
+  MOZ_ASSERT(false, "SpdySession2::GetSecurityCallbacks()");
 }
 
 void
 SpdySession2::SetProxyConnectFailed()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession2::SetProxyConnectFailed()");
+  MOZ_ASSERT(false, "SpdySession2::SetProxyConnectFailed()");
 }
 
 bool
 SpdySession2::IsDone()
 {
   return !mStreamTransactionHash.Count();
 }
 
 nsresult
 SpdySession2::Status()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession2::Status()");
+  MOZ_ASSERT(false, "SpdySession2::Status()");
   return NS_ERROR_UNEXPECTED;
 }
 
 uint32_t
 SpdySession2::Caps()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession2::Caps()");
+  MOZ_ASSERT(false, "SpdySession2::Caps()");
   return 0;
 }
 
 uint64_t
 SpdySession2::Available()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession2::Available()");
+  MOZ_ASSERT(false, "SpdySession2::Available()");
   return 0;
 }
 
 nsHttpRequestHead *
 SpdySession2::RequestHead()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession2::RequestHead() "
-                    "should not be called after SPDY is setup");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(false,
+             "SpdySession2::RequestHead() "
+             "should not be called after SPDY is setup");
   return NULL;
 }
 
 uint32_t
 SpdySession2::Http1xTransactionCount()
 {
   return 0;
 }
@@ -2265,36 +2255,36 @@ SpdySession2::TakeSubTransactions(
 }
 
 nsresult
 SpdySession2::AddTransaction(nsAHttpTransaction *)
 {
   // This API is meant for pipelining, SpdySession2's should be
   // extended with AddStream()
 
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession2::AddTransaction() should not be called");
+  MOZ_ASSERT(false,
+             "SpdySession2::AddTransaction() should not be called");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 uint32_t
 SpdySession2::PipelineDepth()
 {
   return IsDone() ? 0 : 1;
 }
 
 nsresult
 SpdySession2::SetPipelinePosition(int32_t position)
 {
   // This API is meant for pipelining, SpdySession2's should be
   // extended with AddStream()
 
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession2::SetPipelinePosition() should not be called");
+  MOZ_ASSERT(false,
+             "SpdySession2::SetPipelinePosition() should not be called");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 int32_t
 SpdySession2::PipelinePosition()
 {
     return 0;
@@ -2302,17 +2292,17 @@ SpdySession2::PipelinePosition()
 
 //-----------------------------------------------------------------------------
 // Pass through methods of nsAHttpConnection
 //-----------------------------------------------------------------------------
 
 nsAHttpConnection *
 SpdySession2::Connection()
 {
-  NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   return mConnection;
 }
 
 nsresult
 SpdySession2::OnHeadersAvailable(nsAHttpTransaction *transaction,
                                 nsHttpRequestHead *requestHead,
                                 nsHttpResponseHead *responseHead,
                                 bool *reset)
--- a/netwerk/protocol/http/SpdySession3.cpp
+++ b/netwerk/protocol/http/SpdySession3.cpp
@@ -58,17 +58,17 @@ SpdySession3::SpdySession3(nsAHttpTransa
     mServerInitialWindow(kDefaultServerRwin),
     mOutputQueueSize(kDefaultQueueSize),
     mOutputQueueUsed(0),
     mOutputQueueSent(0),
     mLastReadEpoch(PR_IntervalNow()),
     mPingSentEpoch(0),
     mNextPingID(1)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdySession3::SpdySession3 %p transaction 1 = %p",
         this, aHttpTransaction));
   
   mStreamIDHash.Init();
   mStreamTransactionHash.Init();
   mConnection = aHttpTransaction->Connection();
   mInputFrameBuffer = new char[mInputFrameBufferSize];
@@ -188,17 +188,17 @@ static Control_FX sControlFunctions[] =
   SpdySession3::HandleGoAway,
   SpdySession3::HandleHeaders,
   SpdySession3::HandleWindowUpdate
 };
 
 bool
 SpdySession3::RoomForMoreConcurrent()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   return (mConcurrent < mMaxConcurrent);
 }
 
 bool
 SpdySession3::RoomForMoreStreams()
 {
   if (mNextStreamID + mStreamTransactionHash.Count() * 2 > kMaxStreamID)
@@ -211,18 +211,18 @@ PRIntervalTime
 SpdySession3::IdleTime()
 {
   return PR_IntervalNow() - mLastDataReadEpoch;
 }
 
 void
 SpdySession3::ReadTimeoutTick(PRIntervalTime now)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(mNextPingID & 1, "Ping Counter Not Odd");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mNextPingID & 1, "Ping Counter Not Odd");
 
     if (!mPingThreshold)
       return;
 
     LOG(("SpdySession3::ReadTimeoutTick %p delta since last read %ds\n",
          this, PR_IntervalToSeconds(now - mLastReadEpoch)));
 
     if ((now - mLastReadEpoch) < mPingThreshold) {
@@ -264,55 +264,55 @@ SpdySession3::ReadTimeoutTick(PRInterval
            "ping ids exhausted marking goaway\n", this));
       mShouldGoAway = true;
     }
 }
 
 uint32_t
 SpdySession3::RegisterStreamID(SpdyStream3 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdySession3::RegisterStreamID session=%p stream=%p id=0x%X "
         "concurrent=%d",this, stream, mNextStreamID, mConcurrent));
 
-  NS_ABORT_IF_FALSE(mNextStreamID < 0xfffffff0,
-                    "should have stopped admitting streams");
+  MOZ_ASSERT(mNextStreamID < 0xfffffff0,
+             "should have stopped admitting streams");
   
   uint32_t result = mNextStreamID;
   mNextStreamID += 2;
 
   // We've used up plenty of ID's on this session. Start
   // moving to a new one before there is a crunch involving
   // server push streams or concurrent non-registered submits
   if (mNextStreamID >= kMaxStreamID)
     mShouldGoAway = true;
 
   // integrity check
   if (mStreamIDHash.Get(result)) {
     LOG3(("   New ID already present\n"));
-    NS_ABORT_IF_FALSE(false, "New ID already present in mStreamIDHash");
+    MOZ_ASSERT(false, "New ID already present in mStreamIDHash");
     mShouldGoAway = true;
     return kDeadStreamID;
   }
 
   mStreamIDHash.Put(result, stream);
   return result;
 }
 
 bool
 SpdySession3::AddStream(nsAHttpTransaction *aHttpTransaction,
                        int32_t aPriority)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   // integrity check
   if (mStreamTransactionHash.Get(aHttpTransaction)) {
     LOG3(("   New transaction already present\n"));
-    NS_ABORT_IF_FALSE(false, "AddStream duplicate transaction pointer");
+    MOZ_ASSERT(false, "AddStream duplicate transaction pointer");
     return false;
   }
 
   aHttpTransaction->SetConnection(this);
   SpdyStream3 *stream = new SpdyStream3(aHttpTransaction,
                                       this,
                                       mSocketTransport,
                                       mSendingChunkSize,
@@ -336,17 +336,17 @@ SpdySession3::AddStream(nsAHttpTransacti
   }
   
   return true;
 }
 
 void
 SpdySession3::ActivateStream(SpdyStream3 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   mConcurrent++;
   if (mConcurrent > mConcurrentHighWater)
     mConcurrentHighWater = mConcurrent;
   LOG3(("SpdySession3::AddStream %p activating stream %p Currently %d "
         "streams in session, high water mark is %d",
         this, stream, mConcurrent, mConcurrentHighWater));
 
@@ -360,33 +360,33 @@ SpdySession3::ActivateStream(SpdyStream3
     uint32_t countRead;
     ReadSegments(nullptr, kDefaultBufferSize, &countRead);
   }
 }
 
 void
 SpdySession3::ProcessPending()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   while (RoomForMoreConcurrent()) {
     SpdyStream3 *stream = static_cast<SpdyStream3 *>(mQueuedStreams.PopFront());
     if (!stream)
       return;
     LOG3(("SpdySession3::ProcessPending %p stream %p activated from queue.",
           this, stream));
     ActivateStream(stream);
   }
 }
 
 nsresult
 SpdySession3::NetworkRead(nsAHttpSegmentWriter *writer, char *buf,
                          uint32_t count, uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   if (!count) {
     *countWritten = 0;
     return NS_OK;
   }
 
   nsresult rv = writer->OnWriteSegment(buf, count, countWritten);
   if (NS_SUCCEEDED(rv) && *countWritten > 0)
@@ -454,35 +454,35 @@ SpdySession3::DontReuse()
   mShouldGoAway = true;
   if (!mStreamTransactionHash.Count())
     Close(NS_OK);
 }
 
 uint32_t
 SpdySession3::GetWriteQueueSize()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   return mReadyForWrite.GetSize();
 }
 
 void
 SpdySession3::ChangeDownstreamState(enum stateType newState)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream3::ChangeDownstreamState() %p from %X to %X",
         this, mDownstreamState, newState));
   mDownstreamState = newState;
 }
 
 void
 SpdySession3::ResetDownstreamState()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream3::ResetDownstreamState() %p", this));
   ChangeDownstreamState(BUFFERING_FRAME_HEADER);
 
   if (mInputFrameDataLast && mInputFrameDataStream) {
     mInputFrameDataLast = false;
     if (!mInputFrameDataStream->RecvdFin()) {
       mInputFrameDataStream->SetRecvdFin(true);
@@ -582,17 +582,17 @@ SpdySession3::UncompressAndDiscard(uint3
   }
   while (mDownstreamZlib.avail_in);
   return NS_OK;
 }
 
 void
 SpdySession3::GeneratePing(uint32_t aID)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::GeneratePing %p 0x%X\n", this, aID));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 12;
 
   packet[0] = kFlag_Control;
@@ -609,17 +609,17 @@ SpdySession3::GeneratePing(uint32_t aID)
 
   LogIO(this, nullptr, "Generate Ping", packet, 12);
   FlushOutputQueue();
 }
 
 void
 SpdySession3::GenerateRstStream(uint32_t aStatusCode, uint32_t aID)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::GenerateRst %p 0x%X %d\n", this, aID, aStatusCode));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 16;
 
   packet[0] = kFlag_Control;
@@ -638,17 +638,17 @@ SpdySession3::GenerateRstStream(uint32_t
 
   LogIO(this, nullptr, "Generate Reset", packet, 16);
   FlushOutputQueue();
 }
 
 void
 SpdySession3::GenerateGoAway(uint32_t aStatusCode)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::GenerateGoAway %p code=%X\n", this, aStatusCode));
 
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
   mOutputQueueUsed += 16;
 
   memset(packet, 0, 16);
@@ -666,17 +666,17 @@ SpdySession3::GenerateGoAway(uint32_t aS
 
   LogIO(this, nullptr, "Generate GoAway", packet, 16);
   FlushOutputQueue();
 }
 
 void
 SpdySession3::GenerateSettings()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::GenerateSettings %p\n", this));
 
   static const uint32_t maxDataLen = 4 + 3 * 8; // sized for 3 settings
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 8 + maxDataLen,
                mOutputQueueUsed, mOutputQueueSize);
   char *packet = mOutputQueueBuffer.get() + mOutputQueueUsed;
 
   memset(packet, 0, 8 + maxDataLen);
@@ -726,17 +726,17 @@ SpdySession3::GenerateSettings()
 }
 
 // perform a bunch of integrity checks on the stream.
 // returns true if passed, false (plus LOG and ABORT) if failed.
 bool
 SpdySession3::VerifyStream(SpdyStream3 *aStream, uint32_t aOptionalID = 0)
 {
   // This is annoying, but at least it is O(1)
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
 #ifndef DEBUG
   // Only do the real verification in debug builds
   return true;
 #endif
 
   if (!aStream)
     return true;
@@ -774,25 +774,25 @@ SpdySession3::VerifyStream(SpdyStream3 *
     // tests passed
     return true;
   } while (0);
 
   LOG(("SpdySession3 %p VerifyStream Failure %p stream->id=0x%X "
        "optionalID=0x%X trans=%p test=%d\n",
        this, aStream, aStream->StreamID(),
        aOptionalID, aStream->Transaction(), test));
-  NS_ABORT_IF_FALSE(false, "VerifyStream");
+  MOZ_ASSERT(false, "VerifyStream");
   return false;
 }
 
 void
 SpdySession3::CleanupStream(SpdyStream3 *aStream, nsresult aResult,
                            rstReason aResetCode)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::CleanupStream %p %p 0x%X %X\n",
         this, aStream, aStream->StreamID(), aResult));
 
   if (!VerifyStream(aStream)) {
     LOG(("SpdySession3::CleanupStream failed to verify stream\n"));
     return;
   }
 
@@ -817,17 +817,17 @@ SpdySession3::CleanupStream(SpdyStream3 
 
   if (mShouldGoAway && !mStreamTransactionHash.Count())
     Close(NS_OK);
 }
 
 void
 SpdySession3::CloseStream(SpdyStream3 *aStream, nsresult aResult)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::CloseStream %p %p 0x%x %X\n",
         this, aStream, aStream->StreamID(), aResult));
 
   // Check if partial frame reader
   if (aStream == mInputFrameDataStream) {
     LOG3(("Stream had active partial read frame on close"));
     ChangeDownstreamState(DISCARDING_DATA_FRAME);
     mInputFrameDataStream = nullptr;
@@ -853,18 +853,17 @@ SpdySession3::CloseStream(SpdyStream3 *a
 
   // Send the stream the close() indication
   aStream->Close(aResult);
 }
 
 nsresult
 SpdySession3::HandleSynStream(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM);
   
   if (self->mInputFrameDataSize < 18) {
     LOG3(("SpdySession3::HandleSynStream %p SYN_STREAM too short data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t streamID =
@@ -915,18 +914,17 @@ SpdySession3::SetInputFrameDataStream(ui
        streamID));
   mInputFrameDataStream = nullptr;
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
 SpdySession3::HandleSynReply(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY);
 
   if (self->mInputFrameDataSize < 4) {
     LOG3(("SpdySession3::HandleSynReply %p SYN REPLY too short data=%d",
           self, self->mInputFrameDataSize));
     // A framing error is a session wide error that cannot be recovered
     return NS_ERROR_ILLEGAL_VALUE;
   }
   
@@ -1049,18 +1047,17 @@ SpdySession3::ResponseHeadersComplete()
 
   ChangeDownstreamState(PROCESSING_COMPLETE_HEADERS);
   return NS_OK;
 }
 
 nsresult
 SpdySession3::HandleRstStream(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_RST_STREAM,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_RST_STREAM);
 
   if (self->mInputFrameDataSize != 8) {
     LOG3(("SpdySession3::HandleRstStream %p RST_STREAM wrong length data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint8_t flags = reinterpret_cast<uint8_t *>(self->mInputFrameBuffer.get())[4];
@@ -1115,18 +1112,17 @@ SpdySession3::UpdateServerRwinEnumerator
   int32_t delta = *(static_cast<int32_t *>(closure));
   stream->UpdateRemoteWindow(delta);
   return PL_DHASH_NEXT;
 }
 
 nsresult
 SpdySession3::HandleSettings(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SETTINGS,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SETTINGS);
 
   if (self->mInputFrameDataSize < 4) {
     LOG3(("SpdySession3::HandleSettings %p SETTINGS wrong length data=%d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t numEntries =
@@ -1208,33 +1204,31 @@ SpdySession3::HandleSettings(SpdySession
   
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession3::HandleNoop(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_NOOP,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_NOOP);
 
   // Should not be receiving noop frames in spdy/3, so we'll just
   // make a log and ignore it
 
   LOG3(("SpdySession3::HandleNoop %p NOP.", self));
 
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession3::HandlePing(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_PING,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_PING);
 
   if (self->mInputFrameDataSize != 4) {
     LOG3(("SpdySession3::HandlePing %p PING had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t pingID =
@@ -1253,18 +1247,17 @@ SpdySession3::HandlePing(SpdySession3 *s
     
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession3::HandleGoAway(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_GOAWAY,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_GOAWAY);
 
   if (self->mInputFrameDataSize != 8) {
     LOG3(("SpdySession3::HandleGoAway %p GOAWAY had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   self->mShouldGoAway = true;
@@ -1308,18 +1301,17 @@ SpdySession3::HandleGoAway(SpdySession3 
   self->ResumeRecv();
   self->ResetDownstreamState();
   return NS_OK;
 }
 
 nsresult
 SpdySession3::HandleHeaders(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_HEADERS,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_HEADERS);
 
   if (self->mInputFrameDataSize < 4) {
     LOG3(("SpdySession3::HandleHeaders %p HEADERS had wrong amount of data %d",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t streamID =
@@ -1387,18 +1379,17 @@ SpdySession3::HandleHeaders(SpdySession3
     rv = NS_OK;
   }
   return rv;
 }
 
 nsresult
 SpdySession3::HandleWindowUpdate(SpdySession3 *self)
 {
-  NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE,
-                    "wrong control type");
+  MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE);
 
   if (self->mInputFrameDataSize < 8) {
     LOG3(("SpdySession3::HandleWindowUpdate %p Window Update wrong length %d\n",
           self, self->mInputFrameDataSize));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   uint32_t delta =
@@ -1447,17 +1438,17 @@ SpdySession3::HandleWindowUpdate(SpdySes
 // of these methods
 //-----------------------------------------------------------------------------
 
 void
 SpdySession3::OnTransportStatus(nsITransport* aTransport,
                                nsresult aStatus,
                                uint64_t aProgress)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   switch (aStatus) {
     // These should appear only once, deliver to the first
     // transaction on the session.
   case NS_NET_STATUS_RESOLVING_HOST:
   case NS_NET_STATUS_RESOLVED_HOST:
   case NS_NET_STATUS_CONNECTING_TO:
   case NS_NET_STATUS_CONNECTED_TO:
@@ -1502,20 +1493,20 @@ SpdySession3::OnTransportStatus(nsITrans
 // converted to SPDY data. Sometimes control data like window-update are
 // generated instead.
 
 nsresult
 SpdySession3::ReadSegments(nsAHttpSegmentReader *reader,
                           uint32_t count,
                           uint32_t *countRead)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
-  NS_ABORT_IF_FALSE(!mSegmentReader || !reader || (mSegmentReader == reader),
-                    "Inconsistent Write Function Callback");
+  MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader),
+             "Inconsistent Write Function Callback");
 
   if (reader)
     mSegmentReader = reader;
 
   nsresult rv;
   *countRead = 0;
 
   LOG3(("SpdySession3::ReadSegments %p", this));
@@ -1608,17 +1599,17 @@ SpdySession3::ReadSegments(nsAHttpSegmen
 // call stream->WriteSegemnts which can call this::OnWriteSegment to get the
 // data. It always gets full frames if they are part of the stream
 
 nsresult
 SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer,
                            uint32_t count,
                            uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv;
   *countWritten = 0;
 
   if (mClosed)
     return NS_ERROR_FAILURE;
 
   SetWriteCallbacks();
@@ -1627,18 +1618,18 @@ SpdySession3::WriteSegments(nsAHttpSegme
   // We buffer the first 8 bytes of data frames (the header) but
   // the actual data is passed through unprocessed.
   
   if (mDownstreamState == BUFFERING_FRAME_HEADER) {
     // The first 8 bytes of every frame is header information that
     // we are going to want to strip before passing to http. That is
     // true of both control and data packets.
     
-    NS_ABORT_IF_FALSE(mInputFrameBufferUsed < 8,
-                      "Frame Buffer Used Too Large for State");
+    MOZ_ASSERT(mInputFrameBufferUsed < 8,
+               "Frame Buffer Used Too Large for State");
 
     rv = NetworkRead(writer, mInputFrameBuffer + mInputFrameBufferUsed,
                      8 - mInputFrameBufferUsed, countWritten);
 
     if (NS_FAILED(rv)) {
       LOG3(("SpdySession3 %p buffering frame header read failure %x\n",
             this, rv));
       // maybe just blocked reading from network
@@ -1774,17 +1765,17 @@ SpdySession3::WriteSegments(nsAHttpSegme
     return NS_OK;
   }
 
   if (mDownstreamState == PROCESSING_DATA_FRAME ||
       mDownstreamState == PROCESSING_COMPLETE_HEADERS) {
 
     // The cleanup stream should only be set while stream->WriteSegments is
     // on the stack and then cleaned up in this code block afterwards.
-    NS_ABORT_IF_FALSE(!mNeedsCleanup, "cleanup stream set unexpectedly");
+    MOZ_ASSERT(!mNeedsCleanup, "cleanup stream set unexpectedly");
     mNeedsCleanup = nullptr;                     /* just in case */
 
     mSegmentWriter = writer;
     rv = mInputFrameDataStream->WriteSegments(this, count, countWritten);
     mSegmentWriter = nullptr;
 
     mLastDataReadEpoch = mLastReadEpoch;
 
@@ -1800,17 +1791,17 @@ SpdySession3::WriteSegments(nsAHttpSegme
       if (mInputFrameDataRead == mInputFrameDataSize)
         ResetDownstreamState();
       LOG3(("SpdySession3::WriteSegments session=%p stream=%p 0x%X "
             "needscleanup=%p. cleanup stream based on "
             "stream->writeSegments returning BASE_STREAM_CLOSED\n",
             this, stream, stream ? stream->StreamID() : 0,
             mNeedsCleanup));
       CleanupStream(stream, NS_OK, RST_CANCEL);
-      NS_ABORT_IF_FALSE(!mNeedsCleanup, "double cleanup out of data frame");
+      MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame");
       mNeedsCleanup = nullptr;                     /* just in case */
       return NS_OK;
     }
     
     if (mNeedsCleanup) {
       LOG3(("SpdySession3::WriteSegments session=%p stream=%p 0x%X "
             "cleanup stream based on mNeedsCleanup.\n",
             this, mNeedsCleanup, mNeedsCleanup ? mNeedsCleanup->StreamID() : 0));
@@ -1847,22 +1838,22 @@ SpdySession3::WriteSegments(nsAHttpSegme
 
     if (mInputFrameDataRead == mInputFrameDataSize)
       ResetDownstreamState();
     return rv;
   }
   
   if (mDownstreamState != BUFFERING_CONTROL_FRAME) {
     // this cannot happen
-    NS_ABORT_IF_FALSE(false, "Not in Bufering Control Frame State");
+    MOZ_ASSERT(false, "Not in Bufering Control Frame State");
     return NS_ERROR_UNEXPECTED;
   }
 
-  NS_ABORT_IF_FALSE(mInputFrameBufferUsed == 8,
-                    "Frame Buffer Header Not Present");
+  MOZ_ASSERT(mInputFrameBufferUsed == 8,
+             "Frame Buffer Header Not Present");
 
   rv = NetworkRead(writer, mInputFrameBuffer + 8 + mInputFrameDataRead,
                    mInputFrameDataSize - mInputFrameDataRead, countWritten);
 
   if (NS_FAILED(rv)) {
     LOG3(("SpdySession3 %p buffering control frame read failure %x\n",
           this, rv));
     // maybe just blocked reading from network
@@ -1880,24 +1871,24 @@ SpdySession3::WriteSegments(nsAHttpSegme
     return NS_OK;
 
   // This check is actually redundant, the control type was previously
   // checked to make sure it was in range, but we will check it again
   // at time of use to make sure a regression doesn't creep in.
   if (mFrameControlType >= CONTROL_TYPE_LAST ||
       mFrameControlType <= CONTROL_TYPE_FIRST) 
   {
-    NS_ABORT_IF_FALSE(false, "control type out of range");
+    MOZ_ASSERT(false, "control type out of range");
     return NS_ERROR_ILLEGAL_VALUE;
   }
   rv = sControlFunctions[mFrameControlType](this);
 
-  NS_ABORT_IF_FALSE(NS_FAILED(rv) ||
-                    mDownstreamState != BUFFERING_CONTROL_FRAME,
-                    "Control Handler returned OK but did not change state");
+  MOZ_ASSERT(NS_FAILED(rv) ||
+             mDownstreamState != BUFFERING_CONTROL_FRAME,
+             "Control Handler returned OK but did not change state");
 
   if (mShouldGoAway && !mStreamTransactionHash.Count())
     Close(NS_OK);
   return rv;
 }
 
 void
 SpdySession3::UpdateLocalRwin(SpdyStream3 *stream,
@@ -1951,17 +1942,17 @@ SpdySession3::UpdateLocalRwin(SpdyStream
 
   LogIO(this, stream, "Window Update", packet, 8 + dataLen);
   FlushOutputQueue();
 }
 
 void
 SpdySession3::Close(nsresult aReason)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   if (mClosed)
     return;
 
   LOG3(("SpdySession3::Close %p %X", this, aReason));
 
   mClosed = true;
 
@@ -1975,17 +1966,17 @@ SpdySession3::Close(nsresult aReason)
   mSegmentReader = nullptr;
   mSegmentWriter = nullptr;
 }
 
 void
 SpdySession3::CloseTransaction(nsAHttpTransaction *aTransaction,
                               nsresult aResult)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::CloseTransaction %p %p %x", this, aTransaction, aResult));
 
   // Generally this arrives as a cancel event from the connection manager.
 
   // need to find the stream and call CleanupStream() on it.
   SpdyStream3 *stream = mStreamTransactionHash.Get(aTransaction);
   if (!stream) {
     LOG3(("SpdySession3::CloseTransaction %p %p %x - not found.",
@@ -2004,17 +1995,17 @@ SpdySession3::CloseTransaction(nsAHttpTr
 // nsAHttpSegmentReader
 //-----------------------------------------------------------------------------
 
 nsresult
 SpdySession3::OnReadSegment(const char *buf,
                            uint32_t count,
                            uint32_t *countRead)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv;
   
   // If we can release old queued data then we can try and write the new
   // data directly to the network without using the output queue at all
   if (mOutputQueueUsed)
     FlushOutputQueue();
 
@@ -2086,33 +2077,32 @@ SpdySession3::CommitToSegmentSize(uint32
     if ((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved))
       return NS_OK;
   }
 
   // resize the buffers as needed
   EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + count + kQueueReserved,
                mOutputQueueUsed, mOutputQueueSize);
 
-  NS_ABORT_IF_FALSE((mOutputQueueUsed + count) <=
-                    (mOutputQueueSize - kQueueReserved),
-                    "buffer not as large as expected");
+  MOZ_ASSERT((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved),
+             "buffer not as large as expected");
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsAHttpSegmentWriter
 //-----------------------------------------------------------------------------
 
 nsresult
 SpdySession3::OnWriteSegment(char *buf,
                             uint32_t count,
                             uint32_t *countWritten)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   nsresult rv;
 
   if (!mSegmentWriter) {
     // the only way this could happen would be if Close() were called on the
     // stack with WriteSegments()
     return NS_ERROR_FAILURE;
   }
   
@@ -2186,29 +2176,29 @@ SpdySession3::OnWriteSegment(char *buf,
 void
 SpdySession3::SetNeedsCleanup()
 {
   LOG3(("SpdySession3::SetNeedsCleanup %p - recorded downstream fin of "
         "stream %p 0x%X", this, mInputFrameDataStream,
         mInputFrameDataStream->StreamID()));
 
   // This will result in Close() being called
-  NS_ABORT_IF_FALSE(!mNeedsCleanup, "mNeedsCleanup unexpectedly set");
+  MOZ_ASSERT(!mNeedsCleanup, "mNeedsCleanup unexpectedly set");
   mNeedsCleanup = mInputFrameDataStream;
   ResetDownstreamState();
 }
 
 //-----------------------------------------------------------------------------
 // Modified methods of nsAHttpConnection
 //-----------------------------------------------------------------------------
 
 void
 SpdySession3::TransactionHasDataToWrite(nsAHttpTransaction *caller)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::TransactionHasDataToWrite %p trans=%p", this, caller));
 
   // a trapped signal from the http transaction to the connection that
   // it is no longer blocked on read.
 
   SpdyStream3 *stream = mStreamTransactionHash.Get(caller);
   if (!stream || !VerifyStream(stream)) {
     LOG3(("SpdySession3::TransactionHasDataToWrite %p caller %p not found",
@@ -2220,17 +2210,17 @@ SpdySession3::TransactionHasDataToWrite(
         this, stream->StreamID()));
 
   mReadyForWrite.Push(stream);
 }
 
 void
 SpdySession3::TransactionHasDataToWrite(SpdyStream3 *stream)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   LOG3(("SpdySession3::TransactionHasDataToWrite %p stream=%p ID=%x",
         this, stream, stream->StreamID()));
 
   mReadyForWrite.Push(stream);
   SetWriteCallbacks();
 }
 
 bool
@@ -2239,24 +2229,24 @@ SpdySession3::IsPersistent()
   return true;
 }
 
 nsresult
 SpdySession3::TakeTransport(nsISocketTransport **,
                            nsIAsyncInputStream **,
                            nsIAsyncOutputStream **)
 {
-  NS_ABORT_IF_FALSE(false, "TakeTransport of SpdySession3");
+  MOZ_ASSERT(false, "TakeTransport of SpdySession3");
   return NS_ERROR_UNEXPECTED;
 }
 
 nsHttpConnection *
 SpdySession3::TakeHttpConnection()
 {
-  NS_ABORT_IF_FALSE(false, "TakeHttpConnection of SpdySession3");
+  MOZ_ASSERT(false, "TakeHttpConnection of SpdySession3");
   return nullptr;
 }
 
 uint32_t
 SpdySession3::CancelPipeline(nsresult reason)
 {
   // we don't pipeline inside spdy, so this isn't an issue
   return 0;
@@ -2275,66 +2265,66 @@ SpdySession3::Classification()
 // We can be sure of this because SpdySession3 is only constructed in
 // nsHttpConnection and is never passed out of that object
 //-----------------------------------------------------------------------------
 
 void
 SpdySession3::SetConnection(nsAHttpConnection *)
 {
   // This is unexpected
-  NS_ABORT_IF_FALSE(false, "SpdySession3::SetConnection()");
+  MOZ_ASSERT(false, "SpdySession3::SetConnection()");
 }
 
 void
 SpdySession3::GetSecurityCallbacks(nsIInterfaceRequestor **)
 {
   // This is unexpected
-  NS_ABORT_IF_FALSE(false, "SpdySession3::GetSecurityCallbacks()");
+  MOZ_ASSERT(false, "SpdySession3::GetSecurityCallbacks()");
 }
 
 void
 SpdySession3::SetProxyConnectFailed()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession3::SetProxyConnectFailed()");
+  MOZ_ASSERT(false, "SpdySession3::SetProxyConnectFailed()");
 }
 
 bool
 SpdySession3::IsDone()
 {
   return !mStreamTransactionHash.Count();
 }
 
 nsresult
 SpdySession3::Status()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession3::Status()");
+  MOZ_ASSERT(false, "SpdySession3::Status()");
   return NS_ERROR_UNEXPECTED;
 }
 
 uint32_t
 SpdySession3::Caps()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession3::Caps()");
+  MOZ_ASSERT(false, "SpdySession3::Caps()");
   return 0;
 }
 
 uint64_t
 SpdySession3::Available()
 {
-  NS_ABORT_IF_FALSE(false, "SpdySession3::Available()");
+  MOZ_ASSERT(false, "SpdySession3::Available()");
   return 0;
 }
 
 nsHttpRequestHead *
 SpdySession3::RequestHead()
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession3::RequestHead() "
-                    "should not be called after SPDY is setup");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(false,
+             "SpdySession3::RequestHead() "
+             "should not be called after SPDY is setup");
   return NULL;
 }
 
 uint32_t
 SpdySession3::Http1xTransactionCount()
 {
   return 0;
 }
@@ -2374,36 +2364,36 @@ SpdySession3::TakeSubTransactions(
 }
 
 nsresult
 SpdySession3::AddTransaction(nsAHttpTransaction *)
 {
   // This API is meant for pipelining, SpdySession3's should be
   // extended with AddStream()
 
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession3::AddTransaction() should not be called");
+  MOZ_ASSERT(false,
+             "SpdySession3::AddTransaction() should not be called");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 uint32_t
 SpdySession3::PipelineDepth()
 {
   return IsDone() ? 0 : 1;
 }
 
 nsresult
 SpdySession3::SetPipelinePosition(int32_t position)
 {
   // This API is meant for pipelining, SpdySession3's should be
   // extended with AddStream()
 
-  NS_ABORT_IF_FALSE(false,
-                    "SpdySession3::SetPipelinePosition() should not be called");
+  MOZ_ASSERT(false,
+             "SpdySession3::SetPipelinePosition() should not be called");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 int32_t
 SpdySession3::PipelinePosition()
 {
     return 0;
@@ -2411,17 +2401,17 @@ SpdySession3::PipelinePosition()
 
 //-----------------------------------------------------------------------------
 // Pass through methods of nsAHttpConnection
 //-----------------------------------------------------------------------------
 
 nsAHttpConnection *
 SpdySession3::Connection()
 {
-  NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   return mConnection;
 }
 
 nsresult
 SpdySession3::OnHeadersAvailable(nsAHttpTransaction *transaction,
                                 nsHttpRequestHead *requestHead,
                                 nsHttpResponseHead *responseHead,
                                 bool *reset)
--- a/netwerk/protocol/http/SpdyStream2.cpp
+++ b/netwerk/protocol/http/SpdyStream2.cpp
@@ -49,17 +49,17 @@ SpdyStream2::SpdyStream2(nsAHttpTransact
     mTxInlineFrameUsed(0),
     mTxStreamFrameSize(0),
     mZlib(compressionContext),
     mRequestBodyLenRemaining(0),
     mPriority(priority),
     mTotalSent(0),
     mTotalRead(0)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream2::SpdyStream2 %p", this));
 
   mTxInlineFrame = new char[mTxInlineFrameSize];
 }
 
 SpdyStream2::~SpdyStream2()
 {
@@ -74,17 +74,17 @@ SpdyStream2::~SpdyStream2()
 nsresult
 SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader,
                          uint32_t count,
                          uint32_t *countRead)
 {
   LOG3(("SpdyStream2 %p ReadSegments reader=%p count=%d state=%x",
         this, reader, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv = NS_ERROR_UNEXPECTED;
   mRequestBlockedOnRead = 0;
 
   switch (mUpstreamState) {
   case GENERATING_SYN_STREAM:
   case GENERATING_REQUEST_BODY:
   case SENDING_REQUEST_BODY:
@@ -131,18 +131,18 @@ SpdyStream2::ReadSegments(nsAHttpSegment
 
   case SENDING_FIN_STREAM:
     // We were trying to send the FIN-STREAM but were blocked from
     // sending it out - try again.
     if (!mSentFinOnData) {
       mSegmentReader = reader;
       rv = TransmitFrame(nullptr, nullptr, false);
       mSegmentReader = nullptr;
-      NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed,
-                        "Transmit Frame should be all or nothing");
+      MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed,
+                 "Transmit Frame should be all or nothing");
       if (NS_SUCCEEDED(rv))
         ChangeState(UPSTREAM_COMPLETE);
     }
     else {
       rv = NS_OK;
       mTxInlineFrameUsed = 0;         // cancel fin data packet
       ChangeState(UPSTREAM_COMPLETE);
     }
@@ -153,17 +153,17 @@ SpdyStream2::ReadSegments(nsAHttpSegment
     break;
 
   case UPSTREAM_COMPLETE:
     *countRead = 0;
     rv = NS_OK;
     break;
 
   default:
-    NS_ABORT_IF_FALSE(false, "SpdyStream2::ReadSegments unknown state");
+    MOZ_ASSERT(false, "SpdyStream2::ReadSegments unknown state");
     break;
   }
 
   return rv;
 }
 
 // WriteSegments() is used to read data off the socket. Generally this is
 // just the SPDY frame header and from there the appropriate SPDYStream
@@ -173,18 +173,18 @@ SpdyStream2::ReadSegments(nsAHttpSegment
 nsresult
 SpdyStream2::WriteSegments(nsAHttpSegmentWriter *writer,
                           uint32_t count,
                           uint32_t *countWritten)
 {
   LOG3(("SpdyStream2::WriteSegments %p count=%d state=%x",
         this, count, mUpstreamState));
   
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(!mSegmentWriter, "segment writer in progress");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(!mSegmentWriter, "segment writer in progress");
 
   mSegmentWriter = writer;
   nsresult rv = mTransaction->WriteSegments(writer, count, countWritten);
   mSegmentWriter = nullptr;
   return rv;
 }
 
 PLDHashOperator
@@ -202,18 +202,18 @@ SpdyStream2::hdrHashEnumerate(const nsAC
 nsresult
 SpdyStream2::ParseHttpRequestHeaders(const char *buf,
                                     uint32_t avail,
                                     uint32_t *countUsed)
 {
   // Returns NS_OK even if the headers are incomplete
   // set mSynFrameComplete flag if they are complete
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mUpstreamState == GENERATING_SYN_STREAM, "wrong state");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mUpstreamState == GENERATING_SYN_STREAM);
 
   LOG3(("SpdyStream2::ParseHttpRequestHeaders %p avail=%d state=%x",
         this, avail, mUpstreamState));
 
   mFlatHttpRequestHeaders.Append(buf, avail);
 
   // We can use the simple double crlf because firefox is the
   // only client we are parsing
@@ -235,18 +235,18 @@ SpdyStream2::ParseHttpRequestHeaders(con
   mFlatHttpRequestHeaders.SetLength(endHeader + 2);
   *countUsed = avail - (oldLen - endHeader) + 4;
   mSynFrameComplete = 1;
 
   // It is now OK to assign a streamID that we are assured will
   // be monotonically increasing amongst syn-streams on this
   // session
   mStreamID = mSession->RegisterStreamID(this);
-  NS_ABORT_IF_FALSE(mStreamID & 1,
-                    "Spdy Stream Channel ID must be odd");
+  MOZ_ASSERT(mStreamID & 1,
+             "Spdy Stream Channel ID must be odd");
 
   if (mStreamID >= 0x80000000) {
     // streamID must fit in 31 bits. This is theoretically possible
     // because stream ID assignment is asynchronous to stream creation
     // because of the protocol requirement that the ID in syn-stream
     // be monotonically increasing. In reality this is really not possible
     // because new streams stop being added to a session with 0x10000000 / 2
     // IDs still available and no race condition is going to bridge that gap,
@@ -389,18 +389,18 @@ SpdyStream2::ParseHttpRequestHeaders(con
   
   hdrHash.Enumerate(hdrHashEnumerate, this);
   CompressFlushFrame();
   
   // 4 to 7 are length and flags, which we can now fill in
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[1] =
     PR_htonl(mTxInlineFrameUsed - 8);
 
-  NS_ABORT_IF_FALSE(!mTxInlineFrame[4],
-                    "Size greater than 24 bits");
+  MOZ_ASSERT(!mTxInlineFrame[4],
+             "Size greater than 24 bits");
   
   // Determine whether to put the fin bit on the syn stream frame or whether
   // to wait for a data packet to put it on.
 
   if (mTransaction->RequestHead()->Method() == nsHttp::Get ||
       mTransaction->RequestHead()->Method() == nsHttp::Connect ||
       mTransaction->RequestHead()->Method() == nsHttp::Head) {
     // for GET, CONNECT, and HEAD place the fin bit right on the
@@ -487,20 +487,20 @@ SpdyStream2::TransmitFrame(const char *b
   // If TransmitFrame returns SUCCESS than all the data is sent (or at least
   // buffered at the session level), if it returns WOULD_BLOCK then none of
   // the data is sent.
 
   // You can call this function with no data and no out parameter in order to
   // flush internal buffers that were previously blocked on writing. You can
   // of course feed new data to it as well.
 
-  NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "empty stream frame in transmit");
-  NS_ABORT_IF_FALSE(mSegmentReader, "TransmitFrame with null mSegmentReader");
-  NS_ABORT_IF_FALSE((buf && countUsed) || (!buf && !countUsed),
-                    "TransmitFrame arguments inconsistent");
+  MOZ_ASSERT(mTxInlineFrameUsed, "empty stream frame in transmit");
+  MOZ_ASSERT(mSegmentReader, "TransmitFrame with null mSegmentReader");
+  MOZ_ASSERT((buf && countUsed) || (!buf && !countUsed),
+             "TransmitFrame arguments inconsistent");
 
   uint32_t transmittedCount;
   nsresult rv;
   
   LOG3(("SpdyStream2::TransmitFrame %p inline=%d stream=%d",
         this, mTxInlineFrameUsed, mTxStreamFrameSize));
   if (countUsed)
     *countUsed = 0;
@@ -521,69 +521,69 @@ SpdyStream2::TransmitFrame(const char *b
     mTxStreamFrameSize = 0;
   }
 
   rv =
     mSegmentReader->CommitToSegmentSize(mTxStreamFrameSize + mTxInlineFrameUsed,
                                         forceCommitment);
 
   if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
-    NS_ABORT_IF_FALSE(!forceCommitment, "forceCommitment with WOULD_BLOCK");
+    MOZ_ASSERT(!forceCommitment, "forceCommitment with WOULD_BLOCK");
     mSession->TransactionHasDataToWrite(this);
   }
   if (NS_FAILED(rv))     // this will include WOULD_BLOCK
     return rv;
 
   // This function calls mSegmentReader->OnReadSegment to report the actual SPDY
   // bytes through to the SpdySession2 and then the HttpConnection which calls
   // the socket write function. It will accept all of the inline and stream
   // data because of the above 'commitment' even if it has to buffer
   
   rv = mSegmentReader->OnReadSegment(mTxInlineFrame, mTxInlineFrameUsed,
                                      &transmittedCount);
   LOG3(("SpdyStream2::TransmitFrame for inline session=%p "
         "stream=%p result %x len=%d",
         mSession, this, rv, transmittedCount));
 
-  NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK,
-                    "inconsistent inline commitment result");
+  MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK,
+             "inconsistent inline commitment result");
 
   if (NS_FAILED(rv))
     return rv;
 
-  NS_ABORT_IF_FALSE(transmittedCount == mTxInlineFrameUsed,
-                    "inconsistent inline commitment count");
+  MOZ_ASSERT(transmittedCount == mTxInlineFrameUsed,
+             "inconsistent inline commitment count");
     
   SpdySession2::LogIO(mSession, this, "Writing from Inline Buffer",
                      mTxInlineFrame, transmittedCount);
 
   if (mTxStreamFrameSize) {
     if (!buf) {
       // this cannot happen
-      NS_ABORT_IF_FALSE(false, "Stream transmit with null buf argument to "
-                        "TransmitFrame()");
+      MOZ_ASSERT(false, "Stream transmit with null buf argument to "
+                 "TransmitFrame()");
       LOG(("Stream transmit with null buf argument to TransmitFrame()\n"));
       return NS_ERROR_UNEXPECTED;
     }
 
     rv = mSegmentReader->OnReadSegment(buf, mTxStreamFrameSize,
                                        &transmittedCount);
 
     LOG3(("SpdyStream2::TransmitFrame for regular session=%p "
           "stream=%p result %x len=%d",
           mSession, this, rv, transmittedCount));
   
-    NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK,
-                      "inconsistent stream commitment result");
+    MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK,
+               "inconsistent stream commitment result");
 
     if (NS_FAILED(rv))
       return rv;
 
-    NS_ABORT_IF_FALSE(transmittedCount == mTxStreamFrameSize,
-                      "inconsistent stream commitment count");
+    MOZ_ASSERT(transmittedCount == mTxStreamFrameSize,
+               "inconsistent stream commitment count");
     
     SpdySession2::LogIO(mSession, this, "Writing from Transaction Buffer",
                        buf, transmittedCount);
 
     *countUsed += mTxStreamFrameSize;
   }
   
   // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0
@@ -605,28 +605,27 @@ SpdyStream2::ChangeState(enum stateType 
 }
 
 void
 SpdyStream2::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame)
 {
   LOG3(("SpdyStream2::GenerateDataFrameHeader %p len=%d last=%d",
         this, dataLength, lastFrame));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(!mTxInlineFrameUsed, "inline frame not empty");
-  NS_ABORT_IF_FALSE(!mTxStreamFrameSize, "stream frame not empty");
-  NS_ABORT_IF_FALSE(!(dataLength & 0xff000000), "datalength > 24 bits");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty");
+  MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty");
+  MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits");
   
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID);
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[1] =
     PR_htonl(dataLength);
   
-  NS_ABORT_IF_FALSE(!(mTxInlineFrame[0] & 0x80),
-                    "control bit set unexpectedly");
-  NS_ABORT_IF_FALSE(!mTxInlineFrame[4], "flag bits set unexpectedly");
+  MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly");
+  MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly");
   
   mTxInlineFrameUsed = 8;
   mTxStreamFrameSize = dataLength;
 
   if (lastFrame) {
     mTxInlineFrame[4] |= SpdySession2::kFlag_Data_FIN;
     if (dataLength)
       mSentFinOnData = 1;
@@ -765,18 +764,18 @@ SpdyStream2::Close(nsresult reason)
 nsresult
 SpdyStream2::OnReadSegment(const char *buf,
                           uint32_t count,
                           uint32_t *countRead)
 {
   LOG3(("SpdyStream2::OnReadSegment %p count=%d state=%x",
         this, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mSegmentReader, "OnReadSegment with null mSegmentReader");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mSegmentReader);
   
   nsresult rv = NS_ERROR_UNEXPECTED;
   uint32_t dataLength;
 
   switch (mUpstreamState) {
   case GENERATING_SYN_STREAM:
     // The buffer is the HTTP request stream, including at least part of the
     // HTTP request header. This state's job is to build a SYN_STREAM frame
@@ -786,50 +785,47 @@ SpdyStream2::OnReadSegment(const char *b
     // header bytes)
 
     rv = ParseHttpRequestHeaders(buf, count, countRead);
     if (NS_FAILED(rv))
       return rv;
     LOG3(("ParseHttpRequestHeaders %p used %d of %d. complete = %d",
           this, *countRead, count, mSynFrameComplete));
     if (mSynFrameComplete) {
-      NS_ABORT_IF_FALSE(mTxInlineFrameUsed,
-                        "OnReadSegment SynFrameComplete 0b");
+      MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment SynFrameComplete 0b");
       rv = TransmitFrame(nullptr, nullptr, true);
       if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
         // this can't happen
-        NS_ABORT_IF_FALSE(false,
-                          "Transmit Frame SYN_FRAME must at least buffer data");
+        MOZ_ASSERT(false, "Transmit Frame SYN_FRAME must at least buffer data");
         rv = NS_ERROR_UNEXPECTED;
       }
 
       ChangeState(GENERATING_REQUEST_BODY);
       break;
     }
-    NS_ABORT_IF_FALSE(*countRead == count,
-                      "Header parsing not complete but unused data");
+    MOZ_ASSERT(*countRead == count, "Header parsing not complete but unused data");
     break;
 
   case GENERATING_REQUEST_BODY:
     dataLength = std::min(count, mChunkSize);
     LOG3(("SpdyStream2 %p id %x request len remaining %d, "
           "count avail %d, chunk used %d",
           this, mStreamID, mRequestBodyLenRemaining, count, dataLength));
     if (dataLength > mRequestBodyLenRemaining)
       return NS_ERROR_UNEXPECTED;
     mRequestBodyLenRemaining -= dataLength;
     GenerateDataFrameHeader(dataLength, !mRequestBodyLenRemaining);
     ChangeState(SENDING_REQUEST_BODY);
     // NO BREAK
 
   case SENDING_REQUEST_BODY:
-    NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b");
+    MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b");
     rv = TransmitFrame(buf, countRead, false);
-    NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed,
-                      "Transmit Frame should be all or nothing");
+    MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed,
+               "Transmit Frame should be all or nothing");
 
     LOG3(("TransmitFrame() rv=%x returning %d data bytes. "
           "Header is %d Body is %d.",
           rv, *countRead, mTxInlineFrameUsed, mTxStreamFrameSize));
 
     // normalize a partial write with a WOULD_BLOCK into just a partial write
     // as some code will take WOULD_BLOCK to mean an error with nothing
     // written (e.g. nsHttpTransaction::ReadRequestSegment()
@@ -837,22 +833,21 @@ SpdyStream2::OnReadSegment(const char *b
       rv = NS_OK;
 
     // If that frame was all sent, look for another one
     if (!mTxInlineFrameUsed)
         ChangeState(GENERATING_REQUEST_BODY);
     break;
 
   case SENDING_FIN_STREAM:
-    NS_ABORT_IF_FALSE(false,
-                      "resuming partial fin stream out of OnReadSegment");
+    MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment");
     break;
     
   default:
-    NS_ABORT_IF_FALSE(false, "SpdyStream2::OnReadSegment non-write state");
+    MOZ_ASSERT(false, "SpdyStream2::OnReadSegment non-write state");
     break;
   }
   
   return rv;
 }
 
 //-----------------------------------------------------------------------------
 // nsAHttpSegmentWriter
@@ -861,17 +856,17 @@ SpdyStream2::OnReadSegment(const char *b
 nsresult
 SpdyStream2::OnWriteSegment(char *buf,
                            uint32_t count,
                            uint32_t *countWritten)
 {
   LOG3(("SpdyStream2::OnWriteSegment %p count=%d state=%x",
         this, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mSegmentWriter, "OnWriteSegment with null mSegmentWriter");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mSegmentWriter, "OnWriteSegment with null mSegmentWriter");
 
   return mSegmentWriter->OnWriteSegment(buf, count, countWritten);
 }
 
 } // namespace mozilla::net
 } // namespace mozilla
 
--- a/netwerk/protocol/http/SpdyStream2.h
+++ b/netwerk/protocol/http/SpdyStream2.h
@@ -32,17 +32,17 @@ public:
   {
     return static_cast<bool>(mRequestBlockedOnRead);
   }
 
   // returns false if called more than once
   bool GetFullyOpen() {return mFullyOpen;}
   void SetFullyOpen() 
   {
-    NS_ABORT_IF_FALSE(!mFullyOpen, "SetFullyOpen already open");
+    MOZ_ASSERT(!mFullyOpen);
     mFullyOpen = 1;
   }
 
   bool HasRegisteredID() { return mStreamID != 0; }
 
   nsAHttpTransaction *Transaction()
   {
     return mTransaction;
--- a/netwerk/protocol/http/SpdyStream3.cpp
+++ b/netwerk/protocol/http/SpdyStream3.cpp
@@ -56,17 +56,17 @@ SpdyStream3::SpdyStream3(nsAHttpTransact
     mRequestBodyLenRemaining(0),
     mPriority(priority),
     mLocalWindow(SpdySession3::kInitialRwin),
     mLocalUnacked(0),
     mBlockedOnRwin(false),
     mTotalSent(0),
     mTotalRead(0)
 {
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   LOG3(("SpdyStream3::SpdyStream3 %p", this));
 
   mRemoteWindow = spdySession->GetServerInitialWindow();
   mTxInlineFrame = new uint8_t[mTxInlineFrameSize];
   mDecompressBuffer = new char[mDecompressBufferSize];
 }
 
@@ -83,17 +83,17 @@ SpdyStream3::~SpdyStream3()
 nsresult
 SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader,
                          uint32_t count,
                          uint32_t *countRead)
 {
   LOG3(("SpdyStream3 %p ReadSegments reader=%p count=%d state=%x",
         this, reader, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
   
   nsresult rv = NS_ERROR_UNEXPECTED;
   mRequestBlockedOnRead = 0;
 
   switch (mUpstreamState) {
   case GENERATING_SYN_STREAM:
   case GENERATING_REQUEST_BODY:
   case SENDING_REQUEST_BODY:
@@ -142,18 +142,18 @@ SpdyStream3::ReadSegments(nsAHttpSegment
 
   case SENDING_FIN_STREAM:
     // We were trying to send the FIN-STREAM but were blocked from
     // sending it out - try again.
     if (!mSentFinOnData) {
       mSegmentReader = reader;
       rv = TransmitFrame(nullptr, nullptr, false);
       mSegmentReader = nullptr;
-      NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed,
-                        "Transmit Frame should be all or nothing");
+      MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed,
+                 "Transmit Frame should be all or nothing");
       if (NS_SUCCEEDED(rv))
         ChangeState(UPSTREAM_COMPLETE);
     }
     else {
       rv = NS_OK;
       mTxInlineFrameUsed = 0;         // cancel fin data packet
       ChangeState(UPSTREAM_COMPLETE);
     }
@@ -164,17 +164,17 @@ SpdyStream3::ReadSegments(nsAHttpSegment
     break;
 
   case UPSTREAM_COMPLETE:
     *countRead = 0;
     rv = NS_OK;
     break;
 
   default:
-    NS_ABORT_IF_FALSE(false, "SpdyStream3::ReadSegments unknown state");
+    MOZ_ASSERT(false, "SpdyStream3::ReadSegments unknown state");
     break;
   }
 
   return rv;
 }
 
 // WriteSegments() is used to read data off the socket. Generally this is
 // just the SPDY frame header and from there the appropriate SPDYStream
@@ -184,18 +184,18 @@ SpdyStream3::ReadSegments(nsAHttpSegment
 nsresult
 SpdyStream3::WriteSegments(nsAHttpSegmentWriter *writer,
                           uint32_t count,
                           uint32_t *countWritten)
 {
   LOG3(("SpdyStream3::WriteSegments %p count=%d state=%x",
         this, count, mUpstreamState));
   
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(!mSegmentWriter, "segment writer in progress");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(!mSegmentWriter, "segment writer in progress");
 
   mSegmentWriter = writer;
   nsresult rv = mTransaction->WriteSegments(writer, count, countWritten);
   mSegmentWriter = nullptr;
   return rv;
 }
 
 PLDHashOperator
@@ -213,18 +213,18 @@ SpdyStream3::hdrHashEnumerate(const nsAC
 nsresult
 SpdyStream3::ParseHttpRequestHeaders(const char *buf,
                                     uint32_t avail,
                                     uint32_t *countUsed)
 {
   // Returns NS_OK even if the headers are incomplete
   // set mSynFrameComplete flag if they are complete
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mUpstreamState == GENERATING_SYN_STREAM, "wrong state");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mUpstreamState == GENERATING_SYN_STREAM);
 
   LOG3(("SpdyStream3::ParseHttpRequestHeaders %p avail=%d state=%x",
         this, avail, mUpstreamState));
 
   mFlatHttpRequestHeaders.Append(buf, avail);
 
   // We can use the simple double crlf because firefox is the
   // only client we are parsing
@@ -246,18 +246,17 @@ SpdyStream3::ParseHttpRequestHeaders(con
   mFlatHttpRequestHeaders.SetLength(endHeader + 2);
   *countUsed = avail - (oldLen - endHeader) + 4;
   mSynFrameComplete = 1;
 
   // It is now OK to assign a streamID that we are assured will
   // be monotonically increasing amongst syn-streams on this
   // session
   mStreamID = mSession->RegisterStreamID(this);
-  NS_ABORT_IF_FALSE(mStreamID & 1,
-                    "Spdy Stream Channel ID must be odd");
+  MOZ_ASSERT(mStreamID & 1, "Spdy Stream Channel ID must be odd");
 
   if (mStreamID >= 0x80000000) {
     // streamID must fit in 31 bits. This is theoretically possible
     // because stream ID assignment is asynchronous to stream creation
     // because of the protocol requirement that the ID in syn-stream
     // be monotonically increasing. In reality this is really not possible
     // because new streams stop being added to a session with 0x10000000 / 2
     // IDs still available and no race condition is going to bridge that gap,
@@ -297,18 +296,18 @@ SpdyStream3::ParseHttpRequestHeaders(con
     PR_STATIC_ASSERT(nsISupportsPriority::PRIORITY_LOWEST == 20);
     PR_STATIC_ASSERT(nsISupportsPriority::PRIORITY_HIGHEST == -20);
 
     // Add one to the priority so that values such as -10 and -11
     // get different spdy priorities - this appears to be an important
     // breaking line in the priorities content assigns to
     // transactions. 
     uint8_t calculatedPriority = 3 + ((mPriority + 1) / 5);
-    NS_ABORT_IF_FALSE (!(calculatedPriority & 0xf8),
-                       "Calculated Priority Out Of Range");
+    MOZ_ASSERT (!(calculatedPriority & 0xf8),
+                "Calculated Priority Out Of Range");
     mTxInlineFrame[16] = calculatedPriority << 5;
   }
 
   // The client cert "slot". Right now we don't send client certs
   mTxInlineFrame[17] = 0;
   
   const char *methodHeader = mTransaction->RequestHead()->Method().get();
 
@@ -409,18 +408,17 @@ SpdyStream3::ParseHttpRequestHeaders(con
 
   hdrHash.Enumerate(hdrHashEnumerate, this);
   CompressFlushFrame();
   
   // 4 to 7 are length and flags, which we can now fill in
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[1] =
     PR_htonl(mTxInlineFrameUsed - 8);
 
-  NS_ABORT_IF_FALSE(!mTxInlineFrame[4],
-                    "Size greater than 24 bits");
+  MOZ_ASSERT(!mTxInlineFrame[4], "Size greater than 24 bits");
   
   // Determine whether to put the fin bit on the syn stream frame or whether
   // to wait for a data packet to put it on.
 
   if (mTransaction->RequestHead()->Method() == nsHttp::Get ||
       mTransaction->RequestHead()->Method() == nsHttp::Connect ||
       mTransaction->RequestHead()->Method() == nsHttp::Head) {
     // for GET, CONNECT, and HEAD place the fin bit right on the
@@ -507,20 +505,20 @@ SpdyStream3::TransmitFrame(const char *b
   // If TransmitFrame returns SUCCESS than all the data is sent (or at least
   // buffered at the session level), if it returns WOULD_BLOCK then none of
   // the data is sent.
 
   // You can call this function with no data and no out parameter in order to
   // flush internal buffers that were previously blocked on writing. You can
   // of course feed new data to it as well.
 
-  NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "empty stream frame in transmit");
-  NS_ABORT_IF_FALSE(mSegmentReader, "TransmitFrame with null mSegmentReader");
-  NS_ABORT_IF_FALSE((buf && countUsed) || (!buf && !countUsed),
-                    "TransmitFrame arguments inconsistent");
+  MOZ_ASSERT(mTxInlineFrameUsed, "empty stream frame in transmit");
+  MOZ_ASSERT(mSegmentReader, "TransmitFrame with null mSegmentReader");
+  MOZ_ASSERT((buf && countUsed) || (!buf && !countUsed),
+             "TransmitFrame arguments inconsistent");
 
   uint32_t transmittedCount;
   nsresult rv;
   
   LOG3(("SpdyStream3::TransmitFrame %p inline=%d stream=%d",
         this, mTxInlineFrameUsed, mTxStreamFrameSize));
   if (countUsed)
     *countUsed = 0;
@@ -541,17 +539,17 @@ SpdyStream3::TransmitFrame(const char *b
     mTxStreamFrameSize = 0;
   }
 
   rv =
     mSegmentReader->CommitToSegmentSize(mTxStreamFrameSize + mTxInlineFrameUsed,
                                         forceCommitment);
 
   if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
-    NS_ABORT_IF_FALSE(!forceCommitment, "forceCommitment with WOULD_BLOCK");
+    MOZ_ASSERT(!forceCommitment, "forceCommitment with WOULD_BLOCK");
     mSession->TransactionHasDataToWrite(this);
   }
   if (NS_FAILED(rv))     // this will include WOULD_BLOCK
     return rv;
 
   // This function calls mSegmentReader->OnReadSegment to report the actual SPDY
   // bytes through to the SpdySession3 and then the HttpConnection which calls
   // the socket write function. It will accept all of the inline and stream
@@ -559,53 +557,53 @@ SpdyStream3::TransmitFrame(const char *b
 
   rv = mSegmentReader->OnReadSegment(reinterpret_cast<char*>(mTxInlineFrame.get()),
                                      mTxInlineFrameUsed,
                                      &transmittedCount);
   LOG3(("SpdyStream3::TransmitFrame for inline session=%p "
         "stream=%p result %x len=%d",
         mSession, this, rv, transmittedCount));
 
-  NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK,
-                    "inconsistent inline commitment result");
+  MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK,
+             "inconsistent inline commitment result");
 
   if (NS_FAILED(rv))
     return rv;
 
-  NS_ABORT_IF_FALSE(transmittedCount == mTxInlineFrameUsed,
-                    "inconsistent inline commitment count");
+  MOZ_ASSERT(transmittedCount == mTxInlineFrameUsed,
+             "inconsistent inline commitment count");
 
   SpdySession3::LogIO(mSession, this, "Writing from Inline Buffer",
                       reinterpret_cast<char*>(mTxInlineFrame.get()),
                       transmittedCount);
 
   if (mTxStreamFrameSize) {
     if (!buf) {
       // this cannot happen
-      NS_ABORT_IF_FALSE(false, "Stream transmit with null buf argument to "
-                        "TransmitFrame()");
+      MOZ_ASSERT(false, "Stream transmit with null buf argument to "
+                 "TransmitFrame()");
       LOG(("Stream transmit with null buf argument to TransmitFrame()\n"));
       return NS_ERROR_UNEXPECTED;
     }
 
     rv = mSegmentReader->OnReadSegment(buf, mTxStreamFrameSize,
                                        &transmittedCount);
 
     LOG3(("SpdyStream3::TransmitFrame for regular session=%p "
           "stream=%p result %x len=%d",
           mSession, this, rv, transmittedCount));
   
-    NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK,
-                      "inconsistent stream commitment result");
+    MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK,
+               "inconsistent stream commitment result");
 
     if (NS_FAILED(rv))
       return rv;
 
-    NS_ABORT_IF_FALSE(transmittedCount == mTxStreamFrameSize,
-                      "inconsistent stream commitment count");
+    MOZ_ASSERT(transmittedCount == mTxStreamFrameSize,
+               "inconsistent stream commitment count");
     
     SpdySession3::LogIO(mSession, this, "Writing from Transaction Buffer",
                        buf, transmittedCount);
 
     *countUsed += mTxStreamFrameSize;
   }
   
   // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0
@@ -627,28 +625,27 @@ SpdyStream3::ChangeState(enum stateType 
 }
 
 void
 SpdyStream3::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame)
 {
   LOG3(("SpdyStream3::GenerateDataFrameHeader %p len=%d last=%d",
         this, dataLength, lastFrame));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(!mTxInlineFrameUsed, "inline frame not empty");
-  NS_ABORT_IF_FALSE(!mTxStreamFrameSize, "stream frame not empty");
-  NS_ABORT_IF_FALSE(!(dataLength & 0xff000000), "datalength > 24 bits");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty");
+  MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty");
+  MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits");
   
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID);
   (reinterpret_cast<uint32_t *>(mTxInlineFrame.get()))[1] =
     PR_htonl(dataLength);
   
-  NS_ABORT_IF_FALSE(!(mTxInlineFrame[0] & 0x80),
-                    "control bit set unexpectedly");
-  NS_ABORT_IF_FALSE(!mTxInlineFrame[4], "flag bits set unexpectedly");
+  MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly");
+  MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly");
   
   mTxInlineFrameUsed = 8;
   mTxStreamFrameSize = dataLength;
 
   if (lastFrame) {
     mTxInlineFrame[4] |= SpdySession3::kFlag_Data_FIN;
     if (dataLength)
       mSentFinOnData = 1;
@@ -1183,18 +1180,18 @@ SpdyStream3::Close(nsresult reason)
 nsresult
 SpdyStream3::OnReadSegment(const char *buf,
                           uint32_t count,
                           uint32_t *countRead)
 {
   LOG3(("SpdyStream3::OnReadSegment %p count=%d state=%x",
         this, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mSegmentReader, "OnReadSegment with null mSegmentReader");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mSegmentReader, "OnReadSegment with null mSegmentReader");
   
   nsresult rv = NS_ERROR_UNEXPECTED;
   uint32_t dataLength;
 
   switch (mUpstreamState) {
   case GENERATING_SYN_STREAM:
     // The buffer is the HTTP request stream, including at least part of the
     // HTTP request header. This state's job is to build a SYN_STREAM frame
@@ -1204,31 +1201,28 @@ SpdyStream3::OnReadSegment(const char *b
     // header bytes)
 
     rv = ParseHttpRequestHeaders(buf, count, countRead);
     if (NS_FAILED(rv))
       return rv;
     LOG3(("ParseHttpRequestHeaders %p used %d of %d. complete = %d",
           this, *countRead, count, mSynFrameComplete));
     if (mSynFrameComplete) {
-      NS_ABORT_IF_FALSE(mTxInlineFrameUsed,
-                        "OnReadSegment SynFrameComplete 0b");
+      MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment SynFrameComplete 0b");
       rv = TransmitFrame(nullptr, nullptr, true);
       if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
         // this can't happen
-        NS_ABORT_IF_FALSE(false,
-                          "Transmit Frame SYN_FRAME must at least buffer data");
+        MOZ_ASSERT(false, "Transmit Frame SYN_FRAME must at least buffer data");
         rv = NS_ERROR_UNEXPECTED;
       }
 
       ChangeState(GENERATING_REQUEST_BODY);
       break;
     }
-    NS_ABORT_IF_FALSE(*countRead == count,
-                      "Header parsing not complete but unused data");
+    MOZ_ASSERT(*countRead == count, "Header parsing not complete but unused data");
     break;
 
   case GENERATING_REQUEST_BODY:
     if (mRemoteWindow <= 0) {
       *countRead = 0;
       LOG3(("SpdyStream3 this=%p, id 0x%X request body suspended because "
             "remote window is %d.\n", this, mStreamID, mRemoteWindow));
       mBlockedOnRwin = true;
@@ -1251,20 +1245,20 @@ SpdyStream3::OnReadSegment(const char *b
     if (dataLength > mRequestBodyLenRemaining)
       return NS_ERROR_UNEXPECTED;
     mRequestBodyLenRemaining -= dataLength;
     GenerateDataFrameHeader(dataLength, !mRequestBodyLenRemaining);
     ChangeState(SENDING_REQUEST_BODY);
     // NO BREAK
 
   case SENDING_REQUEST_BODY:
-    NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b");
+    MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b");
     rv = TransmitFrame(buf, countRead, false);
-    NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed,
-                      "Transmit Frame should be all or nothing");
+    MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed,
+               "Transmit Frame should be all or nothing");
 
     LOG3(("TransmitFrame() rv=%x returning %d data bytes. "
           "Header is %d Body is %d.",
           rv, *countRead, mTxInlineFrameUsed, mTxStreamFrameSize));
 
     // normalize a partial write with a WOULD_BLOCK into just a partial write
     // as some code will take WOULD_BLOCK to mean an error with nothing
     // written (e.g. nsHttpTransaction::ReadRequestSegment()
@@ -1272,22 +1266,21 @@ SpdyStream3::OnReadSegment(const char *b
       rv = NS_OK;
 
     // If that frame was all sent, look for another one
     if (!mTxInlineFrameUsed)
         ChangeState(GENERATING_REQUEST_BODY);
     break;
 
   case SENDING_FIN_STREAM:
-    NS_ABORT_IF_FALSE(false,
-                      "resuming partial fin stream out of OnReadSegment");
+    MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment");
     break;
     
   default:
-    NS_ABORT_IF_FALSE(false, "SpdyStream3::OnReadSegment non-write state");
+    MOZ_ASSERT(false, "SpdyStream3::OnReadSegment non-write state");
     break;
   }
   
   return rv;
 }
 
 //-----------------------------------------------------------------------------
 // nsAHttpSegmentWriter
@@ -1296,17 +1289,17 @@ SpdyStream3::OnReadSegment(const char *b
 nsresult
 SpdyStream3::OnWriteSegment(char *buf,
                            uint32_t count,
                            uint32_t *countWritten)
 {
   LOG3(("SpdyStream3::OnWriteSegment %p count=%d state=%x",
         this, count, mUpstreamState));
 
-  NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-  NS_ABORT_IF_FALSE(mSegmentWriter, "OnWriteSegment with null mSegmentWriter");
+  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+  MOZ_ASSERT(mSegmentWriter, "OnWriteSegment with null mSegmentWriter");
 
   return mSegmentWriter->OnWriteSegment(buf, count, countWritten);
 }
 
 } // namespace mozilla::net
 } // namespace mozilla
 
--- a/netwerk/protocol/http/SpdyStream3.h
+++ b/netwerk/protocol/http/SpdyStream3.h
@@ -31,17 +31,17 @@ public:
   {
     return static_cast<bool>(mRequestBlockedOnRead);
   }
 
   // returns false if called more than once
   bool GetFullyOpen() {return mFullyOpen;}
   void SetFullyOpen() 
   {
-    NS_ABORT_IF_FALSE(!mFullyOpen, "SetFullyOpen already open");
+    MOZ_ASSERT(!mFullyOpen);
     mFullyOpen = 1;
   }
 
   bool HasRegisteredID() { return mStreamID != 0; }
 
   nsAHttpTransaction *Transaction()
   {
     return mTransaction;
--- a/netwerk/protocol/http/nsHttp.cpp
+++ b/netwerk/protocol/http/nsHttp.cpp
@@ -93,17 +93,17 @@ static const PLDHashTableOps ops = {
     PL_DHashFinalizeStub,
     nullptr
 };
 
 // We put the atoms in a hash table for speedy lookup.. see ResolveAtom.
 nsresult
 nsHttp::CreateAtomTable()
 {
-    NS_ASSERTION(!sAtomTable.ops, "atom table already initialized");
+    MOZ_ASSERT(!sAtomTable.ops, "atom table already initialized");
 
     if (!sLock) {
         sLock = new Mutex("nsHttp.sLock");
     }
 
     // The capacity for this table is initialized to a value greater than the
     // number of known atoms (NUM_HTTP_ATOMS) because we expect to encounter a
     // few random headers right off the bat.
@@ -122,17 +122,17 @@ nsHttp::CreateAtomTable()
     };
 
     for (int i = 0; atoms[i]; ++i) {
         PLDHashEntryStub *stub = reinterpret_cast<PLDHashEntryStub *>
                                                  (PL_DHashTableOperate(&sAtomTable, atoms[i], PL_DHASH_ADD));
         if (!stub)
             return NS_ERROR_OUT_OF_MEMORY;
         
-        NS_ASSERTION(!stub->key, "duplicate static atom");
+        MOZ_ASSERT(!stub->key, "duplicate static atom");
         stub->key = atoms[i];
     }
 
     return NS_OK;
 }
 
 void
 nsHttp::DestroyAtomTable()
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -410,17 +410,17 @@ nsHttpChannel::Connect()
     if (ShouldSkipCache())
         return ContinueConnect();
 
     // open a cache entry for this channel...
     rv = OpenCacheEntry(usingSSL);
 
     // do not continue if asyncOpenCacheEntry is in progress
     if (mOnCacheEntryAvailableCallback) {
-        NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state");
+        MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state");
         return NS_OK;
     }
 
     if (NS_FAILED(rv)) {
         LOG(("OpenCacheEntry failed [rv=%x]\n", rv));
         // if this channel is only allowed to pull from the cache, then
         // we must fail if we were unable to open a cache entry.
         if (mLoadFlags & LOAD_ONLY_FROM_CACHE) {
@@ -920,17 +920,17 @@ nsHttpChannel::CallOnStartRequest()
         }
     }
 
     bool shouldSniff = mResponseHead && (mResponseHead->ContentType().IsEmpty() ||
         ((mResponseHead->ContentType().EqualsLiteral(APPLICATION_OCTET_STREAM) &&
         (mLoadFlags & LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN))));
 
     if (shouldSniff) {
-        NS_ASSERTION(mConnectionInfo, "Should have connection info here");
+        MOZ_ASSERT(mConnectionInfo, "Should have connection info here");
         if (!mContentTypeHint.IsEmpty())
             mResponseHead->SetContentType(mContentTypeHint);
         else if (mResponseHead->Version() == NS_HTTP_VERSION_0_9 &&
                  mConnectionInfo->Port() != mConnectionInfo->DefaultPort())
             mResponseHead->SetContentType(NS_LITERAL_CSTRING(TEXT_PLAIN));
         else {
             // Uh-oh.  We had better find out what type we are!
 
@@ -1014,18 +1014,18 @@ nsHttpChannel::ProcessFailedProxyConnect
     // 3) Proxy connection to target failed or timed out.
     // 4) Eve intercepted our CONNECT, and is replying with malicious HTML.
     //
     // Our current architecture would parse the proxy's response content with
     // the permission of the target URL.  Given #4, we must avoid rendering the
     // body of the reply, and instead give the user a (hopefully helpful)
     // boilerplate error page, based on just the HTTP status of the reply.
 
-    NS_ABORT_IF_FALSE(mConnectionInfo->UsingConnect(),
-                      "proxy connect failed but not using CONNECT?");
+    MOZ_ASSERT(mConnectionInfo->UsingConnect(),
+               "proxy connect failed but not using CONNECT?");
     nsresult rv;
     switch (httpStatus) 
     {
     case 300: case 301: case 302: case 303: case 307: case 308:
         // Bad redirect: not top-level, or it's a POST, bad/missing Location,
         // or ProcessRedirect() failed for some other reason.  Legal
         // redirects that fail because site not available, etc., are handled
         // elsewhere, in the regular codepath.
@@ -1130,18 +1130,18 @@ nsHttpChannel::ProcessSTSHeader()
     // will happen during the session.
     bool wasAlreadySTSHost;
     uint32_t flags =
       NS_UsePrivateBrowsing(this) ? nsISocketProvider::NO_PERMANENT_STORAGE : 0;
     rv = stss->IsStsURI(mURI, flags, &wasAlreadySTSHost);
     // Failure here means STS is broken.  Don't prevent the load, but this
     // shouldn't fail.
     NS_ENSURE_SUCCESS(rv, NS_OK);
-    NS_ASSERTION(!(wasAlreadySTSHost && tlsIsBroken),
-                 "connection should have been aborted by nss-bad-cert-handler");
+    MOZ_ASSERT(!(wasAlreadySTSHost && tlsIsBroken),
+               "connection should have been aborted by nss-bad-cert-handler");
 
     // Any STS header is ignored if the channel is not trusted due to
     // certificate errors (STS Spec 7.1) -- there is nothing else to do, and
     // the load may progress.
     if (tlsIsBroken) {
         LOG(("STS: Transport layer is not trustworthy, ignoring "
              "STS headers and continuing load\n"));
         return NS_OK;
@@ -1190,17 +1190,17 @@ nsHttpChannel::ProcessResponse()
         // Only allow 407 (authentication required) to continue
         if (httpStatus != 407)
             return ProcessFailedProxyConnect(httpStatus);
         // If proxy CONNECT response needs to complete, wait to process connection
         // for Strict-Transport-Security.
     } else {
         // Given a successful connection, process any STS data that's relevant.
         rv = ProcessSTSHeader();
-        NS_ASSERTION(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load.");
+        MOZ_ASSERT(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load.");
     }
 
     MOZ_ASSERT(!mCachedContentIsValid);
 
     // notify "http-on-examine-response" observers
     gHttpHandler->OnExamineResponse(this);
 
     SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
@@ -2234,18 +2234,18 @@ nsHttpChannel::ProcessFallback(bool *wai
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (fallbackEntryType & nsIApplicationCache::ITEM_FOREIGN) {
         // This cache points to a fallback that refers to a different
         // manifest.  Refuse to fall back.
         return NS_OK;
     }
 
-    NS_ASSERTION(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK,
-                 "Fallback entry not marked correctly!");
+    MOZ_ASSERT(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK,
+               "Fallback entry not marked correctly!");
 
     // Kill any offline cache entry, and disable offline caching for the
     // fallback.
     if (mOfflineCacheEntry) {
         mOfflineCacheEntry->AsyncDoom(nullptr);
         mOfflineCacheEntry = 0;
         mOfflineCacheAccess = 0;
     }
@@ -2342,17 +2342,17 @@ IsSubRangeRequest(nsHttpRequestHead &aRe
 
 nsresult
 nsHttpChannel::OpenCacheEntry(bool usingSSL)
 {
     MOZ_EVENT_TRACER_EXEC(this, "net::http::OpenCacheEntry");
 
     nsresult rv;
 
-    NS_ASSERTION(!mOnCacheEntryAvailableCallback, "Unexpected state");
+    MOZ_ASSERT(!mOnCacheEntryAvailableCallback, "Unexpected state");
     mLoadedFromApplicationCache = false;
 
     LOG(("nsHttpChannel::OpenCacheEntry [this=%p]", this));
 
     // make sure we're not abusing this function
     NS_PRECONDITION(!mCacheEntry, "cache entry already open");
 
     nsAutoCString cacheKey;
@@ -2522,17 +2522,17 @@ nsHttpChannel::OnOfflineCacheEntryAvaila
     bool usingSSL = false;
     (void) mURI->SchemeIs("https", &usingSSL);
     return OpenNormalCacheEntry(usingSSL);
 }
 
 nsresult
 nsHttpChannel::OpenNormalCacheEntry(bool usingSSL)
 {
-    NS_ASSERTION(!mCacheEntry, "We have already mCacheEntry");
+    MOZ_ASSERT(!mCacheEntry, "We have already mCacheEntry");
 
     nsresult rv;
 
     uint32_t appId = NECKO_NO_APP_ID;
     bool isInBrowser = false;
     NS_GetAppInfo(this, &appId, &isInBrowser);
 
     nsCacheStoragePolicy storagePolicy = DetermineStoragePolicy();
@@ -3554,17 +3554,17 @@ nsHttpChannel::CloseCacheEntry(bool doom
 
     // If we have begun to create or replace a cache entry, and that cache
     // entry is not complete and not resumable, then it needs to be doomed.
     // Otherwise, CheckCache will make the mistake of thinking that the
     // partial cache entry is complete.
 
     bool doom = false;
     if (mInitedCacheEntry) {
-        NS_ASSERTION(mResponseHead, "oops");
+        MOZ_ASSERT(mResponseHead, "oops");
         if (NS_FAILED(mStatus) && doomOnFailure &&
             (mCacheAccess & nsICache::ACCESS_WRITE) &&
             !mResponseHead->IsResumable())
             doom = true;
     }
     else if (mCacheAccess == nsICache::ACCESS_WRITE)
         doom = true;
 
@@ -3828,18 +3828,18 @@ nsHttpChannel::FinalizeCacheEntry()
 // the chain of response listeners.
 nsresult
 nsHttpChannel::InstallCacheListener(uint32_t offset)
 {
     nsresult rv;
 
     LOG(("Preparing to write data into the cache [uri=%s]\n", mSpec.get()));
 
-    NS_ASSERTION(mCacheEntry, "no cache entry");
-    NS_ASSERTION(mListener, "no listener");
+    MOZ_ASSERT(mCacheEntry);
+    MOZ_ASSERT(mListener);
 
     // If the content is compressible and the server has not compressed it,
     // mark the cache entry for compression.
     if ((mResponseHead->PeekHeader(nsHttp::Content_Encoding) == nullptr) && (
          mResponseHead->ContentType().EqualsLiteral(TEXT_HTML) ||
          mResponseHead->ContentType().EqualsLiteral(TEXT_PLAIN) ||
          mResponseHead->ContentType().EqualsLiteral(TEXT_CSS) ||
          mResponseHead->ContentType().EqualsLiteral(TEXT_JAVASCRIPT) ||
@@ -3901,18 +3901,18 @@ nsHttpChannel::InstallCacheListener(uint
 nsresult
 nsHttpChannel::InstallOfflineCacheListener()
 {
     nsresult rv;
 
     LOG(("Preparing to write data into the offline cache [uri=%s]\n",
          mSpec.get()));
 
-    NS_ASSERTION(mOfflineCacheEntry, "no offline cache entry");
-    NS_ASSERTION(mListener, "no listener");
+    MOZ_ASSERT(mOfflineCacheEntry);
+    MOZ_ASSERT(mListener);
 
     nsCOMPtr<nsIOutputStream> out;
     rv = mOfflineCacheEntry->OpenOutputStream(0, getter_AddRefs(out));
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsIStreamListenerTee> tee =
         do_CreateInstance(kStreamListenerTeeCID, &rv);
     if (NS_FAILED(rv)) return rv;
@@ -4868,20 +4868,20 @@ nsHttpChannel::OnStartRequest(nsIRequest
         // connection failures, etc - bug 93581
         request->GetStatus(&mStatus);
     }
 
     LOG(("nsHttpChannel::OnStartRequest [this=%p request=%p status=%x]\n",
         this, request, mStatus));
 
     // Make sure things are what we expect them to be...
-    NS_ASSERTION(request == mCachePump || request == mTransactionPump,
-                 "Unexpected request");
-    NS_ASSERTION(!(mTransactionPump && mCachePump) || mCachedContentIsPartial,
-                 "If we have both pumps, the cache content must be partial");
+    MOZ_ASSERT(request == mCachePump || request == mTransactionPump,
+               "Unexpected request");
+    MOZ_ASSERT(!(mTransactionPump && mCachePump) || mCachedContentIsPartial,
+               "If we have both pumps, the cache content must be partial");
 
     if (!mSecurityInfo && !mCachePump && mTransaction) {
         // grab the security info from the connection object; the transaction
         // is guaranteed to own a reference to the connection.
         mSecurityInfo = mTransaction->SecurityInfo();
     }
 
     if (!mCachePump && NS_FAILED(mStatus) &&
@@ -4981,18 +4981,18 @@ nsHttpChannel::OnStopRequest(nsIRequest 
 
     // honor the cancelation status even if the underlying transaction completed.
     if (mCanceled || NS_FAILED(mStatus))
         status = mStatus;
 
     if (mCachedContentIsPartial) {
         if (NS_SUCCEEDED(status)) {
             // mTransactionPump should be suspended
-            NS_ASSERTION(request != mTransactionPump,
-                "byte-range transaction finished prematurely");
+            MOZ_ASSERT(request != mTransactionPump,
+                       "byte-range transaction finished prematurely");
 
             if (request == mCachePump) {
                 bool streamDone;
                 status = OnDoneReadingPartialCacheEntry(&streamDone);
                 if (NS_SUCCEEDED(status) && !streamDone)
                     return status;
                 // otherwise, fall through and fire OnStopRequest...
             }
@@ -5051,17 +5051,17 @@ nsHttpChannel::OnStopRequest(nsIRequest 
             status = DoAuthRetry(conn);
             if (NS_SUCCEEDED(status))
                 return NS_OK;
         }
 
         // If DoAuthRetry failed, or if we have been cancelled since showing
         // the auth. dialog, then we need to send OnStartRequest now
         if (authRetry || (mAuthRetryPending && NS_FAILED(status))) {
-            NS_ASSERTION(NS_FAILED(status), "should have a failure code here");
+            MOZ_ASSERT(NS_FAILED(status), "should have a failure code here");
             // NOTE: since we have a failure status, we can ignore the return
             // value from onStartRequest.
             mListener->OnStartRequest(this, mListenerContext);
         }
 
         // if this transaction has been replaced, then bail.
         if (mTransactionReplaced)
             return NS_OK;
@@ -5117,20 +5117,20 @@ nsHttpChannel::OnDataAvailable(nsIReques
     PROFILER_LABEL("network", "nsHttpChannel::OnDataAvailable");
     LOG(("nsHttpChannel::OnDataAvailable [this=%p request=%p offset=%llu count=%u]\n",
         this, request, offset, count));
 
     // don't send out OnDataAvailable notifications if we've been canceled.
     if (mCanceled)
         return mStatus;
 
-    NS_ASSERTION(mResponseHead, "No response head in ODA!!");
-
-    NS_ASSERTION(!(mCachedContentIsPartial && (request == mTransactionPump)),
-            "transaction pump not suspended");
+    MOZ_ASSERT(mResponseHead, "No response head in ODA!!");
+
+    MOZ_ASSERT(!(mCachedContentIsPartial && (request == mTransactionPump)),
+               "transaction pump not suspended");
 
     if (mAuthRetryPending || (request == mTransactionPump && mTransactionReplaced)) {
         uint32_t n;
         return input->ReadSegments(NS_DiscardSegment, nullptr, count, &n);
     }
 
     if (mListener) {
         //
@@ -5146,17 +5146,17 @@ nsHttpChannel::OnDataAvailable(nsIReques
 
         // mResponseHead may reference new or cached headers, but either way it
         // holds our best estimate of the total content length.  Even in the case
         // of a byte range request, the content length stored in the cached
         // response headers is what we want to use here.
 
         uint64_t progressMax(uint64_t(mResponseHead->ContentLength()));
         uint64_t progress = mLogicalOffset + uint64_t(count);
-        NS_ASSERTION(progress <= progressMax, "unexpected progress values");
+        MOZ_ASSERT(progress <= progressMax, "unexpected progress values");
 
         OnTransportStatus(nullptr, transportStatus, progress, progressMax);
 
         //
         // we have to manually keep the logical offset of the stream up-to-date.
         // we cannot depend solely on the offset provided, since we may have 
         // already streamed some data from another source (see, for example,
         // OnDoneReadingPartialCacheEntry).
@@ -5205,17 +5205,17 @@ nsHttpChannel::OnTransportStatus(nsITran
             this, status, progress, progressMax));
 
         nsAutoCString host;
         mURI->GetHost(host);
         mProgressSink->OnStatus(this, nullptr, status,
                                 NS_ConvertUTF8toUTF16(host).get());
 
         if (progress > 0) {
-            NS_ASSERTION(progress <= progressMax, "unexpected progress values");
+            MOZ_ASSERT(progress <= progressMax, "unexpected progress values");
             mProgressSink->OnProgress(this, nullptr, progress, progressMax);
         }
     }
 #ifdef DEBUG
     else
         LOG(("skipping status notification [this=%p sink=%p pending=%u background=%x]\n",
             this, mProgressSink.get(), mIsPending, (mLoadFlags & LOAD_BACKGROUND)));
 #endif
@@ -5505,23 +5505,23 @@ nsHttpChannel::OnCacheEntryAvailableInte
                                              nsCacheAccessMode access,
                                              nsresult status)
 {
     nsresult rv;
 
     nsOnCacheEntryAvailableCallback callback = mOnCacheEntryAvailableCallback;
     mOnCacheEntryAvailableCallback = nullptr;
 
-    NS_ASSERTION(callback,
-        "nsHttpChannel::OnCacheEntryAvailable called without callback");
+    MOZ_ASSERT(callback,
+               "nsHttpChannel::OnCacheEntryAvailable called without callback");
     rv = ((*this).*callback)(entry, access, status);
 
     if (mOnCacheEntryAvailableCallback) {
         // callback fired another async open
-        NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state");
+        MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state");
         return NS_OK;
     }
 
     if (callback != &nsHttpChannel::OnOfflineCacheEntryForWritingAvailable) {
         if (NS_FAILED(rv)) {
             LOG(("AsyncOpenCacheEntry failed [rv=%x]\n", rv));
             if (mLoadFlags & LOAD_ONLY_FROM_CACHE) {
                 // If we have a fallback URI (and we're not already
@@ -5539,17 +5539,17 @@ nsHttpChannel::OnCacheEntryAvailableInte
             // proceed without using the cache
         }
 
         // if app cache for write has been set, open up an offline cache entry
         // to update
         if (mApplicationCacheForWrite) {
             rv = OpenOfflineCacheEntryForWriting();
             if (mOnCacheEntryAvailableCallback) {
-                NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state");
+                MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state");
                 return NS_OK;
             }
 
             if (NS_FAILED(rv))
                 return rv;
         }
     } else {
         // check result of OnOfflineCacheEntryForWritingAvailable()
@@ -5566,17 +5566,17 @@ nsHttpChannel::OnCacheEntryDoomed(nsresu
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 nsresult
 nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn)
 {
     LOG(("nsHttpChannel::DoAuthRetry [this=%p]\n", this));
 
-    NS_ASSERTION(!mTransaction, "should not have a transaction");
+    MOZ_ASSERT(!mTransaction, "should not have a transaction");
     nsresult rv;
 
     // toggle mIsPending to allow nsIObserver implementations to modify
     // the request headers (bug 95044).
     mIsPending = false;
 
     // fetch cookies, and add them to the request header.
     // the server response could have included cookies that must be sent with
@@ -5754,34 +5754,34 @@ nsHttpChannel::WaitForRedirectCallback()
     }
     if (mCachePump) {
         rv = mCachePump->Suspend();
         if (NS_FAILED(rv) && mTransactionPump) {
 #ifdef DEBUG
             nsresult resume = 
 #endif
             mTransactionPump->Resume();
-            NS_ASSERTION(NS_SUCCEEDED(resume),
-                "Failed to resume transaction pump");
+            MOZ_ASSERT(NS_SUCCEEDED(resume),
+                       "Failed to resume transaction pump");
         }
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     mWaitingForRedirectCallback = true;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpChannel::OnRedirectVerifyCallback(nsresult result)
 {
     LOG(("nsHttpChannel::OnRedirectVerifyCallback [this=%p] "
          "result=%x stack=%d mWaitingForRedirectCallback=%u\n",
          this, result, mRedirectFuncStack.Length(), mWaitingForRedirectCallback));
-    NS_ASSERTION(mWaitingForRedirectCallback,
-                 "Someone forgot to call WaitForRedirectCallback() ?!");
+    MOZ_ASSERT(mWaitingForRedirectCallback,
+               "Someone forgot to call WaitForRedirectCallback() ?!");
     mWaitingForRedirectCallback = false;
 
     if (mCanceled && NS_SUCCEEDED(result))
         result = NS_BINDING_ABORTED;
 
     for (uint32_t i = mRedirectFuncStack.Length(); i > 0;) {
         --i;
         // Pop the last function pushed to the stack
@@ -5828,18 +5828,18 @@ void
 nsHttpChannel::PushRedirectAsyncFunc(nsContinueRedirectionFunc func)
 {
     mRedirectFuncStack.AppendElement(func);
 }
 
 void
 nsHttpChannel::PopRedirectAsyncFunc(nsContinueRedirectionFunc func)
 {
-    NS_ASSERTION(func == mRedirectFuncStack[mRedirectFuncStack.Length() - 1],
-        "Trying to pop wrong method from redirect async stack!");
+    MOZ_ASSERT(func == mRedirectFuncStack[mRedirectFuncStack.Length() - 1],
+               "Trying to pop wrong method from redirect async stack!");
 
     mRedirectFuncStack.TruncateLength(mRedirectFuncStack.Length() - 1);
 }
 
 
 //-----------------------------------------------------------------------------
 // nsHttpChannel internal functions
 //-----------------------------------------------------------------------------
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -46,27 +46,27 @@ nsHttpChannelAuthProvider::nsHttpChannel
 {
     // grab a reference to the handler to ensure that it doesn't go away.
     nsHttpHandler *handler = gHttpHandler;
     NS_ADDREF(handler);
 }
 
 nsHttpChannelAuthProvider::~nsHttpChannelAuthProvider()
 {
-    NS_ASSERTION(!mAuthChannel, "Disconnect wasn't called");
+    MOZ_ASSERT(!mAuthChannel, "Disconnect wasn't called");
 
     // release our reference to the handler
     nsHttpHandler *handler = gHttpHandler;
     NS_RELEASE(handler);
 }
 
 NS_IMETHODIMP
 nsHttpChannelAuthProvider::Init(nsIHttpAuthenticableChannel *channel)
 {
-    NS_ASSERTION(channel, "channel expected!");
+    MOZ_ASSERT(channel, "channel expected!");
 
     mAuthChannel = channel;
 
     nsresult rv = mAuthChannel->GetURI(getter_AddRefs(mURI));
     if (NS_FAILED(rv)) return rv;
 
     mAuthChannel->GetIsSSL(&mUsingSSL);
     if (NS_FAILED(rv)) return rv;
@@ -90,17 +90,17 @@ nsHttpChannelAuthProvider::Init(nsIHttpA
 NS_IMETHODIMP
 nsHttpChannelAuthProvider::ProcessAuthentication(uint32_t httpStatus,
                                                  bool     SSLConnectFailed)
 {
     LOG(("nsHttpChannelAuthProvider::ProcessAuthentication "
          "[this=%p channel=%p code=%u SSLConnectFailed=%d]\n",
          this, mAuthChannel, httpStatus, SSLConnectFailed));
 
-    NS_ASSERTION(mAuthChannel, "Channel not initialized");
+    MOZ_ASSERT(mAuthChannel, "Channel not initialized");
 
     nsCOMPtr<nsIProxyInfo> proxyInfo;
     nsresult rv = mAuthChannel->GetProxyInfo(getter_AddRefs(proxyInfo));
     if (NS_FAILED(rv)) return rv;
     if (proxyInfo) {
         mProxyInfo = do_QueryInterface(proxyInfo);
         if (!mProxyInfo) return NS_ERROR_NO_INTERFACE;
     }
@@ -153,17 +153,17 @@ nsHttpChannelAuthProvider::ProcessAuthen
 }
 
 NS_IMETHODIMP
 nsHttpChannelAuthProvider::AddAuthorizationHeaders()
 {
     LOG(("nsHttpChannelAuthProvider::AddAuthorizationHeaders? "
          "[this=%p channel=%p]\n", this, mAuthChannel));
 
-    NS_ASSERTION(mAuthChannel, "Channel not initialized");
+    MOZ_ASSERT(mAuthChannel, "Channel not initialized");
 
     nsCOMPtr<nsIProxyInfo> proxyInfo;
     nsresult rv = mAuthChannel->GetProxyInfo(getter_AddRefs(proxyInfo));
     if (NS_FAILED(rv)) return rv;
     if (proxyInfo) {
         mProxyInfo = do_QueryInterface(proxyInfo);
         if (!mProxyInfo) return NS_ERROR_NO_INTERFACE;
     }
@@ -204,17 +204,17 @@ nsHttpChannelAuthProvider::AddAuthorizat
 }
 
 NS_IMETHODIMP
 nsHttpChannelAuthProvider::CheckForSuperfluousAuth()
 {
     LOG(("nsHttpChannelAuthProvider::CheckForSuperfluousAuth? "
          "[this=%p channel=%p]\n", this, mAuthChannel));
 
-    NS_ASSERTION(mAuthChannel, "Channel not initialized");
+    MOZ_ASSERT(mAuthChannel, "Channel not initialized");
 
     // we've been called because it has been determined that this channel is
     // getting loaded without taking the userpass from the URL.  if the URL
     // contained a userpass, then (provided some other conditions are true),
     // we'll give the user an opportunity to abort the channel as this might be
     // an attempt to spoof a different site (see bug 232567).
     if (!ConfirmAuth(NS_LITERAL_STRING("SuperfluousAuth"), true)) {
         // calling cancel here sets our mStatus and aborts the HTTP
@@ -223,17 +223,17 @@ nsHttpChannelAuthProvider::CheckForSuper
         return NS_ERROR_ABORT;
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpChannelAuthProvider::Cancel(nsresult status)
 {
-    NS_ASSERTION(mAuthChannel, "Channel not initialized");
+    MOZ_ASSERT(mAuthChannel, "Channel not initialized");
 
     if (mAsyncPromptAuthCancelable) {
         mAsyncPromptAuthCancelable->Cancel(status);
         mAsyncPromptAuthCancelable = nullptr;
     }
     return NS_OK;
 }
 
@@ -545,18 +545,18 @@ nsHttpChannelAuthProvider::GetAuthorizat
                                                    nsCSubstring&        scheme,
                                                    const char*&         host,
                                                    int32_t&             port,
                                                    nsCSubstring&        path,
                                                    nsHttpAuthIdentity*& ident,
                                                    nsISupports**&       continuationState)
 {
     if (proxyAuth) {
-        NS_ASSERTION (UsingHttpProxy(),
-                      "proxyAuth is true, but no HTTP proxy is configured!");
+        MOZ_ASSERT (UsingHttpProxy(),
+                    "proxyAuth is true, but no HTTP proxy is configured!");
 
         host = ProxyHost();
         port = ProxyPort();
         ident = &mProxyIdent;
         scheme.AssignLiteral("http");
 
         continuationState = &mProxyAuthContinuationState;
     }
@@ -1034,17 +1034,17 @@ NS_IMETHODIMP nsHttpChannelAuthProvider:
                holder->User().get(),
                holder->Password().get());
 
     nsAutoCString unused;
     nsCOMPtr<nsIHttpAuthenticator> auth;
     rv = GetAuthenticator(mCurrentChallenge.get(), unused,
                           getter_AddRefs(auth));
     if (NS_FAILED(rv)) {
-        NS_ASSERTION(false, "GetAuthenticator failed");
+        MOZ_ASSERT(false, "GetAuthenticator failed");
         OnAuthCancelled(aContext, true);
         return NS_OK;
     }
 
     nsXPIDLCString creds;
     rv = GenCredsAndSetEntry(auth, mProxyAuth,
                              scheme.get(), host, port, path.get(),
                              realm.get(), mCurrentChallenge.get(), *ident,
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -104,18 +104,18 @@ nsresult
 nsHttpConnection::Init(nsHttpConnectionInfo *info,
                        uint16_t maxHangTime,
                        nsISocketTransport *transport,
                        nsIAsyncInputStream *instream,
                        nsIAsyncOutputStream *outstream,
                        nsIInterfaceRequestor *callbacks,
                        PRIntervalTime rtt)
 {
-    NS_ABORT_IF_FALSE(transport && instream && outstream,
-                      "invalid socket information");
+    MOZ_ASSERT(transport && instream && outstream,
+               "invalid socket information");
     LOG(("nsHttpConnection::Init [this=%p "
          "transport=%p instream=%p outstream=%p rtt=%d]\n",
          this, transport, instream, outstream,
          PR_IntervalToMilliseconds(rtt)));
 
     NS_ENSURE_ARG_POINTER(info);
     NS_ENSURE_TRUE(!mConnInfo, NS_ERROR_ALREADY_INITIALIZED);
 
@@ -140,17 +140,17 @@ nsHttpConnection::Init(nsHttpConnectionI
     return NS_OK;
 }
 
 void
 nsHttpConnection::StartSpdy(uint8_t spdyVersion)
 {
     LOG(("nsHttpConnection::StartSpdy [this=%p]\n", this));
 
-    NS_ABORT_IF_FALSE(!mSpdySession, "mSpdySession should be null");
+    MOZ_ASSERT(!mSpdySession);
 
     mUsingSpdyVersion = spdyVersion;
     mEverUsedSpdy = true;
 
     // Setting the connection as reused allows some transactions that fail
     // with NS_ERROR_NET_RESET to be restarted and SPDY uses that code
     // to handle clean rejections (such as those that arrived after
     // a server goaway was generated).
@@ -162,35 +162,35 @@ nsHttpConnection::StartSpdy(uint8_t spdy
 
     nsTArray<nsRefPtr<nsAHttpTransaction> > list;
     nsresult rv = mTransaction->TakeSubTransactions(list);
 
     if (rv == NS_ERROR_ALREADY_OPENED) {
         // Has the interface for TakeSubTransactions() changed?
         LOG(("TakeSubTranscations somehow called after "
              "nsAHttpTransaction began processing\n"));
-        NS_ABORT_IF_FALSE(false,
-                          "TakeSubTranscations somehow called after "
-                          "nsAHttpTransaction began processing");
+        MOZ_ASSERT(false,
+                   "TakeSubTranscations somehow called after "
+                   "nsAHttpTransaction began processing");
         mTransaction->Close(NS_ERROR_ABORT);
         return;
     }
 
     if (NS_FAILED(rv) && rv != NS_ERROR_NOT_IMPLEMENTED) {
         // Has the interface for TakeSubTransactions() changed?
         LOG(("unexpected rv from nnsAHttpTransaction::TakeSubTransactions()"));
-        NS_ABORT_IF_FALSE(false,
-                          "unexpected result from "
-                          "nsAHttpTransaction::TakeSubTransactions()");
+        MOZ_ASSERT(false,
+                   "unexpected result from "
+                   "nsAHttpTransaction::TakeSubTransactions()");
         mTransaction->Close(NS_ERROR_ABORT);
         return;
     }
 
     if (NS_FAILED(rv)) { // includes NS_ERROR_NOT_IMPLEMENTED
-        NS_ABORT_IF_FALSE(list.IsEmpty(), "sub transaction list not empty");
+        MOZ_ASSERT(list.IsEmpty(), "sub transaction list not empty");
 
         // This is ok - treat mTransaction as a single real request.
         // Wrap the old http transaction into the new spdy session
         // as the first stream.
         mSpdySession = ASpdySession::NewSpdySession(spdyVersion,
                                                     mTransaction, mSocketTransport,
                                                     mPriority);
         LOG(("nsHttpConnection::StartSpdy moves single transaction %p "
@@ -211,17 +211,17 @@ nsHttpConnection::StartSpdy(uint8_t spdy
             if (!mSpdySession) {
                 mSpdySession = ASpdySession::NewSpdySession(spdyVersion,
                                                             list[index], mSocketTransport, 
                                                             mPriority);
             }
             else {
                 // AddStream() cannot fail
                 if (!mSpdySession->AddStream(list[index], mPriority)) {
-                    NS_ABORT_IF_FALSE(false, "SpdySession::AddStream failed");
+                    MOZ_ASSERT(false, "SpdySession::AddStream failed");
                     LOG(("SpdySession::AddStream failed\n"));
                     mTransaction->Close(NS_ERROR_ABORT);
                     return;
                 }
             }
         }
     }
 
@@ -233,20 +233,19 @@ nsHttpConnection::StartSpdy(uint8_t spdy
 bool
 nsHttpConnection::EnsureNPNComplete()
 {
     // NPN is only used by SPDY right now.
     //
     // If for some reason the components to check on NPN aren't available,
     // this function will just return true to continue on and disable SPDY
 
+    MOZ_ASSERT(mSocketTransport);
     if (!mSocketTransport) {
         // this cannot happen
-        NS_ABORT_IF_FALSE(false,
-                          "EnsureNPNComplete socket transport precondition");
         mNPNComplete = true;
         return true;
     }
 
     if (mNPNComplete)
         return true;
     
     nsresult rv;
@@ -297,17 +296,17 @@ npnComplete:
 }
 
 // called on the socket thread
 nsresult
 nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri)
 {
     nsresult rv;
 
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnection::Activate [this=%x trans=%x caps=%x]\n",
          this, trans, caps));
 
     mPriority = pri;
     if (mTransaction && mUsingSpdyVersion)
         return AddTransaction(trans, pri);
 
     NS_ENSURE_ARG_POINTER(trans);
@@ -321,18 +320,17 @@ nsHttpConnection::Activate(nsAHttpTransa
     trans->GetSecurityCallbacks(getter_AddRefs(callbacks));
     SetSecurityCallbacks(callbacks);
 
     SetupNPN(caps); // only for spdy
 
     // take ownership of the transaction
     mTransaction = trans;
 
-    NS_ABORT_IF_FALSE(!mIdleMonitoring,
-                      "Activating a connection with an Idle Monitor");
+    MOZ_ASSERT(!mIdleMonitoring, "Activating a connection with an Idle Monitor");
     mIdleMonitoring = false;
 
     // set mKeepAlive according to what will be requested
     mKeepAliveMask = mKeepAlive = (caps & NS_HTTP_ALLOW_KEEPALIVE);
 
     // need to handle HTTP CONNECT tunnels if this is the first time if
     // we are tunneling through a proxy
     if (mConnInfo->UsingConnect() && !mCompletedProxyConnect) {
@@ -436,39 +434,39 @@ nsHttpConnection::HandleAlternateProtoco
 }
 
 nsresult
 nsHttpConnection::AddTransaction(nsAHttpTransaction *httpTransaction,
                                  int32_t priority)
 {
     LOG(("nsHttpConnection::AddTransaction for SPDY"));
 
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(mSpdySession && mUsingSpdyVersion,
-                      "AddTransaction to live http connection without spdy");
-    NS_ABORT_IF_FALSE(mTransaction,
-                      "AddTransaction to idle http connection");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mSpdySession && mUsingSpdyVersion,
+               "AddTransaction to live http connection without spdy");
+    MOZ_ASSERT(mTransaction,
+               "AddTransaction to idle http connection");
     
     if (!mSpdySession->AddStream(httpTransaction, priority)) {
-        NS_ABORT_IF_FALSE(0, "AddStream should never fail due to"
-                          "RoomForMore() admission check");
+        MOZ_ASSERT(false, "AddStream should never fail due to"
+                   "RoomForMore() admission check");
         return NS_ERROR_FAILURE;
     }
 
     ResumeSend();
 
     return NS_OK;
 }
 
 void
 nsHttpConnection::Close(nsresult reason)
 {
     LOG(("nsHttpConnection::Close [this=%x reason=%x]\n", this, reason));
 
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (NS_FAILED(reason)) {
         if (mIdleMonitoring)
             EndIdleMonitoring();
 
         if (mSocketTransport) {
             mSocketTransport->SetEventSink(nullptr, nullptr);
 
@@ -499,19 +497,17 @@ nsHttpConnection::Close(nsresult reason)
     }
 }
 
 // called on the socket thread
 nsresult
 nsHttpConnection::ProxyStartSSL()
 {
     LOG(("nsHttpConnection::ProxyStartSSL [this=%x]\n", this));
-#ifdef DEBUG
-    NS_PRECONDITION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-#endif
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsCOMPtr<nsISupports> securityInfo;
     nsresult rv = mSocketTransport->GetSecurityInfo(getter_AddRefs(securityInfo));
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsISSLSocketControl> ssl = do_QueryInterface(securityInfo, &rv);
     if (NS_FAILED(rv)) return rv;
 
@@ -704,19 +700,19 @@ nsresult
 nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans,
                                      nsHttpRequestHead *requestHead,
                                      nsHttpResponseHead *responseHead,
                                      bool *reset)
 {
     LOG(("nsHttpConnection::OnHeadersAvailable [this=%p trans=%p response-head=%p]\n",
         this, trans, responseHead));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     NS_ENSURE_ARG_POINTER(trans);
-    NS_ASSERTION(responseHead, "No response head?");
+    MOZ_ASSERT(responseHead, "No response head?");
 
     // If the server issued an explicit timeout, then we need to close down the
     // socket transport.  We pass an error code of NS_ERROR_NET_RESET to
     // trigger the transactions 'restart' mechanism.  We tell it to reset its
     // response headers so that it will be ready to receive the new response.
     uint16_t responseStatus = responseHead->Status();
     if (responseStatus == 408) {
         Close(NS_ERROR_NET_RESET);
@@ -845,34 +841,34 @@ nsHttpConnection::OnHeadersAvailable(nsA
     if (!mProxyConnectStream)
         HandleAlternateProtocol(responseHead);
 
     // If we're doing a proxy connect, we need to check whether or not
     // it was successful.  If so, we have to reset the transaction and step-up
     // the socket connection if using SSL. Finally, we have to wake up the
     // socket write request.
     if (mProxyConnectStream) {
-        NS_ABORT_IF_FALSE(!mUsingSpdyVersion,
-                          "SPDY NPN Complete while using proxy connect stream");
+        MOZ_ASSERT(!mUsingSpdyVersion,
+                   "SPDY NPN Complete while using proxy connect stream");
         mProxyConnectStream = 0;
         if (responseStatus == 200) {
             LOG(("proxy CONNECT succeeded! ssl=%s\n",
                  mConnInfo->UsingSSL() ? "true" :"false"));
             *reset = true;
             nsresult rv;
             if (mConnInfo->UsingSSL()) {
                 rv = ProxyStartSSL();
                 if (NS_FAILED(rv)) // XXX need to handle this for real
                     LOG(("ProxyStartSSL failed [rv=%x]\n", rv));
             }
             mCompletedProxyConnect = true;
             mProxyConnectInProgress = false;
             rv = mSocketOut->AsyncWait(this, 0, 0, nullptr);
             // XXX what if this fails -- need to handle this error
-            NS_ASSERTION(NS_SUCCEEDED(rv), "mSocketOut->AsyncWait failed");
+            MOZ_ASSERT(NS_SUCCEEDED(rv), "mSocketOut->AsyncWait failed");
         }
         else {
             LOG(("proxy CONNECT failed! ssl=%s\n",
                  mConnInfo->UsingSSL() ? "true" :"false"));
             mTransaction->SetProxyConnectFailed();
         }
     }
     
@@ -948,17 +944,17 @@ nsHttpConnection::TakeTransport(nsISocke
     mSocketOut = nullptr;
     
     return NS_OK;
 }
 
 void
 nsHttpConnection::ReadTimeoutTick(PRIntervalTime now)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // make sure timer didn't tick before Activate()
     if (!mTransaction)
         return;
 
     // Spdy implements some timeout handling using the SPDY ping frame.
     if (mSpdySession) {
         mSpdySession->ReadTimeoutTick(now);
@@ -985,17 +981,17 @@ nsHttpConnection::ReadTimeoutTick(PRInte
         pipelineDepth > 1) {
 
         // this just reschedules blocked transactions. no transaction
         // is aborted completely.
         LOG(("cancelling pipeline due to a %ums stall - depth %d\n",
              PR_IntervalToMilliseconds(delta), pipelineDepth));
 
         nsHttpPipeline *pipeline = mTransaction->QueryPipeline();
-        NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline");
+        MOZ_ASSERT(pipeline, "pipelinedepth > 1 without pipeline");
         // code this defensively for the moment and check for null in opt build
         // This will reschedule blocked members of the pipeline, but the
         // blocking transaction (i.e. response 0) will not be changed.
         if (pipeline) {
             pipeline->CancelPipeline(NS_ERROR_NET_TIMEOUT);
             LOG(("Rescheduling the head of line blocked members of a pipeline "
                  "because reschedule-timeout idle interval exceeded"));
         }
@@ -1020,17 +1016,17 @@ nsHttpConnection::ReadTimeoutTick(PRInte
 
     // This will also close the connection
     CloseTransaction(mTransaction, NS_ERROR_NET_TIMEOUT);
 }
 
 void
 nsHttpConnection::GetSecurityInfo(nsISupports **secinfo)
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mSocketTransport) {
         if (NS_FAILED(mSocketTransport->GetSecurityInfo(secinfo)))
             *secinfo = nullptr;
     }
 }
 
 void
@@ -1058,31 +1054,31 @@ nsHttpConnection::PushBack(const char *d
     return NS_OK;
 }
 
 nsresult
 nsHttpConnection::ResumeSend()
 {
     LOG(("nsHttpConnection::ResumeSend [this=%p]\n", this));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mSocketOut)
         return mSocketOut->AsyncWait(this, 0, 0, nullptr);
 
     NS_NOTREACHED("no socket output stream");
     return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
 nsHttpConnection::ResumeRecv()
 {
     LOG(("nsHttpConnection::ResumeRecv [this=%p]\n", this));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // the mLastReadTime timestamp is used for finding slowish readers
     // and can be pretty sensitive. For that reason we actually reset it
     // when we ask to read (resume recv()) so that when we get called back
     // with actual read data in OnSocketReadable() we are only measuring
     // the latency between those two acts and not all the processing that
     // may get done before the ResumeRecv() call
     mLastReadTime = PR_IntervalNow();
@@ -1093,32 +1089,32 @@ nsHttpConnection::ResumeRecv()
     NS_NOTREACHED("no socket input stream");
     return NS_ERROR_UNEXPECTED;
 }
 
 void
 nsHttpConnection::BeginIdleMonitoring()
 {
     LOG(("nsHttpConnection::BeginIdleMonitoring [this=%p]\n", this));
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(!mTransaction, "BeginIdleMonitoring() while active");
-    NS_ABORT_IF_FALSE(!mUsingSpdyVersion, "Idle monitoring of spdy not allowed");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(!mTransaction, "BeginIdleMonitoring() while active");
+    MOZ_ASSERT(!mUsingSpdyVersion, "Idle monitoring of spdy not allowed");
 
     LOG(("Entering Idle Monitoring Mode [this=%p]", this));
     mIdleMonitoring = true;
     if (mSocketIn)
         mSocketIn->AsyncWait(this, 0, 0, nullptr);
 }
 
 void
 nsHttpConnection::EndIdleMonitoring()
 {
     LOG(("nsHttpConnection::EndIdleMonitoring [this=%p]\n", this));
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(!mTransaction, "EndIdleMonitoring() while active");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(!mTransaction, "EndIdleMonitoring() while active");
 
     if (mIdleMonitoring) {
         LOG(("Leaving Idle Monitoring Mode [this=%p]", this));
         mIdleMonitoring = false;
         if (mSocketIn)
             mSocketIn->AsyncWait(nullptr, 0, 0, nullptr);
     }
 }
@@ -1128,18 +1124,18 @@ nsHttpConnection::EndIdleMonitoring()
 //-----------------------------------------------------------------------------
 
 void
 nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason)
 {
     LOG(("nsHttpConnection::CloseTransaction[this=%x trans=%x reason=%x]\n",
         this, trans, reason));
 
-    NS_ASSERTION(trans == mTransaction, "wrong transaction");
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(trans == mTransaction, "wrong transaction");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mCurrentBytesRead > mMaxBytesRead)
         mMaxBytesRead = mCurrentBytesRead;
 
     // mask this error code because its not a real error.
     if (reason == NS_BASE_STREAM_CLOSED)
         reason = NS_OK;
 
@@ -1368,17 +1364,17 @@ nsHttpConnection::OnSocketReadable()
              PR_IntervalToMilliseconds(delta)));
 
         gHttpHandler->ConnMgr()->PipelineFeedbackInfo(
             mConnInfo, nsHttpConnectionMgr::BadSlowReadMajor, this, 0);
 
         if (gHttpHandler->GetPipelineRescheduleOnTimeout() &&
             mTransaction->PipelineDepth() > 1) {
             nsHttpPipeline *pipeline = mTransaction->QueryPipeline();
-            NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline");
+            MOZ_ASSERT(pipeline, "pipelinedepth > 1 without pipeline");
             // code this defensively for the moment and check for null
             // This will reschedule blocked members of the pipeline, but the
             // blocking transaction (i.e. response 0) will not be changed.
             if (pipeline) {
                 pipeline->CancelPipeline(NS_ERROR_NET_TIMEOUT);
                 LOG(("Rescheduling the head of line blocked members of a "
                      "pipeline because reschedule-timeout idle interval "
                      "exceeded"));
@@ -1440,18 +1436,18 @@ nsHttpConnection::OnSocketReadable()
 nsresult
 nsHttpConnection::SetupProxyConnect()
 {
     const char *val;
 
     LOG(("nsHttpConnection::SetupProxyConnect [this=%x]\n", this));
 
     NS_ENSURE_TRUE(!mProxyConnectStream, NS_ERROR_ALREADY_INITIALIZED);
-    NS_ABORT_IF_FALSE(!mUsingSpdyVersion,
-                      "SPDY NPN Complete while using proxy connect stream");
+    MOZ_ASSERT(!mUsingSpdyVersion,
+               "SPDY NPN Complete while using proxy connect stream");
 
     nsAutoCString buf;
     nsresult rv = nsHttpHandler::GenerateHostPort(
             nsDependentCString(mConnInfo->Host()), mConnInfo->Port(), buf);
     if (NS_FAILED(rv))
         return rv;
 
     // CONNECT host:port HTTP/1.1
@@ -1499,21 +1495,21 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConn
 //-----------------------------------------------------------------------------
 // nsHttpConnection::nsIInputStreamCallback
 //-----------------------------------------------------------------------------
 
 // called on the socket transport thread
 NS_IMETHODIMP
 nsHttpConnection::OnInputStreamReady(nsIAsyncInputStream *in)
 {
-    NS_ASSERTION(in == mSocketIn, "unexpected stream");
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(in == mSocketIn, "unexpected stream");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mIdleMonitoring) {
-        NS_ABORT_IF_FALSE(!mTransaction, "Idle Input Event While Active");
+        MOZ_ASSERT(!mTransaction, "Idle Input Event While Active");
 
         // The only read event that is protocol compliant for an idle connection
         // is an EOF, which we check for with CanReuse(). If the data is
         // something else then just ignore it and suspend checking for EOF -
         // our normal timers or protocol stack are the place to deal with
         // any exception logic.
 
         if (!CanReuse()) {
@@ -1541,18 +1537,18 @@ nsHttpConnection::OnInputStreamReady(nsI
 
 //-----------------------------------------------------------------------------
 // nsHttpConnection::nsIOutputStreamCallback
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpConnection::OnOutputStreamReady(nsIAsyncOutputStream *out)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(out == mSocketOut, "unexpected socket");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(out == mSocketOut, "unexpected socket");
 
     // if the transaction was dropped...
     if (!mTransaction) {
         LOG(("  no transaction; ignoring event\n"));
         return NS_OK;
     }
 
     nsresult rv = OnSocketWritable();
@@ -1589,17 +1585,17 @@ nsHttpConnection::GetInterface(const nsI
     //       the socket transport thread.  If that weren't the case, then we'd
     //       have to worry about the possibility of mTransaction going away
     //       part-way through this function call.  See CloseTransaction.
 
     // NOTE - there is a bug here, the call to getinterface is proxied off the
     // nss thread, not the ui thread as the above comment says. So there is
     // indeed a chance of mTransaction going away. bug 615342
 
-    NS_ASSERTION(PR_GetCurrentThread() != gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() != gSocketThread);
 
     nsCOMPtr<nsIInterfaceRequestor> callbacks;
     {
         MutexAutoLock lock(mCallbacksLock);
         callbacks = mCallbacks;
     }
     if (callbacks)
         return callbacks->GetInterface(iid, result);
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -250,17 +250,17 @@ nsHttpConnectionMgr::Observe(nsISupports
         nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
         if (timer == mTimer) {
             PruneDeadConnections();
         }
         else if (timer == mTimeoutTick) {
             TimeoutTick();
         }
         else {
-            NS_ABORT_IF_FALSE(false, "unexpected timer-callback");
+            MOZ_ASSERT(false, "unexpected timer-callback");
             LOG(("Unexpected timer object\n"));
             return NS_ERROR_UNEXPECTED;
         }
     }
 
     return NS_OK;
 }
 
@@ -484,17 +484,17 @@ nsHttpConnectionMgr::LookupConnectionEnt
     
     // Neither conn nor trans found in preferred, use the default entry
     return ent;
 }
 
 nsresult
 nsHttpConnectionMgr::CloseIdleConnection(nsHttpConnection *conn)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::CloseIdleConnection %p conn=%p",
          this, conn));
 
     if (!conn->ConnectionInfo())
         return NS_ERROR_UNEXPECTED;
 
     nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(),
                                                    conn, nullptr);
@@ -515,17 +515,17 @@ nsHttpConnectionMgr::CloseIdleConnection
 // the connection manager. The connection entry associated with the
 // connection is then updated to indicate whether or not we want to use
 // spdy with that host and update the preliminary preferred host
 // entries used for de-sharding hostsnames.
 void
 nsHttpConnectionMgr::ReportSpdyConnection(nsHttpConnection *conn,
                                           bool usingSpdy)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     
     nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(),
                                                    conn, nullptr);
 
     if (!ent)
         return;
 
     ent->mTestedSpdy = true;
@@ -1030,17 +1030,17 @@ nsHttpConnectionMgr::ShutdownPassCB(cons
     return PL_DHASH_REMOVE;
 }
 
 //-----------------------------------------------------------------------------
 
 bool
 nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent, bool considerAll)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     LOG(("nsHttpConnectionMgr::ProcessPendingQForEntry [ci=%s]\n",
          ent->mConnInfo->HashKey().get()));
 
     ProcessSpdyPendingQ(ent);
 
     nsHttpTransaction *trans;
     nsresult rv;
@@ -1088,28 +1088,28 @@ nsHttpConnectionMgr::ProcessPendingQForE
         ++i;
     }
     return dispatchedSuccessfully;
 }
 
 bool
 nsHttpConnectionMgr::ProcessPendingQForEntry(nsHttpConnectionInfo *ci)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsConnectionEntry *ent = mCT.Get(ci->HashKey());
     if (ent)
         return ProcessPendingQForEntry(ent, false);
     return false;
 }
 
 bool
 nsHttpConnectionMgr::SupportsPipelining(nsHttpConnectionInfo *ci)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsConnectionEntry *ent = mCT.Get(ci->HashKey());
     if (ent)
         return ent->SupportsPipelining();
     return false;
 }
 
 // nsHttpPipelineFeedback used to hold references across events
@@ -1162,17 +1162,17 @@ nsHttpConnectionMgr::PipelineFeedbackInf
 
     if (ent)
         ent->OnPipelineFeedbackInfo(info, conn, data);
 }
 
 void
 nsHttpConnectionMgr::ReportFailedToProcess(nsIURI *uri)
 {
-    NS_ABORT_IF_FALSE(uri, "precondition");
+    MOZ_ASSERT(uri);
 
     nsAutoCString host;
     int32_t port = -1;
     bool usingSSL = false;
     bool isHttp = false;
 
     nsresult rv = uri->SchemeIs("https", &usingSSL);
     if (NS_SUCCEEDED(rv) && usingSSL)
@@ -1288,17 +1288,17 @@ nsHttpConnectionMgr::ClosePersistentConn
     nsHttpConnectionMgr *self = static_cast<nsHttpConnectionMgr *>(closure);
     self->ClosePersistentConnections(ent);
     return PL_DHASH_NEXT;
 }
 
 bool
 nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // If this host is trying to negotiate a SPDY session right now,
     // don't create any new ssl connections until the result of the
     // negotiation is known.
     
     bool doRestrict = ent->mConnInfo->UsingSSL() &&
         gHttpHandler->IsSpdyEnabled() &&
         (!ent->mTestedSpdy || ent->mUsingSpdy) &&
@@ -1339,17 +1339,17 @@ nsHttpConnectionMgr::RestrictConnections
 //        ephemeral limits
 // returns other NS_ERROR on hard failure conditions
 nsresult
 nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
                                        nsHttpTransaction *trans)
 {
     LOG(("nsHttpConnectionMgr::MakeNewConnection %p ent=%p trans=%p",
          this, ent, trans));
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
         
     uint32_t halfOpenLength = ent->mHalfOpens.Length();
     for (uint32_t i = 0; i < halfOpenLength; i++) {
         if (ent->mHalfOpens[i]->IsSpeculative()) {
             // We've found a speculative connection in the half
             // open list. Remove the speculative bit from it and that
             // connection can later be used for this transaction
             // (or another one in the pending queue) - we don't
@@ -1542,17 +1542,17 @@ nsHttpConnectionMgr::IsUnderPressure(nsC
 //   should be queued until circumstances change
 // returns other ERROR when transaction has a hard failure and should
 //   not remain in the pending queue
 nsresult
 nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
                                             bool onlyReusedConnection,
                                             nsHttpTransaction *trans)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::TryDispatchTransaction without conn "
          "[ci=%s caps=%x]\n",
          ent->mConnInfo->HashKey().get(), uint32_t(trans->Caps())));
 
     nsHttpTransaction::Classifier classification = trans->Classification();
     uint32_t caps = trans->Caps();
 
     // no keep-alive means no pipelines either
@@ -1737,27 +1737,27 @@ nsHttpConnectionMgr::DispatchTransaction
     trans->CancelPacing(NS_OK);
 
     if (conn->UsingSpdy()) {
         LOG(("Spdy Dispatch Transaction via Activate(). Transaction host = %s,"
              "Connection host = %s\n",
              trans->ConnectionInfo()->Host(),
              conn->ConnectionInfo()->Host()));
         rv = conn->Activate(trans, caps, priority);
-        NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch");
+        MOZ_ASSERT(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch");
         if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) {
             AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_SPDY,
                 trans->GetPendingTime(), TimeStamp::Now());
             trans->SetPendingTime(false);
         }
         return rv;
     }
 
-    NS_ABORT_IF_FALSE(conn && !conn->Transaction(),
-                      "DispatchTranaction() on non spdy active connection");
+    MOZ_ASSERT(conn && !conn->Transaction(),
+               "DispatchTranaction() on non spdy active connection");
 
     if (!(caps & NS_HTTP_ALLOW_PIPELINING))
         conn->Classify(nsAHttpTransaction::CLASS_SOLO);
     else
         conn->Classify(trans->Classification());
 
     rv = DispatchAbstractTransaction(ent, trans, caps, conn, priority);
 
@@ -1780,18 +1780,18 @@ nsHttpConnectionMgr::DispatchTransaction
 // concrete nsHttpTransaction
 nsresult
 nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
                                                  nsAHttpTransaction *aTrans,
                                                  uint32_t caps,
                                                  nsHttpConnection *conn,
                                                  int32_t priority)
 {
-    NS_ABORT_IF_FALSE(!conn->UsingSpdy(),
-                      "Spdy Must Not Use DispatchAbstractTransaction");
+    MOZ_ASSERT(!conn->UsingSpdy(),
+               "Spdy Must Not Use DispatchAbstractTransaction");
     LOG(("nsHttpConnectionMgr::DispatchAbstractTransaction "
          "[ci=%s trans=%x caps=%x conn=%x]\n",
          ent->mConnInfo->HashKey().get(), aTrans, caps, conn));
 
     /* Use pipeline datastructure even if connection does not currently qualify
        to pipeline this transaction because a different pipeline-eligible
        transaction might be placed on the active connection. Make an exception
        for CLASS_SOLO as that connection will never pipeline until it goes
@@ -1842,17 +1842,17 @@ nsHttpConnectionMgr::DispatchAbstractTra
     return rv;
 }
 
 nsresult
 nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent,
                                    nsAHttpTransaction *firstTrans,
                                    nsHttpPipeline **result)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     /* form a pipeline here even if nothing is pending so that we
        can stream-feed it as new transactions arrive */
 
     /* the first transaction can go in unconditionally - 1 transaction
        on a nsHttpPipeline object is not a real HTTP pipeline */
    
     nsRefPtr<nsHttpPipeline> pipeline = new nsHttpPipeline();
@@ -1872,32 +1872,32 @@ nsHttpConnectionMgr::ReportProxyTelemetr
         Telemetry::Accumulate(Telemetry::HTTP_PROXY_TYPE, PROXY_HTTP);
     else
         Telemetry::Accumulate(Telemetry::HTTP_PROXY_TYPE, PROXY_SOCKS);
 }
 
 nsresult
 nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // since "adds" and "cancels" are processed asynchronously and because
     // various events might trigger an "add" directly on the socket thread,
     // we must take care to avoid dispatching a transaction that has already
     // been canceled (see bug 190001).
     if (NS_FAILED(trans->Status())) {
         LOG(("  transaction was canceled... dropping event!\n"));
         return NS_OK;
     }
 
     trans->SetPendingTime();
 
     nsresult rv = NS_OK;
     nsHttpConnectionInfo *ci = trans->ConnectionInfo();
-    NS_ASSERTION(ci, "no connection info");
+    MOZ_ASSERT(ci);
 
     nsConnectionEntry *ent = GetOrCreateConnectionEntry(ci);
 
     // SPDY coalescing of hostnames means we might redirect from this
     // connection entry onto the preferred one.
     nsConnectionEntry *preferredEntry = GetSpdyPreferredEnt(ent);
     if (preferredEntry && (preferredEntry != ent)) {
         LOG(("nsHttpConnectionMgr::ProcessNewTransaction trans=%p "
@@ -1914,20 +1914,19 @@ nsHttpConnectionMgr::ProcessNewTransacti
     // to the new connection variable instead of searching for a new one
 
     nsAHttpConnection *wrappedConnection = trans->Connection();
     nsRefPtr<nsHttpConnection> conn;
     if (wrappedConnection)
         conn = dont_AddRef(wrappedConnection->TakeHttpConnection());
 
     if (conn) {
-        NS_ASSERTION(trans->Caps() & NS_HTTP_STICKY_CONNECTION,
-                     "unexpected caps");
-        NS_ABORT_IF_FALSE(((int32_t)ent->mActiveConns.IndexOf(conn)) != -1,
-                          "Sticky Connection Not In Active List");
+        MOZ_ASSERT(trans->Caps() & NS_HTTP_STICKY_CONNECTION);
+        MOZ_ASSERT(((int32_t)ent->mActiveConns.IndexOf(conn)) != -1,
+                   "Sticky Connection Not In Active List");
         trans->SetConnection(nullptr);
         rv = DispatchTransaction(ent, trans, conn);
     }
     else
         rv = TryDispatchTransaction(ent, false, trans);
 
     if (NS_SUCCEEDED(rv)) {
         LOG(("  ProcessNewTransaction Dispatch Immediately trans=%p\n", trans));
@@ -1982,17 +1981,17 @@ nsHttpConnectionMgr::RecvdConnect()
 }
 
 nsresult
 nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent,
                                      nsAHttpTransaction *trans,
                                      uint32_t caps,
                                      bool speculative)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     
     nsRefPtr<nsHalfOpenSocket> sock = new nsHalfOpenSocket(ent, trans, caps);
     nsresult rv = sock->SetupPrimaryStreams();
     NS_ENSURE_SUCCESS(rv, rv);
 
     ent->mHalfOpens.AppendElement(sock);
     mNumHalfOpenConns++;
     if (speculative)
@@ -2023,17 +2022,17 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ
             continue;
  
         ent->mPendingQ.RemoveElementAt(index);
 
         nsresult rv = DispatchTransaction(ent, trans, conn);
         if (NS_FAILED(rv)) {
             // this cannot happen, but if due to some bug it does then
             // close the transaction
-            NS_ABORT_IF_FALSE(false, "Dispatch SPDY Transaction");
+            MOZ_ASSERT(false, "Dispatch SPDY Transaction");
             LOG(("ProcessSpdyPendingQ Dispatch Transaction failed trans=%p\n",
                     trans));
             trans->Close(rv);
         }
         NS_RELEASE(trans);
     }
 }
 
@@ -2045,26 +2044,26 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ
     nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
     self->ProcessSpdyPendingQ(ent);
     return PL_DHASH_NEXT;
 }
 
 void
 nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ(int32_t, void *)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ\n"));
     mCT.Enumerate(ProcessSpdyPendingQCB, this);
 }
 
 nsHttpConnection *
 nsHttpConnectionMgr::GetSpdyPreferredConn(nsConnectionEntry *ent)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(ent, "no connection entry");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(ent);
 
     nsConnectionEntry *preferred = GetSpdyPreferredEnt(ent);
 
     // this entry is spdy-enabled if it is involved in a redirect
     if (preferred)
         // all new connections for this entry will use spdy too
         ent->mUsingSpdy = true;
     else
@@ -2086,17 +2085,17 @@ nsHttpConnectionMgr::GetSpdyPreferredCon
     return conn;
 }
 
 //-----------------------------------------------------------------------------
 
 void
 nsHttpConnectionMgr::OnMsgShutdown(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgShutdown\n"));
 
     mCT.Enumerate(ShutdownPassCB, this);
 
     if (mTimeoutTick) {
         mTimeoutTick->Cancel();
         mTimeoutTick = nullptr;
         mTimeoutTickArmed = false;
@@ -2107,17 +2106,17 @@ nsHttpConnectionMgr::OnMsgShutdown(int32
         new nsConnEvent(this, &nsHttpConnectionMgr::OnMsgShutdownConfirm,
                         0, param);
     NS_DispatchToMainThread(runnable);
 }
 
 void
 nsHttpConnectionMgr::OnMsgShutdownConfirm(int32_t priority, void *param)
 {
-    NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread");
+    MOZ_ASSERT(NS_IsMainThread());
     LOG(("nsHttpConnectionMgr::OnMsgShutdownConfirm\n"));
 
     bool *shutdown = static_cast<bool*>(param);
     *shutdown = true;
 }
 
 void
 nsHttpConnectionMgr::OnMsgNewTransaction(int32_t priority, void *param)
@@ -2130,17 +2129,17 @@ nsHttpConnectionMgr::OnMsgNewTransaction
     if (NS_FAILED(rv))
         trans->Close(rv); // for whatever its worth
     NS_RELEASE(trans);
 }
 
 void
 nsHttpConnectionMgr::OnMsgReschedTransaction(int32_t priority, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgReschedTransaction [trans=%p]\n", param));
 
     nsHttpTransaction *trans = (nsHttpTransaction *) param;
     trans->SetPriority(priority);
 
     nsConnectionEntry *ent = LookupConnectionEntry(trans->ConnectionInfo(),
                                                    nullptr, trans);
 
@@ -2153,17 +2152,17 @@ nsHttpConnectionMgr::OnMsgReschedTransac
     }
 
     NS_RELEASE(trans);
 }
 
 void
 nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p]\n", param));
 
     nsresult closeCode = static_cast<nsresult>(reason);
     nsHttpTransaction *trans = (nsHttpTransaction *) param;
     //
     // if the transaction owns a connection and the transaction is not done,
     // then ask the connection to close the transaction.  otherwise, close the
     // transaction directly (removing it from the pending queue first).
@@ -2186,17 +2185,17 @@ nsHttpConnectionMgr::OnMsgCancelTransact
         trans->Close(closeCode);
     }
     NS_RELEASE(trans);
 }
 
 void
 nsHttpConnectionMgr::OnMsgProcessPendingQ(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     nsHttpConnectionInfo *ci = (nsHttpConnectionInfo *) param;
 
     if (!ci) {
         LOG(("nsHttpConnectionMgr::OnMsgProcessPendingQ [ci=nullptr]\n"));
         // Try and dispatch everything
         mCT.Enumerate(ProcessAllTransactionsCB, this);
         return;
     }
@@ -2213,17 +2212,17 @@ nsHttpConnectionMgr::OnMsgProcessPending
     }
 
     NS_RELEASE(ci);
 }
 
 void
 nsHttpConnectionMgr::OnMsgPruneDeadConnections(int32_t, void *)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgPruneDeadConnections\n"));
 
     // Reset mTimeOfNextWakeUp so that we can find a new shortest value.
     mTimeOfNextWakeUp = UINT64_MAX;
 
     // check canreuse() for all idle connections plus any active connections on
     // connection entries that are using spdy.
     if (mNumIdleConns || (mNumActiveConns && gHttpHandler->IsSpdyEnabled()))
@@ -2242,17 +2241,17 @@ nsHttpConnectionMgr::OnMsgDoShiftReloadC
     mCT.Enumerate(ClosePersistentConnectionsCB, this);
     if (ci)
         ResetIPFamilyPreference(ci);
 }
 
 void
 nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection [conn=%p]\n", param));
 
     nsHttpConnection *conn = (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
@@ -2260,17 +2259,17 @@ nsHttpConnectionMgr::OnMsgReclaimConnect
 
     nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(),
                                                    conn, nullptr);
     nsHttpConnectionInfo *ci = nullptr;
 
     if (!ent) {
         // this should never happen
         LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection ent == null\n"));
-        NS_ABORT_IF_FALSE(false, "no connection entry");
+        MOZ_ASSERT(false, "no connection entry");
         NS_ADDREF(ci = conn->ConnectionInfo());
     }
     else {
         NS_ADDREF(ci = ent->mConnInfo);
 
         // If the connection is in the active list, remove that entry
         // and the reference held by the mActiveConns list.
         // This is never the final reference on conn as the event context
@@ -2331,17 +2330,17 @@ nsHttpConnectionMgr::OnMsgReclaimConnect
  
     OnMsgProcessPendingQ(0, ci); // releases |ci|
     NS_RELEASE(conn);
 }
 
 void
 nsHttpConnectionMgr::OnMsgCompleteUpgrade(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     nsCompleteUpgradeData *data = (nsCompleteUpgradeData *) param;
     LOG(("nsHttpConnectionMgr::OnMsgCompleteUpgrade "
          "this=%p conn=%p listener=%p\n", this, data->mConn.get(),
          data->mUpgradeListener.get()));
 
     nsCOMPtr<nsISocketTransport> socketTransport;
     nsCOMPtr<nsIAsyncInputStream> socketIn;
     nsCOMPtr<nsIAsyncOutputStream> socketOut;
@@ -2395,29 +2394,29 @@ nsHttpConnectionMgr::nsConnectionEntry::
         gHttpHandler->ConnMgr()->RemoveSpdyPreferredEnt(mCoalescingKey);
 
     NS_RELEASE(mConnInfo);
 }
 
 void
 nsHttpConnectionMgr::OnMsgProcessFeedback(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     nsHttpPipelineFeedback *fb = (nsHttpPipelineFeedback *)param;
     
     PipelineFeedbackInfo(fb->mConnInfo, fb->mInfo, fb->mConn, fb->mData);
     delete fb;
 }
 
 // Read Timeout Tick handlers
 
 void
 nsHttpConnectionMgr::ActivateTimeoutTick()
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     LOG(("nsHttpConnectionMgr::ActivateTimeoutTick() "
          "this=%p mTimeoutTick=%p\n"));
 
     // The timer tick should be enabled if it is not already pending.
     // Upon running the tick will rearm itself if there are active
     // connections available.
 
     if (mTimeoutTick && mTimeoutTickArmed)
@@ -2427,26 +2426,26 @@ nsHttpConnectionMgr::ActivateTimeoutTick
         mTimeoutTick = do_CreateInstance(NS_TIMER_CONTRACTID);
         if (!mTimeoutTick) {
             NS_WARNING("failed to create timer for http timeout management");
             return;
         }
         mTimeoutTick->SetTarget(mSocketThreadTarget);
     }
 
-    NS_ABORT_IF_FALSE(!mTimeoutTickArmed, "timer tick armed");
+    MOZ_ASSERT(!mTimeoutTickArmed, "timer tick armed");
     mTimeoutTickArmed = true;
     mTimeoutTick->Init(this, 1000, nsITimer::TYPE_REPEATING_SLACK);
 }
 
 void
 nsHttpConnectionMgr::TimeoutTick()
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(mTimeoutTick, "no readtimeout tick");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mTimeoutTick, "no readtimeout tick");
 
     LOG(("nsHttpConnectionMgr::TimeoutTick active=%d\n",
          mNumActiveConns));
 
     mCT.Enumerate(TimeoutTickCB, this);
 }
 
 PLDHashOperator
@@ -2546,17 +2545,17 @@ nsConnectionHandle::TakeTransport(nsISoc
                                   nsIAsyncOutputStream **aOutputStream)
 {
     return mConn->TakeTransport(aTransport, aInputStream, aOutputStream);
 }
 
 void
 nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsRefPtr<NullHttpTransaction> trans =
         dont_AddRef(static_cast<NullHttpTransaction *>(param));
 
     LOG(("nsHttpConnectionMgr::OnMsgSpeculativeConnect [ci=%s]\n",
          trans->ConnectionInfo()->HashKey().get()));
 
     nsConnectionEntry *ent =
@@ -2618,26 +2617,26 @@ nsHalfOpenSocket::nsHalfOpenSocket(nsCon
                                    nsAHttpTransaction *trans,
                                    uint32_t caps)
     : mEnt(ent),
       mTransaction(trans),
       mCaps(caps),
       mSpeculative(false),
       mHasConnected(false)
 {
-    NS_ABORT_IF_FALSE(ent && trans, "constructor with null arguments");
+    MOZ_ASSERT(ent && trans, "constructor with null arguments");
     LOG(("Creating nsHalfOpenSocket [this=%p trans=%p ent=%s]\n",
          this, trans, ent->mConnInfo->Host()));
 }
 
 nsHttpConnectionMgr::nsHalfOpenSocket::~nsHalfOpenSocket()
 {
-    NS_ABORT_IF_FALSE(!mStreamOut, "streamout not null");
-    NS_ABORT_IF_FALSE(!mBackupStreamOut, "backupstreamout not null");
-    NS_ABORT_IF_FALSE(!mSynTimer, "syntimer not null");
+    MOZ_ASSERT(!mStreamOut);
+    MOZ_ASSERT(!mBackupStreamOut);
+    MOZ_ASSERT(!mSynTimer);
     LOG(("Destroying nsHalfOpenSocket [this=%p]\n", this));
     
     if (mEnt)
         mEnt->RemoveHalfOpen(this);
 }
 
 nsresult
 nsHttpConnectionMgr::
@@ -2720,17 +2719,17 @@ nsHalfOpenSocket::SetupStreams(nsISocket
         gHttpHandler->ConnMgr()->StartedConnect();
 
     return rv;
 }
 
 nsresult
 nsHttpConnectionMgr::nsHalfOpenSocket::SetupPrimaryStreams()
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsresult rv;
 
     mPrimarySynStarted = TimeStamp::Now();
     rv = SetupStreams(getter_AddRefs(mSocketTransport),
                       getter_AddRefs(mStreamIn),
                       getter_AddRefs(mStreamOut),
                       false);
@@ -2765,17 +2764,17 @@ nsHttpConnectionMgr::nsHalfOpenSocket::S
     }
     return rv;
 }
 
 void
 nsHttpConnectionMgr::nsHalfOpenSocket::SetupBackupTimer()
 {
     uint16_t timeout = gHttpHandler->GetIdleSynTimeout();
-    NS_ABORT_IF_FALSE(!mSynTimer, "timer already initd");
+    MOZ_ASSERT(!mSynTimer, "timer already initd");
     
     if (timeout && !mTransaction->IsDone()) {
         // Setup the timer that will establish a backup socket
         // if we do not get a writable event on the main one.
         // We do this because a lost SYN takes a very long time
         // to repair at the TCP level.
         //
         // Failure to setup the timer is something we can live with,
@@ -2807,17 +2806,17 @@ nsHttpConnectionMgr::nsHalfOpenSocket::C
 }
 
 void
 nsHttpConnectionMgr::nsHalfOpenSocket::Abandon()
 {
     LOG(("nsHalfOpenSocket::Abandon [this=%p ent=%s]",
          this, mEnt->mConnInfo->Host()));
 
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsRefPtr<nsHalfOpenSocket> deleteProtector(this);
 
     if (mStreamOut) {
         gHttpHandler->ConnMgr()->RecvdConnect();
         mStreamOut->AsyncWait(nullptr, 0, 0, nullptr);
         mStreamOut = nullptr;
     }
@@ -2842,33 +2841,33 @@ nsHttpConnectionMgr::nsHalfOpenSocket::D
 
     return (epoch - mPrimarySynStarted).ToMilliseconds();
 }
 
 
 NS_IMETHODIMP // method for nsITimerCallback
 nsHttpConnectionMgr::nsHalfOpenSocket::Notify(nsITimer *timer)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(timer == mSynTimer, "wrong timer");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(timer == mSynTimer, "wrong timer");
 
     SetupBackupStreams();
 
     mSynTimer = nullptr;
     return NS_OK;
 }
 
 // method for nsIAsyncOutputStreamCallback
 NS_IMETHODIMP
 nsHttpConnectionMgr::
 nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ABORT_IF_FALSE(out == mStreamOut ||
-                      out == mBackupStreamOut, "stream mismatch");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(out == mStreamOut || out == mBackupStreamOut,
+               "stream mismatch");
     LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n", 
          this, mEnt->mConnInfo->Host(),
          out == mStreamOut ? "primary" : "backup"));
     int32_t index;
     nsresult rv;
     
     gHttpHandler->ConnMgr()->RecvdConnect();
 
@@ -2925,18 +2924,18 @@ nsHalfOpenSocket::OnOutputStreamReady(ns
 
     // This half-open socket has created a connection.  This flag excludes it
     // from counter of actual connections used for checking limits.
     mHasConnected = true;
 
     // if this is still in the pending list, remove it and dispatch it
     index = mEnt->mPendingQ.IndexOf(mTransaction);
     if (index != -1) {
-        NS_ABORT_IF_FALSE(!mSpeculative,
-                          "Speculative Half Open found mTranscation");
+        MOZ_ASSERT(!mSpeculative,
+                   "Speculative Half Open found mTranscation");
         nsRefPtr<nsHttpTransaction> temp = dont_AddRef(mEnt->mPendingQ[index]);
         mEnt->mPendingQ.RemoveElementAt(index);
         gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt);
         rv = gHttpHandler->ConnMgr()->DispatchTransaction(mEnt, temp, conn);
     }
     else {
         // this transaction was dispatched off the pending q before all the
         // sockets established themselves.
@@ -2989,17 +2988,17 @@ nsHalfOpenSocket::OnOutputStreamReady(ns
 
 // method for nsITransportEventSink
 NS_IMETHODIMP
 nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans,
                                                          nsresult status,
                                                          uint64_t progress,
                                                          uint64_t progressMax)
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mTransaction)
         mTransaction->OnTransportStatus(trans, status, progress);
 
     if (trans != mSocketTransport)
         return NS_OK;
 
     // if we are doing spdy coalescing and haven't recorded the ip address
@@ -3080,17 +3079,17 @@ nsHttpConnectionMgr::nsHalfOpenSocket::G
 
 
 nsHttpConnection *
 nsHttpConnectionMgr::nsConnectionHandle::TakeHttpConnection()
 {
     // return our connection object to the caller and clear it internally
     // do not drop our reference - the caller now owns it.
 
-    NS_ASSERTION(mConn, "no connection");
+    MOZ_ASSERT(mConn);
     nsHttpConnection *conn = mConn;
     mConn = nullptr;
     return conn;
 }
 
 uint32_t
 nsHttpConnectionMgr::nsConnectionHandle::CancelPipeline(nsresult reason)
 {
@@ -3150,17 +3149,17 @@ nsHttpConnectionMgr::nsConnectionEntry::
     
 void
 nsHttpConnectionMgr::
 nsConnectionEntry::OnPipelineFeedbackInfo(
     nsHttpConnectionMgr::PipelineFeedbackInfoType info,
     nsHttpConnection *conn,
     uint32_t data)
 {
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     
     if (mPipelineState == PS_YELLOW) {
         if (info & kPipelineInfoTypeBad)
             mYellowBadEvents++;
         else if (info & (kPipelineInfoTypeNeutral | kPipelineInfoTypeGood))
             mYellowGoodEvents++;
     }
     
@@ -3236,17 +3235,17 @@ nsConnectionEntry::OnPipelineFeedbackInf
         case BadInsufficientFraming:
             mPipeliningClassPenalty[classification] += 7000;
             break;
         case BadUnexpectedLarge:
             mPipeliningClassPenalty[classification] += 120;
             break;
 
         default:
-            NS_ABORT_IF_FALSE(0, "Unknown Bad/Red Pipeline Feedback Event");
+            MOZ_ASSERT(false, "Unknown Bad/Red Pipeline Feedback Event");
         }
         
         const int16_t kPenalty = 25000;
         mPipeliningPenalty = std::min(mPipeliningPenalty, kPenalty);
         mPipeliningClassPenalty[classification] =
           std::min(mPipeliningClassPenalty[classification], kPenalty);
             
         LOG(("Assessing red penalty to %s class %d for event %d. "
@@ -3269,18 +3268,18 @@ nsConnectionEntry::OnPipelineFeedbackInf
         mYellowConnection = nullptr;
     }
 }
 
 void
 nsHttpConnectionMgr::
 nsConnectionEntry::SetYellowConnection(nsHttpConnection *conn)
 {
-    NS_ABORT_IF_FALSE(!mYellowConnection && mPipelineState == PS_YELLOW,
-                      "yellow connection already set or state is not yellow");
+    MOZ_ASSERT(!mYellowConnection && mPipelineState == PS_YELLOW,
+               "yellow connection already set or state is not yellow");
     mYellowConnection = conn;
     mYellowGoodEvents = mYellowBadEvents = 0;
 }
 
 void
 nsHttpConnectionMgr::
 nsConnectionEntry::OnYellowComplete()
 {
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -197,17 +197,17 @@ nsHttpHandler::nsHttpHandler()
     , mCritialRequestPrioritization(true)
 {
 #if defined(PR_LOGGING)
     gHttpLog = PR_NewLogModule("nsHttp");
 #endif
 
     LOG(("Creating nsHttpHandler [this=%x].\n", this));
 
-    NS_ASSERTION(!gHttpHandler, "HTTP handler already created!");
+    MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!");
     gHttpHandler = this;
 }
 
 nsHttpHandler::~nsHttpHandler()
 {
     LOG(("Deleting nsHttpHandler [this=%x]\n", this));
 
     // make sure the connection manager is shutdown
@@ -487,17 +487,17 @@ nsHttpHandler::GetIOService(nsIIOService
     NS_ADDREF(*result = mIOService);
     return NS_OK;
 }
 
 uint32_t
 nsHttpHandler::Get32BitsOfPseudoRandom()
 {
     // only confirm rand seeding on socket thread
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // rand() provides different amounts of PRNG on different platforms.
     // 15 or 31 bits are common amounts.
 
     PR_STATIC_ASSERT(RAND_MAX >= 0xfff);
 
 #if RAND_MAX < 0xffffU
     return ((uint16_t) rand() << 20) |
@@ -556,19 +556,19 @@ nsHttpHandler::UserAgent()
     return mUserAgent;
 }
 
 void
 nsHttpHandler::BuildUserAgent()
 {
     LOG(("nsHttpHandler::BuildUserAgent\n"));
 
-    NS_ASSERTION(!mLegacyAppName.IsEmpty() &&
-                 !mLegacyAppVersion.IsEmpty(),
-                 "HTTP cannot send practical requests without this much");
+    MOZ_ASSERT(!mLegacyAppName.IsEmpty() &&
+               !mLegacyAppVersion.IsEmpty(),
+               "HTTP cannot send practical requests without this much");
 
     // preallocate to worst-case size, which should always be better
     // than if we didn't preallocate at all.
     mUserAgent.SetCapacity(mLegacyAppName.Length() +
                            mLegacyAppVersion.Length() +
 #ifndef UA_SPARE_PLATFORM
                            mPlatform.Length() +
 #endif
@@ -652,17 +652,17 @@ nsHttpHandler::InitUserAgentComponents()
 #elif defined(MOZ_X11)
     "X11"
 #endif
     );
 #endif
 
 #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO) || defined(MOZ_B2G)
     nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
-    NS_ASSERTION(infoService, "Could not find a system info service");
+    MOZ_ASSERT(infoService, "Could not find a system info service");
 
     bool isTablet;
     nsresult rv = infoService->GetPropertyAsBool(NS_LITERAL_STRING("tablet"), &isTablet);
     if (NS_SUCCEEDED(rv) && isTablet)
         mCompatDevice.AssignLiteral("Tablet");
     else
         mCompatDevice.AssignLiteral("Mobile");
 #endif
@@ -1435,17 +1435,17 @@ PrepareAcceptLanguages(const char *i_Acc
                 wrote = PR_snprintf(p2, available, qval_str, comma, token, u);
             } else {
                 wrote = PR_snprintf(p2, available, "%s%s", comma, token);
             }
 
             q -= dec;
             p2 += wrote;
             available -= wrote;
-            NS_ASSERTION(available > 0, "allocated string not long enough");
+            MOZ_ASSERT(available > 0, "allocated string not long enough");
         }
     }
     nsCRT::free(o_Accept);
 
     o_AcceptLanguages.Assign((const char *) q_Accept);
     delete [] q_Accept;
 
     return NS_OK;
@@ -1876,17 +1876,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS5(nsHttpsHan
                               nsISupportsWeakReference,
                               nsISpeculativeConnect)
 
 nsresult
 nsHttpsHandler::Init()
 {
     nsCOMPtr<nsIProtocolHandler> httpHandler(
             do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http"));
-    NS_ASSERTION(httpHandler.get() != nullptr, "no http handler?");
+    MOZ_ASSERT(httpHandler.get() != nullptr);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHttpsHandler::GetScheme(nsACString &aScheme)
 {
     aScheme.AssignLiteral("https");
     return NS_OK;
@@ -1913,17 +1913,17 @@ nsHttpsHandler::NewURI(const nsACString 
                        nsIURI **_retval)
 {
     return ::NewURI(aSpec, aOriginCharset, aBaseURI, NS_HTTPS_DEFAULT_PORT, _retval);
 }
 
 NS_IMETHODIMP
 nsHttpsHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
-    NS_ABORT_IF_FALSE(gHttpHandler, "Should have a HTTP handler by now.");
+    MOZ_ASSERT(gHttpHandler);
     if (!gHttpHandler)
       return NS_ERROR_UNEXPECTED;
     return gHttpHandler->NewChannel(aURI, _retval);
 }
 
 NS_IMETHODIMP
 nsHttpsHandler::AllowPort(int32_t aPort, const char *aScheme, bool *_retval)
 {
--- a/netwerk/protocol/http/nsHttpHeaderArray.h
+++ b/netwerk/protocol/http/nsHttpHeaderArray.h
@@ -198,15 +198,15 @@ nsHttpHeaderArray::MergeHeader(nsHttpAto
 
 inline bool
 nsHttpHeaderArray::IsSuspectDuplicateHeader(nsHttpAtom header)
 {
     bool retval =  header == nsHttp::Content_Length         ||
                      header == nsHttp::Content_Disposition    ||
                      header == nsHttp::Location;
 
-    NS_ASSERTION(!retval || IsSingletonHeader(header),
-                 "Only non-mergeable headers should be in this list\n");
+    MOZ_ASSERT(!retval || IsSingletonHeader(header),
+               "Only non-mergeable headers should be in this list\n");
 
     return retval;
 }
 
 #endif
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -175,23 +175,22 @@ NS_INTERFACE_MAP_END
 nsresult
 nsHttpPipeline::OnHeadersAvailable(nsAHttpTransaction *trans,
                                    nsHttpRequestHead *requestHead,
                                    nsHttpResponseHead *responseHead,
                                    bool *reset)
 {
     LOG(("nsHttpPipeline::OnHeadersAvailable [this=%x]\n", this));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ASSERTION(mConnection, "no connection");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mConnection, "no connection");
     
     nsRefPtr<nsHttpConnectionInfo> ci;
     GetConnectionInfo(getter_AddRefs(ci));
-
-    NS_ABORT_IF_FALSE(ci, "no connection info");
+    MOZ_ASSERT(ci);
     
     bool pipeliningBefore = gHttpHandler->ConnMgr()->SupportsPipelining(ci);
     
     // trans has now received its response headers; forward to the real connection
     nsresult rv = mConnection->OnHeadersAvailable(trans,
                                                   requestHead,
                                                   responseHead,
                                                   reset);
@@ -205,18 +204,18 @@ nsHttpPipeline::OnHeadersAvailable(nsAHt
 }
 
 void
 nsHttpPipeline::CloseTransaction(nsAHttpTransaction *trans, nsresult reason)
 {
     LOG(("nsHttpPipeline::CloseTransaction [this=%x trans=%x reason=%x]\n",
         this, trans, reason));
 
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ASSERTION(NS_FAILED(reason), "expecting failure code");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(NS_FAILED(reason), "expecting failure code");
 
     // the specified transaction is to be closed with the given "reason"
     
     int32_t index;
     bool killPipeline = false;
 
     index = mRequestQ.IndexOf(trans);
     if (index >= 0) {
@@ -285,18 +284,18 @@ nsHttpPipeline::DontReuse()
         mConnection->DontReuse();
 }
 
 nsresult
 nsHttpPipeline::PushBack(const char *data, uint32_t length)
 {
     LOG(("nsHttpPipeline::PushBack [this=%x len=%u]\n", this, length));
     
-    NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ASSERTION(mPushBackLen == 0, "push back buffer already has data!");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(mPushBackLen == 0, "push back buffer already has data!");
 
     // If we have no chance for a pipeline (e.g. due to an Upgrade)
     // then push this data down to original connection
     if (!mConnection->IsPersistent())
         return mConnection->PushBack(data, length);
 
     // PushBack is called recursively from WriteSegments
 
@@ -312,17 +311,17 @@ nsHttpPipeline::PushBack(const char *dat
     if (!mPushBackBuf) {
         mPushBackMax = length;
         mPushBackBuf = (char *) malloc(mPushBackMax);
         if (!mPushBackBuf)
             return NS_ERROR_OUT_OF_MEMORY;
     }
     else if (length > mPushBackMax) {
         // grow push back buffer as necessary.
-        NS_ASSERTION(length <= nsIOService::gDefaultSegmentSize, "too big");
+        MOZ_ASSERT(length <= nsIOService::gDefaultSegmentSize, "too big");
         mPushBackMax = length;
         mPushBackBuf = (char *) realloc(mPushBackBuf, mPushBackMax);
         if (!mPushBackBuf)
             return NS_ERROR_OUT_OF_MEMORY;
     }
  
     memcpy(mPushBackBuf, data, length);
     mPushBackLen = length;
@@ -402,35 +401,35 @@ nsHttpPipeline::TakeSubTransactions(
 // nsHttpPipeline::nsAHttpTransaction
 //-----------------------------------------------------------------------------
 
 void
 nsHttpPipeline::SetConnection(nsAHttpConnection *conn)
 {
     LOG(("nsHttpPipeline::SetConnection [this=%x conn=%x]\n", this, conn));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
-    NS_ASSERTION(!mConnection, "already have a connection");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
+    MOZ_ASSERT(!mConnection, "already have a connection");
 
     NS_IF_ADDREF(mConnection = conn);
 }
 
 nsAHttpConnection *
 nsHttpPipeline::Connection()
 {
     LOG(("nsHttpPipeline::Connection [this=%x conn=%x]\n", this, mConnection));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     return mConnection;
 }
 
 void
 nsHttpPipeline::GetSecurityCallbacks(nsIInterfaceRequestor **result)
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // depending on timing this could be either the request or the response
     // that is needed - but they both go to the same host. A request for these
     // callbacks directly in nsHttpTransaction would not make a distinction
     // over whether the the request had been transmitted yet.
     nsAHttpTransaction *trans = Request(0);
     if (!trans)
         trans = Response(0);
@@ -443,17 +442,17 @@ nsHttpPipeline::GetSecurityCallbacks(nsI
 
 void
 nsHttpPipeline::OnTransportStatus(nsITransport* transport,
                                   nsresult status, uint64_t progress)
 {
     LOG(("nsHttpPipeline::OnStatus [this=%x status=%x progress=%llu]\n",
         this, status, progress));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsAHttpTransaction *trans;
     int32_t i, count;
 
     switch (status) {
 
     case NS_NET_STATUS_RESOLVING_HOST:
     case NS_NET_STATUS_RESOLVED_HOST:
@@ -586,17 +585,17 @@ nsHttpPipeline::ReadFromPipe(nsIInputStr
 
 nsresult
 nsHttpPipeline::ReadSegments(nsAHttpSegmentReader *reader,
                              uint32_t count,
                              uint32_t *countRead)
 {
     LOG(("nsHttpPipeline::ReadSegments [this=%x count=%u]\n", this, count));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mClosed) {
         *countRead = 0;
         return mStatus;
     }
 
     nsresult rv;
     uint64_t avail = 0;
@@ -634,17 +633,17 @@ nsHttpPipeline::ReadSegments(nsAHttpSegm
 
 nsresult
 nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer,
                               uint32_t count,
                               uint32_t *countWritten)
 {
     LOG(("nsHttpPipeline::WriteSegments [this=%x count=%u]\n", this, count));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mClosed)
         return NS_SUCCEEDED(mStatus) ? NS_BASE_STREAM_CLOSED : mStatus;
 
     nsAHttpTransaction *trans; 
     nsresult rv;
 
     trans = Response(0);
--- a/netwerk/protocol/http/nsHttpResponseHead.cpp
+++ b/netwerk/protocol/http/nsHttpResponseHead.cpp
@@ -233,17 +233,17 @@ nsHttpResponseHead::ComputeCurrentAge(ui
     // Compute apparent age
     if (now > dateValue)
         *result = now - dateValue;
 
     // Compute corrected received age
     if (NS_SUCCEEDED(GetAgeValue(&ageValue)))
         *result = std::max(*result, ageValue);
 
-    NS_ASSERTION(now >= requestTime, "bogus request time");
+    MOZ_ASSERT(now >= requestTime, "bogus request time");
 
     // Compute current age
     *result += (now - requestTime);
     return NS_OK;
 }
 
 // From section 13.2.4 of RFC2616, we compute the freshness lifetime of a cached
 // response as follows:
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -194,19 +194,19 @@ nsHttpTransaction::Init(uint32_t caps,
                                    requestHead->RequestURI().BeginReading());
 
     MOZ_EVENT_TRACER_WAIT(static_cast<nsAHttpTransaction*>(this),
                           "net::http::transaction");
     nsresult rv;
 
     LOG(("nsHttpTransaction::Init [this=%x caps=%x]\n", this, caps));
 
-    NS_ASSERTION(cinfo, "ouch");
-    NS_ASSERTION(requestHead, "ouch");
-    NS_ASSERTION(target, "ouch");
+    MOZ_ASSERT(cinfo);
+    MOZ_ASSERT(requestHead);
+    MOZ_ASSERT(target);
 
     mActivityDistributor = do_GetService(NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     bool activityDistributorActive;
     rv = mActivityDistributor->GetIsActive(&activityDistributorActive);
     if (NS_SUCCEEDED(rv) && activityDistributorActive) {
         // there are some observers registered at activity distributor, gather
@@ -341,17 +341,17 @@ nsAHttpConnection *
 nsHttpTransaction::Connection()
 {
     return mConnection;
 }
 
 nsHttpResponseHead *
 nsHttpTransaction::TakeResponseHead()
 {
-    NS_ABORT_IF_FALSE(!mResponseHeadTaken, "TakeResponseHead called 2x");
+    MOZ_ASSERT(!mResponseHeadTaken, "TakeResponseHead called 2x");
 
     // Lock RestartInProgress() and TakeResponseHead() against main thread
     MutexAutoLock lock(*nsHttp::GetLock());
 
     mResponseHeadTaken = true;
 
     // Prefer mForTakeResponseHead over mResponseHead. It is always a complete
     // set of headers.
@@ -453,17 +453,17 @@ nsHttpTransaction::OnTransportStatus(nsI
         } else if (status == NS_NET_STATUS_CONNECTED_TO) {
             mTimings.connectEnd = TimeStamp::Now();
         }
     }
 
     if (!mTransportSink)
         return;
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // Need to do this before the STATUS_RECEIVING_FROM check below, to make
     // sure that the activity distributor gets told about all status events.
     if (mActivityDistributor) {
         // upon STATUS_WAITING_FOR; report request body sent
         if ((mHasRequestBody) &&
             (status == NS_NET_STATUS_WAITING_FOR))
             mActivityDistributor->ObserveActivity(
@@ -490,17 +490,17 @@ nsHttpTransaction::OnTransportStatus(nsI
     uint64_t progressMax;
 
     if (status == NS_NET_STATUS_SENDING_TO) {
         // suppress progress when only writing request headers
         if (!mHasRequestBody)
             return;
 
         nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
-        NS_ASSERTION(seekable, "Request stream isn't seekable?!?");
+        MOZ_ASSERT(seekable, "Request stream isn't seekable?!?");
 
         int64_t prog = 0;
         seekable->Tell(&prog);
         progress = prog;
 
         // when uploading, we include the request headers in the progress
         // notifications.
         progressMax = mRequestSize; // XXX mRequestSize is 32-bit!
@@ -565,17 +565,17 @@ nsHttpTransaction::ReadRequestSegment(ns
     trans->mSentData = true;
     return NS_OK;
 }
 
 nsresult
 nsHttpTransaction::ReadSegments(nsAHttpSegmentReader *reader,
                                 uint32_t count, uint32_t *countRead)
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mTransactionDone) {
         *countRead = 0;
         return mStatus;
     }
 
     if (!mConnected) {
         mConnected = true;
@@ -632,17 +632,17 @@ nsHttpTransaction::WritePipeSegment(nsIO
     rv = trans->mWriter->OnWriteSegment(buf, count, countWritten);
     if (NS_FAILED(rv)) return rv; // caller didn't want to write anything
 
     if (!trans->mReceivedData) {
         MOZ_EVENT_TRACER_MARK(static_cast<nsAHttpTransaction*>(trans),
                               "net::http::first-read");
     }
 
-    NS_ASSERTION(*countWritten > 0, "bad writer");
+    MOZ_ASSERT(*countWritten > 0, "bad writer");
     trans->mReceivedData = true;
 
     // Let the transaction "play" with the buffer.  It is free to modify
     // the contents of the buffer and/or modify countWritten.
     // - Bytes in HTTP headers don't count towards countWritten, so the input
     // side of pipe (aka nsHttpChannel's mTransactionPump) won't hit
     // OnInputStreamReady until all headers have been parsed.
     //    
@@ -652,17 +652,17 @@ nsHttpTransaction::WritePipeSegment(nsIO
 
     return rv; // failure code only stops WriteSegments; it is not propagated.
 }
 
 nsresult
 nsHttpTransaction::WriteSegments(nsAHttpSegmentWriter *writer,
                                  uint32_t count, uint32_t *countWritten)
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mTransactionDone)
         return NS_SUCCEEDED(mStatus) ? NS_BASE_STREAM_CLOSED : mStatus;
 
     mWriter = writer;
 
     nsresult rv = mPipeOut->WriteSegments(WritePipeSegment, this, count, countWritten);
 
@@ -684,17 +684,17 @@ nsHttpTransaction::WriteSegments(nsAHttp
     return rv;
 }
 
 void
 nsHttpTransaction::Close(nsresult reason)
 {
     LOG(("nsHttpTransaction::Close [this=%x reason=%x]\n", this, reason));
 
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     if (mClosed) {
         LOG(("  already closed\n"));
         return;
     }
 
     if (mTokenBucketCancel) {
         mTokenBucketCancel->Cancel(reason);
@@ -873,17 +873,17 @@ nsHttpTransaction::PipelinePosition()
 
 //-----------------------------------------------------------------------------
 // nsHttpTransaction <private>
 //-----------------------------------------------------------------------------
 
 nsresult
 nsHttpTransaction::RestartInProgress()
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
     
     if ((mRestartCount + 1) >= gHttpHandler->MaxRequestAttempts()) {
         LOG(("nsHttpTransaction::RestartInProgress() "
              "reached max request attempts, failing transaction %p\n", this));
         return NS_ERROR_NET_RESET;
     }
 
     // Lock RestartInProgress() and TakeResponseHead() against main thread
@@ -934,17 +934,17 @@ nsHttpTransaction::RestartInProgress()
     mReceivedData = false;
 
     return Restart();
 }
 
 nsresult
 nsHttpTransaction::Restart()
 {
-    NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
+    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     // limit the number of restart attempts - bug 92224
     if (++mRestartCount >= gHttpHandler->MaxRequestAttempts()) {
         LOG(("reached max request attempts, failing transaction @%x\n", this));
         return NS_ERROR_NET_RESET;
     }
 
     LOG(("restarting transaction @%x\n", this));
@@ -966,29 +966,29 @@ nsHttpTransaction::Restart()
 
     return gHttpHandler->InitiateTransaction(this, mPriority);
 }
 
 char *
 nsHttpTransaction::LocateHttpStart(char *buf, uint32_t len,
                                    bool aAllowPartialMatch)
 {
-    NS_ASSERTION(!aAllowPartialMatch || mLineBuf.IsEmpty(), "ouch");
+    MOZ_ASSERT(!aAllowPartialMatch || mLineBuf.IsEmpty());
 
     static const char HTTPHeader[] = "HTTP/1.";
     static const uint32_t HTTPHeaderLen = sizeof(HTTPHeader) - 1;
     static const char HTTP2Header[] = "HTTP/2.0";
     static const uint32_t HTTP2HeaderLen = sizeof(HTTP2Header) - 1;
     
     if (aAllowPartialMatch && (len < HTTPHeaderLen))
         return (PL_strncasecmp(buf, HTTPHeader, len) == 0) ? buf : nullptr;
 
     // mLineBuf can contain partial match from previous search
     if (!mLineBuf.IsEmpty()) {
-        NS_ASSERTION(mLineBuf.Length() < HTTPHeaderLen, "ouch");
+        MOZ_ASSERT(mLineBuf.Length() < HTTPHeaderLen);
         int32_t checkChars = std::min(len, HTTPHeaderLen - mLineBuf.Length());
         if (PL_strncasecmp(buf, HTTPHeader + mLineBuf.Length(),
                            checkChars) == 0) {
             mLineBuf.Append(buf, checkChars);
             if (mLineBuf.Length() == HTTPHeaderLen) {
                 // We've found whole HTTPHeader sequence. Return pointer at the
                 // end of matched sequence since it is stored in mLineBuf.
                 return (buf + checkChars);
@@ -1174,17 +1174,17 @@ nsHttpTransaction::ParseHead(char *buf,
                     return NS_ERROR_ABORT;
                 }
                 return NS_OK;
             }
         }
     }
     // otherwise we can assume that we don't have a HTTP/0.9 response.
 
-    NS_ABORT_IF_FALSE (mHttpResponseMatched, "inconsistent");
+    MOZ_ASSERT (mHttpResponseMatched);
     while ((eol = static_cast<char *>(memchr(buf, '\n', count - *countRead))) != nullptr) {
         // found line in range [buf:eol]
         len = eol - buf + 1;
 
         *countRead += len;
 
         // actually, the line is in the range [buf:eol-1]
         if ((eol > buf) && (*(eol-1) == '\r'))
@@ -1339,17 +1339,17 @@ nsHttpTransaction::HandleContent(char *b
 {
     nsresult rv;
 
     LOG(("nsHttpTransaction::HandleContent [this=%x count=%u]\n", this, count));
 
     *contentRead = 0;
     *contentRemaining = 0;
 
-    NS_ASSERTION(mConnection, "no connection");
+    MOZ_ASSERT(mConnection);
 
     if (!mDidContentStart) {
         rv = HandleContentStart();
         if (NS_FAILED(rv)) return rv;
         // Do not write content to the pipe if we haven't started streaming yet
         if (!mDidContentStart)
             return NS_OK;
     }
@@ -1512,17 +1512,17 @@ nsHttpTransaction::ProcessData(char *buf
         // NOTE:
         // count > countRead + countRemaining <==> chunked transfer encoding
         //
         rv = HandleContent(buf, count, countRead, &countRemaining);
         if (NS_FAILED(rv)) return rv;
         // we may have read more than our share, in which case we must give
         // the excess bytes back to the connection
         if (mResponseIsComplete && countRemaining) {
-            NS_ASSERTION(mConnection, "no connection");
+            MOZ_ASSERT(mConnection);
             mConnection->PushBack(buf + *countRead, countRemaining);
         }
     }
 
     return NS_OK;
 }
 
 void
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -277,18 +277,18 @@ private:
         int64_t AlreadyProcessed() { return mAlreadyProcessed; }
         void SetAlreadyProcessed(int64_t val) {
             mAlreadyProcessed = val;
             mToReadBeforeRestart = val;
         }
         int64_t ToReadBeforeRestart() { return mToReadBeforeRestart; }
         void HaveReadBeforeRestart(uint32_t amt)
         {
-            NS_ABORT_IF_FALSE(amt <= mToReadBeforeRestart,
-                              "too large of a HaveReadBeforeRestart deduction");
+            MOZ_ASSERT(amt <= mToReadBeforeRestart,
+                       "too large of a HaveReadBeforeRestart deduction");
             mToReadBeforeRestart -= amt;
         }
 
     private:
         // This is the data from the first complete response header
         // used to make sure that all subsequent response headers match
 
         int64_t                         mContentLength;