Bug 1002527 - Fix not to initialize remote browser's ContentParent twice. r=bent
authorTing-Yu Chou <janus926@gmail.com>
Wed, 30 Apr 2014 02:00:00 -0400
changeset 181617 2b6ce664867550950407ce0d27e249d668c877a0
parent 181616 887b927cce10d2007a6ed06ece9ecdb62166a60d
child 181618 01dd7c0d8f8dc3b64178c05aa683191613edafc1
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbent
bugs1002527
milestone32.0a1
Bug 1002527 - Fix not to initialize remote browser's ContentParent twice. r=bent ContentParent::GetNewOrUsed() initialize the ContentParent always, even it is an initialized one from PreallocatedProcessManager::Take(). Initialize twice makes ContentParent to receive two the same observed event, and creates leak in both observer list and itself.
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -593,19 +593,19 @@ ContentParent::GetNewOrUsed(bool aForBro
             // Wait until the Nuwa process forks a new process.
             return nullptr;
         }
 #endif
         p = new ContentParent(/* app = */ nullptr,
                               aForBrowserElement,
                               /* isForPreallocated = */ false,
                               PROCESS_PRIORITY_FOREGROUND);
+        p->Init();
     }
 
-    p->Init();
     sNonAppContentParents->AppendElement(p);
     return p.forget();
 }
 
 /*static*/ ProcessPriority
 ContentParent::GetInitialProcessPriority(Element* aFrameElement)
 {
     // Frames with mozapptype == critical which are expecting a system message