Bug 1420171 - Part 3: Don't default the settings printer name on Linux when printing to file. r=mconley, a=gchang
authorBob Owen <bobowencode@gmail.com>
Tue, 28 Nov 2017 08:59:00 +0000
changeset 445176 a447794c0dd0d34531ea0d9d16e725becf9c7669
parent 445175 072ce042c1d87ea41caca8940d0f21c26517b980
child 445177 5c9a3a3e55b0c288a7c6d6507c729eaff2d3ac9a
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, gchang
bugs1420171
milestone58.0
Bug 1420171 - Part 3: Don't default the settings printer name on Linux when printing to file. r=mconley, a=gchang
toolkit/components/printingui/ipc/PrintingParent.cpp
--- a/toolkit/components/printingui/ipc/PrintingParent.cpp
+++ b/toolkit/components/printingui/ipc/PrintingParent.cpp
@@ -137,18 +137,20 @@ PrintingParent::ShowPrintDialog(PBrowser
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString printerName;
   settings->GetPrinterName(printerName);
 #ifdef MOZ_X11
   // Requesting the default printer name on Linux has been removed in the child,
   // because it was causing a sandbox violation (see Bug 1329216).
   // If no printer name is set at this point, use the print settings service
-  // to get the default printer name.
-  if (printerName.IsEmpty()) {
+  // to get the default printer name, unless we're printing to file.
+  bool printToFile = false;
+  MOZ_ALWAYS_SUCCEEDS(settings->GetPrintToFile(&printToFile));
+  if (!printToFile && printerName.IsEmpty()) {
     mPrintSettingsSvc->GetDefaultPrinterName(printerName);
     settings->SetPrinterName(printerName);
   }
   mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings);
 #endif
 
   // If this is for print preview or we are printing silently then we just need
   // to initialize the print settings with anything specific from the printer.