зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329216 - Move default printer name querying. r=bobowen
This commit is contained in:
Родитель
94cad21ec7
Коммит
3610edb99c
|
@ -7776,7 +7776,19 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError)
|
|||
|
||||
nsXPIDLString printerName;
|
||||
printSettings->GetPrinterName(getter_Copies(printerName));
|
||||
if (printerName.IsEmpty()) {
|
||||
|
||||
bool shouldGetDefaultPrinterName = printerName.IsEmpty();
|
||||
#ifdef MOZ_X11
|
||||
// In Linux, GTK backend does not support per printer settings.
|
||||
// Calling GetDefaultPrinterName causes a sandbox violation (see Bug 1329216).
|
||||
// The printer name is not needed anywhere else on Linux before it gets to the parent.
|
||||
// In the parent, we will then query the default printer name if no name is set.
|
||||
// Unless we are in the parent, we will skip this part.
|
||||
if (!XRE_IsParentProcess()) {
|
||||
shouldGetDefaultPrinterName = false;
|
||||
}
|
||||
#endif
|
||||
if (shouldGetDefaultPrinterName) {
|
||||
printSettingsService->GetDefaultPrinterName(getter_Copies(printerName));
|
||||
printSettings->SetPrinterName(printerName);
|
||||
}
|
||||
|
|
|
@ -980,6 +980,13 @@ nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings)
|
|||
// Mac doesn't support retrieving a printer list.
|
||||
return NS_OK;
|
||||
#else
|
||||
#if defined(MOZ_X11)
|
||||
// On Linux, default printer name should be requested on the parent side.
|
||||
// Unless we are in the parent, we ignore this function
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
NS_ENSURE_ARG_POINTER(aPrintSettings);
|
||||
|
||||
// See if aPrintSettings already has a printer
|
||||
|
|
|
@ -129,14 +129,24 @@ PrintingParent::ShowPrintDialog(PBrowserParent* aParent,
|
|||
rv = settings->SetPrintSilent(printSilently);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString printerName;
|
||||
settings->GetPrinterName(getter_Copies(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()) {
|
||||
mPrintSettingsSvc->GetDefaultPrinterName(getter_Copies(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.
|
||||
if (isPrintPreview || printSilently ||
|
||||
Preferences::GetBool("print.always_print_silent", printSilently)) {
|
||||
nsXPIDLString printerName;
|
||||
rv = settings->GetPrinterName(getter_Copies(printerName));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
settings->SetIsInitializedFromPrinter(false);
|
||||
mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings);
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче