Bug 1306298 - Close any pre-existing print progress dialogs when on re-entry to print preview. r=mconley
authorMatheus Longaray <mlongaray@hp.com>
Thu, 27 Oct 2016 08:44:00 -0400
changeset 320041 f4459d4ba9bad96caee8ec37b3ffde872fbab42f
parent 320040 e22d4c0e0f9dfa9e20f6452276c14d5faa84d2ef
child 320073 3ecd7c2308e72d85b9797458c1d2594ade5458c3
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1306298
milestone52.0a1
Bug 1306298 - Close any pre-existing print progress dialogs when on re-entry to print preview. r=mconley
toolkit/components/printing/content/printUtils.js
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -202,16 +202,23 @@ var PrintUtils = {
       // Here we log telemetry data for when the user enters print preview.
       this.logTelemetry("PRINT_PREVIEW_OPENED_COUNT");
     } else {
       // collapse the browser here -- it will be shown in
       // enterPrintPreview; this forces a reflow which fixes display
       // issues in bug 267422.
       let ppBrowser = this._listener.getPrintPreviewBrowser();
       ppBrowser.collapsed = true;
+
+      // If the user transits too quickly within preview and we have a pending
+      // progress dialog, we will close it before opening a new one.
+      if (this._webProgressPP && this._webProgressPP.value) {
+        this._webProgressPP.value.onStateChange(null, null,
+          Components.interfaces.nsIWebProgressListener.STATE_STOP, 0);
+      }
     }
 
     this._webProgressPP = {};
     let ppParams        = {};
     let notifyOnOpen    = {};
     let printSettings   = this.getPrintSettings();
     // Here we get the PrintingPromptService so we can display the PP Progress from script
     // For the browser implemented via XUL with the PP toolbar we cannot let it be