зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1363291 - Handle save to file when printing pdf in non-e10s. r=brsun
MozReview-Commit-ID: CF9eRC3ZJWU --HG-- extra : rebase_source : cd52051e70d932c239c5c012e16b8ef42ad8f191
This commit is contained in:
Родитель
65821e18d9
Коммит
22a4f20aa8
|
@ -58,8 +58,7 @@ const POINT_PER_INCH = 72;
|
|||
const POINT_PER_MILLIMETER = POINT_PER_INCH / 25.4;
|
||||
|
||||
const PRINT_FILE_NAME = "print.pdf";
|
||||
const PRINT_CONTENT_TEMP_KEY =
|
||||
(Services.appinfo.OS == "Linux") ? "TmpD" : "ContentTmpD";
|
||||
const PRINT_TEMP_KEY = "TmpD";
|
||||
|
||||
const PP_Bool = {
|
||||
PP_FALSE: 0,
|
||||
|
@ -5011,7 +5010,7 @@ dump(`callFromJSON: < ${JSON.stringify(call)}\n`);
|
|||
let buffer = PP_Resource.lookup(bufferId);
|
||||
|
||||
// Save PDF to file
|
||||
let file = Services.dirsvc.get(PRINT_CONTENT_TEMP_KEY, Ci.nsIFile);
|
||||
let file = Services.dirsvc.get(PRINT_TEMP_KEY, Ci.nsIFile);
|
||||
file.append(PRINT_FILE_NAME);
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, PR_IRUSR | PR_IWUSR);
|
||||
let stream = Cc["@mozilla.org/network/file-output-stream;1"].
|
||||
|
@ -5033,7 +5032,7 @@ dump(`callFromJSON: < ${JSON.stringify(call)}\n`);
|
|||
"PPP_Printing(Dev);0.6", "End", { instance }), true);
|
||||
// We need permission for printing PDF file
|
||||
instance.mm.sendAsyncMessage("ppapipdf.js:printPDF", {
|
||||
contentTempKey: PRINT_CONTENT_TEMP_KEY, fileName: PRINT_FILE_NAME });
|
||||
filePath: file.path });
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
|||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
|
@ -157,8 +158,7 @@ mm.addMessageListener("ppapipdf.js:getPrintSettings", () => {
|
|||
});
|
||||
|
||||
mm.addMessageListener("ppapipdf.js:printPDF", ({ data }) => {
|
||||
let file = Services.dirsvc.get(data.contentTempKey, Ci.nsIFile);
|
||||
file.append(data.fileName);
|
||||
let file = new FileUtils.File(data.filePath);
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче