Bug 1334228 - Add separate assertions for message channels that haven't been opened. r=kanru
authorAndrew McCreight <continuation@gmail.com>
Thu, 26 Jan 2017 11:48:54 -0800
changeset 469888 6905cedb8cad61a1cda9a2d74c07fc001619c998
parent 469887 ae4a32972c9412ad22ba83c56ff17f7b648ceefc
child 469889 ed54c5d4314a7dee126093fa520bdd5ae517b660
push id43881
push userbmo:gps@mozilla.com
push dateThu, 02 Feb 2017 23:49:03 +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>>,