Bug 1661437 - Convert print.show_print_progress into an static pref. r=jwatt
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 27 Aug 2020 12:27:49 +0000
changeset 546577 1442d938ea82edf0219cb48216b9da7d15a16ded
parent 546576 bd048a871648d4116f2e060f687736568f82cc81
child 546578 6b5c6e21e08f0e8e04dcc5efe64fd57d4148fea2
push id37735
push userabutkovits@mozilla.com
push dateThu, 27 Aug 2020 21:29:40 +0000
treeherdermozilla-central@109f3a4de567 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1661437 - Convert print.show_print_progress into an static pref. r=jwatt Differential Revision: https://phabricator.services.mozilla.com/D88400
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -895,30 +895,24 @@ already_AddRefed<nsIPrintSettings> nsPri
 // Set up to use the "pluggable" Print Progress Dialog
 void nsPrintJob::ShowPrintProgress(bool aIsForPrinting, bool& aDoNotify,
                                    Document* aDoc) {
   // default to not notifying, that if something here goes wrong
   // or we aren't going to show the progress dialog we can straight into
   // reflowing the doc for printing.
   aDoNotify = false;
-  // Assume we can't do progress and then see if we can
-  bool showProgresssDialog = false;
-  // if it is already being shown then don't bother to find out if it should be
-  // so skip this and leave mShowProgressDialog set to FALSE
-  if (!mProgressDialogIsShown) {
-    showProgresssDialog = Preferences::GetBool("print.show_print_progress");
-  }
   // Guarantee that mPrt and the objects it owns won't be deleted.  If this
   // method shows a progress dialog and spins the event loop.  So, mPrt may be
   // cleared or recreated.
   RefPtr<nsPrintData> printData = mPrt;
+  bool showProgresssDialog =
+      !mProgressDialogIsShown && StaticPrefs::print_show_print_progress();
   // Turning off the showing of Print Progress in Prefs overrides
   // whether the calling PS desire to have it on or off, so only check PS if
   // prefs says it's ok to be on.
   if (showProgresssDialog) {
   // Now open the service to get the progress dialog
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -8471,16 +8471,22 @@
 # Whether tab_modal print UI is enabled.
 # The tab modal print dialog is currently only for early beta or nightly.
 - name: print.tab_modal.enabled
   type: RelaxedAtomicBool
   mirror: always
+# Whether we allow the print progress dialog to show up.
+- name: print.show_print_progress
+  type: RelaxedAtomicBool
+  value: true
+  mirror: always
 # Prefs starting with "privacy."
 - name: privacy.file_unique_origin
   type: bool
   value: true
   mirror: always
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -930,17 +930,16 @@ pref("browser.fixup.fallback-to-https", 
 // Set each header to a string containing zero or one of these codes
 // and the code will be replaced in that string by the corresponding data
 pref("print.print_headerleft", "&T");
 pref("print.print_headercenter", "");
 pref("print.print_headerright", "&U");
 pref("print.print_footerleft", "&PT");
 pref("print.print_footercenter", "");
 pref("print.print_footerright", "&D");
-pref("print.show_print_progress", true);
 // xxxbsmedberg: more toolkit prefs
 // Save the Printings after each print job
 pref("print.save_print_settings", true);
 // Enables you to specify the amount of the paper that is to be treated
 // as unwriteable.  The print_edge_XXX and print_margin_XXX preferences