Bug 1261070 - Move Send__delete__ to FailedAsyncOpen. r=jduell, a=al
authorDragana Damjanovic <dd.mozilla@gmail.com>
Thu, 07 Apr 2016 10:33:44 +0200
changeset 323838 b7ac08e2f3abca76cd06f9a151a95dec3531b89f
parent 323837 6adef622c36b1ff4d388e1199f1ee328651ac616
child 323839 274e8ba1cf09ec86435dee30518ecaa4099bbfcb
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell, al
bugs1261070
milestone47.0a2
Bug 1261070 - Move Send__delete__ to FailedAsyncOpen. r=jduell, a=al
netwerk/protocol/http/HttpChannelChild.cpp
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1084,31 +1084,35 @@ void
 HttpChannelChild::FailedAsyncOpen(const nsresult& status)
 {
   LOG(("HttpChannelChild::FailedAsyncOpen [this=%p status=%x]\n", this, status));
 
   mStatus = status;
 
   // We're already being called from IPDL, therefore already "async"
   HandleAsyncAbort();
+
+  if (mIPCOpen) {
+    PHttpChannelChild::Send__delete__(this);
+  }
+  // WARNING:  DO NOT RELY ON |THIS| EXISTING ANY MORE! 
+  // 
+  // NeckoChild::DeallocPHttpChannelChild() may have been called, which deletes 
+  // |this| if IPDL holds the last reference.
 }
 
 void
 HttpChannelChild::DoNotifyListenerCleanup()
 {
   LOG(("HttpChannelChild::DoNotifyListenerCleanup [this=%p]\n", this));
 
   if (mInterceptListener) {
     mInterceptListener->Cleanup();
     mInterceptListener = nullptr;
   }
-
-  if (mIPCOpen) {
-    PHttpChannelChild::Send__delete__(this);
-  }
 }
 
 class DeleteSelfEvent : public ChannelEvent
 {
  public:
   explicit DeleteSelfEvent(HttpChannelChild* child) : mChild(child) {}
   void Run() { mChild->DeleteSelf(); }
  private: