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
--- 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,