Bug 1441598 Part 2: When cancelling a print make sure the DialogOpened message has been sent. r=jwatt
☠☠ backed out by bb6db24a20dd ☠ ☠
authorBob Owen <bobowencode@gmail.com>
Mon, 05 Mar 2018 08:22:14 +0000
changeset 406521 0036938db4fe34793e96184998e5df543a6a4fec
parent 406520 b47e9371891215b7f5bb5e7ec26485f51b4e477c
child 406522 bb6db24a20dd8c081309b00c11d89f2b45aef6d7
push id100450
push userbobowencode@gmail.com
push dateMon, 05 Mar 2018 08:22:48 +0000
treeherdermozilla-inbound@0036938db4fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1441598
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441598 Part 2: When cancelling a print make sure the DialogOpened message has been sent. r=jwatt
security/sandbox/chromium/base/win/scoped_handle.cc
toolkit/components/printingui/ipc/PrintProgressDialogParent.cpp
toolkit/components/printingui/ipc/PrintProgressDialogParent.h
--- a/security/sandbox/chromium/base/win/scoped_handle.cc
+++ b/security/sandbox/chromium/base/win/scoped_handle.cc
@@ -85,17 +85,20 @@ class ActiveVerifier {
                              const void* pc1, const void* pc2);
   virtual void StopTracking(HANDLE handle, const void* owner,
                             const void* pc1, const void* pc2);
   virtual void Disable();
   virtual void OnHandleBeingClosed(HANDLE handle);
   virtual HMODULE GetModule() const;
 
  private:
-  ~ActiveVerifier();  // Not implemented.
+   ~ActiveVerifier() 
+   {
+     printf("wibble: ~ActiveVerifier\n");
+   }  // Not implemented.
 
   static void InstallVerifier();
 
   base::debug::StackTrace creation_stack_;
   bool enabled_;
   base::ThreadLocalBoolean closing_;
   NativeLock* lock_;
   HandleMap map_;
--- a/toolkit/components/printingui/ipc/PrintProgressDialogParent.cpp
+++ b/toolkit/components/printingui/ipc/PrintProgressDialogParent.cpp
@@ -97,22 +97,31 @@ PrintProgressDialogParent::Recv__delete_
 NS_IMETHODIMP
 PrintProgressDialogParent::Observe(nsISupports *aSubject, const char *aTopic,
                                    const char16_t *aData)
 {
   if (mActive) {
     if (aTopic) {
       if (!strcmp(aTopic, "cancelled")) {
         Unused << SendCancelledCurrentJob();
+        if (!mDialogOpenedSent) {
+          // We haven't already called SendDialogOpened, so call it now or it
+          // might never get sent and block the child from new printing requests.
+          // Also set mActive to false because we don't want to send it twice
+          // and our PrintProgressDialogChild will get deleted anyway.
+          Unused << SendDialogOpened();
+          mActive = false;
+        }
       } else if (!strcmp(aTopic, "completed")) {
         // Once printing is complete don't send any messages to the child.
         mActive = false;
       }
     } else {
       Unused << SendDialogOpened();
+      mDialogOpenedSent = true;
     }
   } else {
     NS_WARNING("The print progress dialog finished opening, but communications "
                "with the child have been closed.");
   }
 
   return NS_OK;
 }
--- a/toolkit/components/printingui/ipc/PrintProgressDialogParent.h
+++ b/toolkit/components/printingui/ipc/PrintProgressDialogParent.h
@@ -51,14 +51,15 @@ public:
   Recv__delete__() override;
 
 private:
   virtual ~PrintProgressDialogParent();
 
   nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
   nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
   bool mActive;
+  bool mDialogOpenedSent = false;
 };
 
 } // namespace embedding
 } // namespace mozilla
 
 #endif