Commit be4e2245 authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1667953 p2. Fixup corrupted 'Save to PDF' printing pref for affected users. r=emalysz

Differential Revision: https://phabricator.services.mozilla.com/D91866
parent 3f467623
......@@ -900,11 +900,12 @@ var PrintSettingsViewProxy = {
}
printerInfo.settings = printerInfo.defaultSettings.clone();
// Apply any previously persisted user values
PSSVC.initPrintSettingsFromPrefs(
printerInfo.settings,
true,
printerInfo.settings.kInitSaveAll
);
let flags = printerInfo.settings.kInitSaveAll;
if (printerName == PrintUtils.SAVE_TO_PDF_PRINTER) {
// Don't apply potentially-bad printToFile setting that may be in some user's prefs.
flags ^= printerInfo.settings.kInitSavePrintToFile;
}
PSSVC.initPrintSettingsFromPrefs(printerInfo.settings, true, flags);
// We set `isInitializedFromPrinter` to make sure that that's set on the
// SAVE_TO_PDF_PRINTER settings. The naming is poor, but that tells the
// platform code that the settings object is complete.
......
......@@ -13,6 +13,7 @@ support-files =
file_page_change_print_original_2.html
skip-if = os == "mac"
[browser_pdf_printer_settings.js]
[browser_sheet_count.js]
[browser_window_print.js]
support-files =
......
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function testPDFPrinterSettings() {
await PrintHelper.withTestPage(async helper => {
// Set some bad prefs
await SpecialPowers.pushPrefEnv({
set: [
["print.print_to_file", false],
["print.print_in_color", false],
["print.printer_Mozilla_Save_to_PDF.print_to_file", false],
["print.printer_Mozilla_Save_to_PDF.print_in_color", false],
],
});
await helper.startPrint();
await helper.awaitAnimationFrame();
// Verify we end up with sane settings
let { settings } = helper;
ok(
settings.printToFile,
"Check the current settings have a truthy printToFile for the PDF printer"
);
ok(
settings.printInColor,
"Check the current settings have a truthy printInColor for the PDF printer"
);
is(
settings.outputFormat,
Ci.nsIPrintSettings.kOutputFormatPDF,
"The PDF printer has the correct outputFormat"
);
await helper.closeDialog();
await SpecialPowers.popPrefEnv();
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment