mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Bug 1675965, do not store file name in preference value for save to pdf printers r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D113413
This commit is contained in:
parent
16727033d9
commit
d2b69538dd
@ -840,7 +840,9 @@ nsresult nsPrintJob::Print(Document* aSourceDoc,
|
||||
nsCOMPtr<nsIPrintSettingsService> printSettingsService =
|
||||
do_GetService("@mozilla.org/gfx/printsettings-service;1");
|
||||
printSettingsService->SavePrintSettingsToPrefs(
|
||||
aPrintSettings, true, nsIPrintSettings::kInitSaveAll);
|
||||
aPrintSettings, true,
|
||||
nsIPrintSettings::kInitSaveAll &
|
||||
~nsIPrintSettings::kInitSaveToFileName);
|
||||
printSettingsService->SavePrintSettingsToPrefs(
|
||||
aPrintSettings, false, nsIPrintSettings::kInitSavePrinterName);
|
||||
}
|
||||
|
@ -423,6 +423,16 @@ var PrintEventHandler = {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
if (settings.printerName == PrintUtils.SAVE_TO_PDF_PRINTER) {
|
||||
// Clear the file name from the preference value since it may potentially
|
||||
// contain sensitive information from the page title (Bug 1675965)
|
||||
let prefName =
|
||||
"print.printer_" +
|
||||
settings.printerName.replace(/ /g, "_") +
|
||||
".print_to_filename";
|
||||
Services.prefs.clearUserPref(prefName);
|
||||
}
|
||||
|
||||
window.close();
|
||||
return true;
|
||||
},
|
||||
|
@ -110,6 +110,15 @@ add_task(async function testPDFFile() {
|
||||
EventUtils.sendKey("return", helper.win);
|
||||
});
|
||||
|
||||
try {
|
||||
Services.prefs.getStringPref(
|
||||
"print.printer_Mozilla_Save_to_PDF.print_to_filename"
|
||||
);
|
||||
ok(false, "Should have cleared the filename pref");
|
||||
} catch (ex) {
|
||||
ok(true, "Cleared the filename pref");
|
||||
}
|
||||
|
||||
is(await IOUtils.exists(filePath), true, "Saved pdf file exists");
|
||||
ok(await IOUtils.read(filePath), "Saved pdf file is not empty");
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user