diff options
-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 2276f8a0d1..d6185c5dd2 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); |