mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 19:37:15 +00:00
Bug 1749598 p1 - Stop reading the last used printer name in content processes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D150098
This commit is contained in:
parent
7b2f38b3b3
commit
c0ea877a65
@ -5138,6 +5138,7 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> ps = aPrintSettings;
|
||||
if (!ps) {
|
||||
// We shouldn't need this once bug 1776169 is fixed.
|
||||
printSettingsService->GetDefaultPrintSettingsForPrinting(
|
||||
getter_AddRefs(ps));
|
||||
}
|
||||
|
@ -765,14 +765,24 @@ nsPrintSettingsService::GetDefaultPrintSettingsForPrinting(
|
||||
|
||||
nsIPrintSettings* settings = *aPrintSettings;
|
||||
|
||||
nsAutoString printerName;
|
||||
settings->GetPrinterName(printerName);
|
||||
if (printerName.IsEmpty()) {
|
||||
GetLastUsedPrinterName(printerName);
|
||||
settings->SetPrinterName(printerName);
|
||||
// For security reasons, we don't pass the printer name to content processes.
|
||||
// Once bug 1776169 is fixed, we can just assert that this is the parent
|
||||
// process.
|
||||
bool usePrinterName = XRE_IsParentProcess();
|
||||
|
||||
if (usePrinterName) {
|
||||
nsAutoString printerName;
|
||||
settings->GetPrinterName(printerName);
|
||||
if (printerName.IsEmpty()) {
|
||||
GetLastUsedPrinterName(printerName);
|
||||
settings->SetPrinterName(printerName);
|
||||
}
|
||||
InitPrintSettingsFromPrinter(printerName, settings);
|
||||
}
|
||||
InitPrintSettingsFromPrinter(printerName, settings);
|
||||
InitPrintSettingsFromPrefs(settings, true, nsIPrintSettings::kInitSaveAll);
|
||||
|
||||
InitPrintSettingsFromPrefs(settings, usePrinterName,
|
||||
nsIPrintSettings::kInitSaveAll);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -785,6 +795,8 @@ nsPrintSettingsService::CreateNewPrintSettings(
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettingsService::GetLastUsedPrinterName(
|
||||
nsAString& aLastUsedPrinterName) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
aLastUsedPrinterName.Truncate();
|
||||
Preferences::GetString(kPrinterName, aLastUsedPrinterName);
|
||||
return NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user