Bug 1432409 part 2 - Make RemotePrintJobChild::OnStatusChange no-op if initialization failed. r=dholbert draft
authorJonathan Watt <jwatt@jwatt.org>
Tue, 20 Feb 2018 00:54:40 +0000
changeset 757118 db86106b6f4586a4566936c0335f86894d5c4f7e
parent 757117 968cad980dabe6bf92dc17f7d23a8abfb3ca585a
push id99671
push userjwatt@jwatt.org
push dateTue, 20 Feb 2018 00:56:02 +0000
reviewersdholbert
bugs1432409
milestone60.0a1
Bug 1432409 part 2 - Make RemotePrintJobChild::OnStatusChange no-op if initialization failed. r=dholbert After the part 1 fix, we can still (asynchronously) call some generic cleanup code that tries to let the parent process's RemotePrintJobParent know that printing failed under the stack: RemotePrintJobChild::OnStatusChange nsPrintData::DoOnStatusChange nsPrintJob::FirePrintingErrorEvent nsPrintJob::CleanupOnFailure We crash on trying to use the RemotePrintJobChild to message the parent process since the delete message from the parent has been processed. This change makes RemotePrintJobChild::OnStatusChange check that it's initialized before trying to send any messages. MozReview-Commit-ID: FfizRMj2s2m
layout/printing/ipc/RemotePrintJobChild.cpp
--- a/layout/printing/ipc/RemotePrintJobChild.cpp
+++ b/layout/printing/ipc/RemotePrintJobChild.cpp
@@ -149,17 +149,17 @@ RemotePrintJobChild::OnLocationChange(ns
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RemotePrintJobChild::OnStatusChange(nsIWebProgress* aProgress,
                                     nsIRequest* aRequest, nsresult aStatus,
                                     const char16_t* aMessage)
 {
-  if (!mDestroyed) {
+  if (NS_SUCCEEDED(mInitializationResult) && !mDestroyed) {
     Unused << SendStatusChange(aStatus);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RemotePrintJobChild::OnSecurityChange(nsIWebProgress* aProgress,