Bug 1654982 - Ensure job disposition is set correctly for output to a file. r=nordzilla

Differential Revision: https://phabricator.services.mozilla.com/D84906
This commit is contained in:
Jonathan Kew 2020-07-27 21:18:58 +00:00
parent cacf827e99
commit 55aa3ada5a
3 changed files with 14 additions and 0 deletions

View File

@ -224,6 +224,10 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget* aWidget, nsIPrintSettings* a
bool toFile;
settings->GetPrintToFile(&toFile);
if (toFile) {
settings->SetDispositionSaveToFile();
}
bool toPrinter = !toFile && !aIsPrintPreview;
if (!toPrinter) {
double width, height;

View File

@ -85,6 +85,8 @@ class nsPrintSettingsX : public nsPrintSettings {
// Set the printer name using the native PrintInfo data.
void SetPrinterNameFromPrintInfo();
void SetDispositionSaveToFile();
protected:
virtual ~nsPrintSettingsX();

View File

@ -421,6 +421,14 @@ nsPrintSettingsX::SetToFileName(const nsAString& aToFileName) {
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
void nsPrintSettingsX::SetDispositionSaveToFile() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
[mPrintInfo setJobDisposition:NSPrintSaveJob];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
NS_IMETHODIMP
nsPrintSettingsX::GetOrientation(int32_t* aOrientation) {
// Only use NSPrintInfo data in the parent process. The