Bug 1419775 - Part 2.Notify closing IPC connection to PrintProgressService. r?bobowen draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Wed, 10 Jan 2018 09:02:45 +0900
changeset 718273 ab1901a7b387d58b671cba3bbfe10633b5930821
parent 718272 e20dae56804641b399a4d2cb309b6709643448e2
child 745420 eff49066c8f2538bc821a37fa5316fa55694fa6e
push id94854
push userbmo:mantaroh@gmail.com
push dateWed, 10 Jan 2018 00:04:13 +0000
reviewersbobowen
bugs1419775
milestone59.0a1
Bug 1419775 - Part 2.Notify closing IPC connection to PrintProgressService. r?bobowen If the content process which is printing target content is closed during printing, PrintProgressService will continue to display progress dialog even if Cancel is clicked. This patch will: * If IPC connection is closed, notify to PrintProgressService via nsIWebProgressListener. MozReview-Commit-ID: DoOfJjnk1wJ
layout/printing/ipc/RemotePrintJobParent.cpp
--- a/layout/printing/ipc/RemotePrintJobParent.cpp
+++ b/layout/printing/ipc/RemotePrintJobParent.cpp
@@ -271,12 +271,20 @@ RemotePrintJobParent::~RemotePrintJobPar
 void
 RemotePrintJobParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   if (mPrintDeviceContext) {
     mPrintDeviceContext->UnregisterPageDoneCallback();
   }
 
   mIsDoingPrinting = false;
+
+  // If progress dialog is opened, notify closing it.
+  for (auto listener : mPrintProgressListeners) {
+    listener->OnStateChange(nullptr,
+                            nullptr,
+                            nsIWebProgressListener::STATE_STOP,
+                            NS_OK);
+  }
 }
 
 } // namespace layout
 } // namespace mozilla