From 5c558250f92d6e399f949af0b41c8ee24c4e936e Mon Sep 17 00:00:00 2001 From: Mark Striemer Date: Wed, 19 Aug 2020 16:33:29 +0000 Subject: [PATCH] Bug 1660013 - Include .pdf extension when saving as PDF on macOS and linux r=emalysz Differential Revision: https://phabricator.services.mozilla.com/D87602 --- toolkit/components/printing/content/print.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/components/printing/content/print.js b/toolkit/components/printing/content/print.js index 991657cb6c41..d664e7ee34a0 100644 --- a/toolkit/components/printing/content/print.js +++ b/toolkit/components/printing/content/print.js @@ -760,7 +760,9 @@ async function pickFileName(sourceBrowser, pageSettings) { ); picker.appendFilter("PDF", "*.pdf"); picker.defaultExtension = "pdf"; - picker.defaultString = filename; + // macOS and linux don't set the extension based on the default. Windows will + // only include the filename once, so we can add it there too. + picker.defaultString = filename + ".pdf"; let retval = await new Promise(resolve => picker.open(resolve));