diff options
author | Moonchild <moonchild@palemoon.org> | 2021-01-18 18:07:28 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-01-18 18:07:28 +0000 |
commit | 22e78108bd8eedfea961074170ca5578ea1370b0 (patch) | |
tree | d2411916561a91f6fe9b63ede73a3f823b9bad25 /toolkit | |
parent | c77d06c0c41e23e324ce1d82b1a57e29c2ecea13 (diff) | |
download | UXP-22e78108bd8eedfea961074170ca5578ea1370b0.tar UXP-22e78108bd8eedfea961074170ca5578ea1370b0.tar.gz UXP-22e78108bd8eedfea961074170ca5578ea1370b0.tar.lz UXP-22e78108bd8eedfea961074170ca5578ea1370b0.tar.xz UXP-22e78108bd8eedfea961074170ca5578ea1370b0.zip |
Issue #1715 - Handle errors when initializing print settings from the printer
fails due to a bad printer name or O.S. error.
Resolves #1715
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/content/browser-content.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js index 2276f8a0d..d6185c5dd 100644 --- a/toolkit/content/browser-content.js +++ b/toolkit/content/browser-content.js @@ -483,8 +483,18 @@ var Printing = { printSettings.printerName = PSSVC.defaultPrinterName; } // First get any defaults from the printer - PSSVC.initPrintSettingsFromPrinter(printSettings.printerName, - printSettings); + try { + PSSVC.initPrintSettingsFromPrinter(printSettings.printerName, + printSettings); + } catch(e) { + // The printer name specified was invalid or there was an O.S. error. + Components.utils.reportError("Invalid printer: " + printSettings.printerName); + Services.prefs.clearUserPref("print.print_printer"); + // Try again with default + printSettings.printerName = PSSVC.defaultPrinterName; + PSSVC.initPrintSettingsFromPrinter(printSettings.printerName, + printSettings); + } // now augment them with any values from last time PSSVC.initPrintSettingsFromPrefs(printSettings, true, printSettings.kInitSaveAll); |