Bug 1664332. Derive the prepopulated filename for save-to-PDF via the system print dialog from the document title. r=sfoster

Differential Revision: https://phabricator.services.mozilla.com/D89838
This commit is contained in:
Jonathan Watt 2020-09-11 01:08:55 +00:00
Родитель 744a5e4c1e
Коммит bace57115a
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -164,6 +164,10 @@ var PrintEventHandler = {
? PrintUtils.getPrintSettings(this.viewSettings.defaultSystemPrinter)
: this.settings.clone();
settings.showPrintProgress = true;
// We set the title so that if the user chooses save-to-PDF from the
// system dialog the title will be used to generate the prepopulated
// filename in the file picker.
settings.title = this.previewBrowser.browsingContext.embedderElement.contentTitle;
const PRINTPROMPTSVC = Cc[
"@mozilla.org/embedcomp/printingprompt-service;1"
].getService(Ci.nsIPrintingPromptService);