Bug 1263991 part 7: Add assertions checking that the actor is still alive on incoming messages. r=baku, a=lizzard
authorJonas Sicking <jonas@sicking.cc>
Tue, 07 Jun 2016 02:46:03 -0700
changeset 341640 1cf4dc5b530279d612e30428a526a1c7a59812d4
parent 341639 54a3f8e44148dfe0428607bd264e82374de02a67
child 341641 3e9799b06fe41e72cd7a8d8003e45cf1bf78daa8
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, lizzard
bugs1263991
milestone49.0a2
Bug 1263991 part 7: Add assertions checking that the actor is still alive on incoming messages. r=baku, a=lizzard
dom/flyweb/FlyWebPublishedServer.cpp
--- a/dom/flyweb/FlyWebPublishedServer.cpp
+++ b/dom/flyweb/FlyWebPublishedServer.cpp
@@ -265,50 +265,54 @@ FlyWebPublishedServerChild::FlyWebPublis
   // ContentChild::DeallocPFlyWebPublishedServerChild
   NS_ADDREF_THIS();
 }
 
 bool
 FlyWebPublishedServerChild::RecvServerReady(const nsresult& aStatus)
 {
   LOG_I("FlyWebPublishedServerChild::RecvServerReady(%p)", this);
+  MOZ_ASSERT(!mActorDestroyed);
 
   PublishedServerStarted(aStatus);
   return true;
 }
 
 bool
 FlyWebPublishedServerChild::RecvServerClose()
 {
   LOG_I("FlyWebPublishedServerChild::RecvServerClose(%p)", this);
+  MOZ_ASSERT(!mActorDestroyed);
 
   Close();
 
   return true;
 }
 
 bool
 FlyWebPublishedServerChild::RecvFetchRequest(const IPCInternalRequest& aRequest,
                                              const uint64_t& aRequestId)
 {
   LOG_I("FlyWebPublishedServerChild::RecvFetchRequest(%p)", this);
+  MOZ_ASSERT(!mActorDestroyed);
 
   RefPtr<InternalRequest> request = new InternalRequest(aRequest);
   mPendingRequests.Put(request, aRequestId);
   FireFetchEvent(request);
 
   return true;
 }
 
 bool
 FlyWebPublishedServerChild::RecvWebSocketRequest(const IPCInternalRequest& aRequest,
                                                  const uint64_t& aRequestId,
                                                  PTransportProviderChild* aProvider)
 {
   LOG_I("FlyWebPublishedServerChild::RecvWebSocketRequest(%p)", this);
+  MOZ_ASSERT(!mActorDestroyed);
 
   RefPtr<InternalRequest> request = new InternalRequest(aRequest);
   mPendingRequests.Put(request, aRequestId);
 
   // Not addreffing here. The addref was already done when the
   // PTransportProvider child constructor original ran.
   mPendingTransportProviders.Put(aRequestId,
     dont_AddRef(static_cast<TransportProviderChild*>(aProvider)));
@@ -531,16 +535,18 @@ FlyWebPublishedServerParent::HandleEvent
 
   return NS_OK;
 }
 
 bool
 FlyWebPublishedServerParent::RecvFetchResponse(const IPCInternalResponse& aResponse,
                                                const uint64_t& aRequestId)
 {
+  MOZ_ASSERT(!mActorDestroyed);
+
   RefPtr<InternalRequest> request;
   mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
   if (!request) {
      static_cast<ContentParent*>(Manager())->KillHard("unknown request id");
      return false;
   }
 
   RefPtr<InternalResponse> response = InternalResponse::FromIPC(aResponse);
@@ -549,16 +555,18 @@ FlyWebPublishedServerParent::RecvFetchRe
 
   return true;
 }
 
 bool
 FlyWebPublishedServerParent::RecvWebSocketResponse(const IPCInternalResponse& aResponse,
                                                    const uint64_t& aRequestId)
 {
+  MOZ_ASSERT(!mActorDestroyed);
+
   mPendingTransportProviders.Remove(aRequestId);
 
   RefPtr<InternalRequest> request;
   mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
   if (!request) {
      static_cast<ContentParent*>(Manager())->KillHard("unknown websocket request id");
      return false;
   }
@@ -569,16 +577,18 @@ FlyWebPublishedServerParent::RecvWebSock
 
   return true;
 }
 
 bool
 FlyWebPublishedServerParent::RecvWebSocketAccept(const nsString& aProtocol,
                                                  const uint64_t& aRequestId)
 {
+  MOZ_ASSERT(!mActorDestroyed);
+
   RefPtr<TransportProviderParent> providerIPC;
   mPendingTransportProviders.Remove(aRequestId, getter_AddRefs(providerIPC));
 
   RefPtr<InternalRequest> request;
   mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
 
   if (!request || !providerIPC) {
      static_cast<ContentParent*>(Manager())->KillHard("unknown websocket request id");
@@ -609,16 +619,17 @@ FlyWebPublishedServerParent::ActorDestro
 
   mActorDestroyed = true;
 }
 
 bool
 FlyWebPublishedServerParent::Recv__delete__()
 {
   LOG_I("FlyWebPublishedServerParent::Recv__delete__(%p)", this);
+  MOZ_ASSERT(!mActorDestroyed);
 
   if (mPublishedServer) {
     mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("fetch"),
                                           this, false);
     mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("websocket"),
                                           this, false);
     mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("close"),
                                           this, false);