Bug 1181630 - Do not fail out if there are no registered printers when printing with e10s on OS X. r=mstange.
authorMike Conley <mconley@mozilla.com>
Wed, 22 Jul 2015 14:21:39 -0400
changeset 286412 b44a29e2044c60f5409c56d5767d5a1ff2dd8108
parent 286411 effb4125322895c0c7f01d8bfe7ecb99f5c3a502
child 286413 2a1163cd7736bc2cdff56defaf4f24f3d5b186bb
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1181630
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1181630 - Do not fail out if there are no registered printers when printing with e10s on OS X. r=mstange. We were being overly cautious, and returning NS_ERROR_FAILURE if the printer name passed up from the content process didn't map to an existing system printer. The problem with that is that sometimes there are no registered printers. In that case, we just need to not set the printer in the NSPrintInfo. So in the event that we cannot find a printer with the name that the child sent up, we just leave the printer and printer name fields on the NSPrintInfo blank.
widget/cocoa/nsPrintOptionsX.mm
--- a/widget/cocoa/nsPrintOptionsX.mm
+++ b/widget/cocoa/nsPrintOptionsX.mm
@@ -141,21 +141,20 @@ nsPrintOptionsX::DeserializeToPrintSetti
     [NSMutableDictionary dictionaryWithDictionary:sharedDict];
   if (NS_WARN_IF(!newPrintInfoDict)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NSString* printerName = nsCocoaUtils::ToNSString(data.printerName());
   if (printerName) {
     NSPrinter* printer = [NSPrinter printerWithName: printerName];
-    if (NS_WARN_IF(!printer)) {
-      return NS_ERROR_FAILURE;
+    if (printer) {
+      [newPrintInfoDict setObject: printer forKey: NSPrintPrinter];
+      [newPrintInfoDict setObject: printerName forKey: NSPrintPrinterName];
     }
-    [newPrintInfoDict setObject: printer forKey: NSPrintPrinter];
-    [newPrintInfoDict setObject: printerName forKey: NSPrintPrinterName];
   }
 
   [newPrintInfoDict setObject: [NSNumber numberWithInt: data.numCopies()]
                     forKey: NSPrintCopies];
   [newPrintInfoDict setObject: [NSNumber numberWithBool: data.printAllPages()]
                     forKey: NSPrintAllPages];
   [newPrintInfoDict setObject: [NSNumber numberWithInt: data.startPageRange()]
                     forKey: NSPrintFirstPage];