Bug 1334228 - Add separate assertions for message channels that haven't been opened. r=kanru draft
authorAndrew McCreight <continuation@gmail.com>
Thu, 26 Jan 2017 11:48:54 -0800
changeset 466991 2d27c3bc99c40bbc6803d99b0f6e4daa7bd98c9b
parent 466990 5a53f1bff1579179e66dcea0736ec2a655fb5b69
child 466992 33b8ef5d864cb7ee411cd006c177d6601f1d40fb
push id43078
push userbmo:continuation@gmail.com
push dateFri, 27 Jan 2017 00:13:37 +0000
reviewerskanru
bugs1334228
milestone54.0a1
Bug 1334228 - Add separate assertions for message channels that haven't been opened. r=kanru MozReview-Commit-ID: KqNdMEPieCk
ipc/glue/MessageChannel.h
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -430,25 +430,27 @@ class MessageChannel : HasResultCodes
     // Run on the not current thread.
     void NotifyChannelClosed();
     void NotifyMaybeChannelError();
 
   private:
     // Can be run on either thread
     void AssertWorkerThread() const
     {
+        MOZ_ASSERT(mWorkerLoopID != -1, "Channel hasn't been opened yet");
         MOZ_RELEASE_ASSERT(mWorkerLoopID == MessageLoop::current()->id(),
                            "not on worker thread!");
     }
 
     // The "link" thread is either the I/O thread (ProcessLink) or the
     // other actor's work thread (ThreadLink).  In either case, it is
     // NOT our worker thread.
     void AssertLinkThread() const
     {
+        MOZ_ASSERT(mWorkerLoopID != -1, "Channel hasn't been opened yet");
         MOZ_RELEASE_ASSERT(mWorkerLoopID != MessageLoop::current()->id(),
                            "on worker thread but should not be!");
     }
 
   private:
     class MessageTask :
         public CancelableRunnable,
         public LinkedListElement<RefPtr<MessageTask>>,