From 5f1e23b8dbd1eb79b02933c155095f652dbf8380 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 19 May 2010 10:44:51 -0700 Subject: [PATCH] Bug 546270 followup: sync code paths for File|Print & window.print(), to handle no-default-printer case. r=roc --- dom/base/nsGlobalWindow.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 0580d8e491a0..52f95c1ba969 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -4631,17 +4631,13 @@ nsGlobalWindow::Print() if (printSettingsAreGlobal) { printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings)); - if (printSettings) { - // Call any code that requires a run of the event loop. - EnterModalState(); - printSettings->SetupSilentPrinting(); - LeaveModalState(); - } - nsXPIDLString printerName; - printSettingsService->GetDefaultPrinterName(getter_Copies(printerName)); - if (printerName) - printSettingsService->InitPrintSettingsFromPrinter(printerName, printSettings); + printSettings->GetPrinterName(getter_Copies(printerName)); + if (printerName.IsEmpty()) { + printSettingsService->GetDefaultPrinterName(getter_Copies(printerName)); + printSettings->SetPrinterName(printerName); + } + printSettingsService->InitPrintSettingsFromPrinter(printerName, printSettings); printSettingsService->InitPrintSettingsFromPrefs(printSettings, PR_TRUE, nsIPrintSettings::kInitSaveAll);