Backed out changeset d053fdf3b609 (bug 1088070)

This commit is contained in:
Carsten "Tomcat" Book 2015-03-05 08:54:03 +01:00
parent f6512f020c
commit 872e72c5b1
2 changed files with 24 additions and 19 deletions

View File

@ -168,6 +168,28 @@ var PrintUtils = {
let mm = aBrowser.messageManager;
mm.addMessageListener("Printing:Print:Done", function onPrintingDone(msg) {
mm.removeMessageListener("Printing:Print:Done", onPrintingDone);
let rv = msg.data.rv;
let printSettings = msg.objects.printSettings;
if (rv != Components.results.NS_OK &&
rv != Components.results.NS_ERROR_ABORT) {
Cu.reportError(`In Printing:Print:Done handler, got unexpected rv
${rv}.`);
}
if (gPrintSettingsAreGlobal && gSavePrintSettings) {
let PSSVC =
Components.classes["@mozilla.org/gfx/printsettings-service;1"]
.getService(Components.interfaces.nsIPrintSettingsService);
PSSVC.savePrintSettingsToPrefs(printSettings, true,
printSettings.kInitSaveAll);
PSSVC.savePrintSettingsToPrefs(printSettings, false,
printSettings.kInitSavePrinterName);
}
});
mm.sendAsyncMessage("Printing:Print", null, {
contentWindow: aWindow,
});

View File

@ -378,11 +378,6 @@ let Printing = {
this.MESSAGES.forEach(msgName => addMessageListener(msgName, this));
},
get shouldSavePrintSettings() {
return Services.prefs.getBoolPref("print.use_global_printsettings", false) &&
Services.prefs.getBoolPref("print.save_print_settings", false);
},
receiveMessage(message) {
let objects = message.objects;
let data = message.data;
@ -479,21 +474,9 @@ let Printing = {
} catch(e) {
// Pressing cancel is expressed as an NS_ERROR_ABORT return value,
// causing an exception to be thrown which we catch here.
if (e.result != Cr.NS_ERROR_ABORT) {
Cu.reportError(`In Printing:Print:Done handler, got unexpected rv
${e.result}.`);
}
}
if (this.shouldSavePrintSettings) {
let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"]
.getService(Ci.nsIPrintSettingsService);
PSSVC.savePrintSettingsToPrefs(printSettings, true,
printSettings.kInitSaveAll);
PSSVC.savePrintSettingsToPrefs(printSettings, false,
printSettings.kInitSavePrinterName);
rv = e.result;
}
sendAsyncMessage("Printing:Print:Done", { rv }, { printSettings });
},
updatePageCount() {