Bug 1419775 - Part 1.Prevent send IPC message when cancelling the print job if IPC connection already closed. r?mconley
If target content tab is already closed, progress dialog can't notify to content
process that cancelling the print job. So this patch will prevent send
cancelling message in this case.
MozReview-Commit-ID: 7G1LACajVha
--- a/toolkit/components/printingui/ipc/PrintProgressDialogParent.cpp
+++ b/toolkit/components/printingui/ipc/PrintProgressDialogParent.cpp
@@ -75,41 +75,43 @@ PrintProgressDialogParent::RecvDocURLCha
mPrintProgressParams->SetDocURL(newURL);
}
return IPC_OK();
}
void
PrintProgressDialogParent::ActorDestroy(ActorDestroyReason aWhy)
{
+ // If IPC actor is destroyed, we can't send to child via IPC.
+ mActive = false;
}
mozilla::ipc::IPCResult
PrintProgressDialogParent::Recv__delete__()
{
// The child has requested that we tear down the connection, so we set a
// member to make sure we don't try to contact it after the fact.
mActive = false;
return IPC_OK();
}
// nsIObserver
NS_IMETHODIMP
PrintProgressDialogParent::Observe(nsISupports *aSubject, const char *aTopic,
const char16_t *aData)
{
- if (aTopic && !strcmp(aTopic, "cancelled")) {
- Unused << SendCancelledCurrentJob();
- } else {
- if (mActive) {
+ if (mActive) {
+ if (aTopic && !strcmp(aTopic, "cancelled")) {
+ Unused << SendCancelledCurrentJob();
+ } else {
Unused << SendDialogOpened();
- } else {
- NS_WARNING("The print progress dialog finished opening, but communications "
- "with the child have been closed.");
}
+ } else {
+ NS_WARNING("The print progress dialog finished opening, but communications "
+ "with the child have been closed.");
}
return NS_OK;
}
} // namespace embedding
} // namespace mozilla