Bug 1455328 - handle repeated calls to ContentParent::AllocPPrintingParent more gracefully; r?bobowen draft
authorAlex Gaynor <agaynor@mozilla.com>
Thu, 19 Apr 2018 10:28:20 -0400
changeset 785065 3f7c17f606a442931e7b087db6d282f0d2a87cd8
parent 784946 8ed49dd81059dfdd876cf62ad5def1cfa56ffbbf
push id107115
push userbmo:agaynor@mozilla.com
push dateThu, 19 Apr 2018 14:28:37 +0000
reviewersbobowen
bugs1455328
milestone61.0a1
Bug 1455328 - handle repeated calls to ContentParent::AllocPPrintingParent more gracefully; r?bobowen MozReview-Commit-ID: FPl7zr7imPC
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3344,18 +3344,20 @@ ContentParent::DeallocPNeckoParent(PNeck
   delete necko;
   return true;
 }
 
 PPrintingParent*
 ContentParent::AllocPPrintingParent()
 {
 #ifdef NS_PRINTING
-  MOZ_RELEASE_ASSERT(!mPrintingParent,
-                     "Only one PrintingParent should be created per process.");
+  if (mPrintingParent) {
+    // Only one PrintingParent should be created per process.
+    return nullptr;
+  }
 
   // Create the printing singleton for this process.
   mPrintingParent = new PrintingParent();
 
   // Take another reference for IPDL code.
   mPrintingParent.get()->AddRef();
 
   return mPrintingParent.get();