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.
This commit is contained in:
Mike Conley 2015-07-22 14:21:39 -04:00
parent c7df0e679c
commit 28ba8b19bc

View File

@ -146,11 +146,10 @@ nsPrintOptionsX::DeserializeToPrintSettings(const PrintData& data,
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()]