mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Backed out changeset ccc0e72f2152 (bug 1403260) for hanging Mac browser-chrome in printing tests
MozReview-Commit-ID: IZNT5Jh8nzB
This commit is contained in:
parent
ce11a1b648
commit
a173b09db6
@ -250,6 +250,10 @@ static const char contentSandboxRules[] = R"(
|
||||
(subpath debugWriteDir)
|
||||
(vnode-type REGULAR-FILE)))))
|
||||
|
||||
; bug 1324610
|
||||
(allow network-outbound file-read*
|
||||
(literal "/private/var/run/cupsd"))
|
||||
|
||||
(allow-shared-list "org.mozilla.plugincontainer")
|
||||
|
||||
; the following rule should be removed when microphone access
|
||||
|
@ -39,17 +39,6 @@ protected:
|
||||
nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
|
||||
nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, uint32_t aFlags);
|
||||
nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, uint32_t aFlags);
|
||||
|
||||
private:
|
||||
/* Serialization done in child to be deserialized in the parent */
|
||||
nsresult SerializeToPrintDataChild(nsIPrintSettings* aSettings,
|
||||
nsIWebBrowserPrint* aWBP,
|
||||
mozilla::embedding::PrintData* data);
|
||||
|
||||
/* Serialization done in parent to be deserialized in the child */
|
||||
nsresult SerializeToPrintDataParent(nsIPrintSettings* aSettings,
|
||||
nsIWebBrowserPrint* aWBP,
|
||||
mozilla::embedding::PrintData* data);
|
||||
};
|
||||
|
||||
#endif // nsPrintOptionsX_h_
|
||||
|
@ -31,24 +31,6 @@ nsPrintOptionsX::SerializeToPrintData(nsIPrintSettings* aSettings,
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
return SerializeToPrintDataParent(aSettings, aWBP, data);
|
||||
}
|
||||
|
||||
return SerializeToPrintDataChild(aSettings, aWBP, data);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintOptionsX::SerializeToPrintDataChild(nsIPrintSettings* aSettings,
|
||||
nsIWebBrowserPrint* aWBP,
|
||||
PrintData* data)
|
||||
{
|
||||
// If we are in the child process, we don't need to populate
|
||||
// nsPrintSettingsX completely. Apart from the document title,
|
||||
// the parent discards this data (bug 1328975). Furthermore,
|
||||
// reading some of the printer/printing settings from the OS
|
||||
// causes a connection to the printer to be made which is blocked
|
||||
// by sandboxing and results in hangs.
|
||||
if (aWBP) {
|
||||
// When serializing an nsIWebBrowserPrint, we need to pass up the first
|
||||
// document name. We could pass up the entire collection of document
|
||||
@ -56,7 +38,7 @@ nsPrintOptionsX::SerializeToPrintDataChild(nsIPrintSettings* aSettings,
|
||||
// the first one, so we just send the first to save IPC traffic.
|
||||
char16_t** docTitles;
|
||||
uint32_t titleCount;
|
||||
nsresult rv = aWBP->EnumerateDocumentNames(&titleCount, &docTitles);
|
||||
rv = aWBP->EnumerateDocumentNames(&titleCount, &docTitles);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (titleCount > 0) {
|
||||
data->printJobName().Assign(docTitles[0]);
|
||||
@ -70,14 +52,6 @@ nsPrintOptionsX::SerializeToPrintDataChild(nsIPrintSettings* aSettings,
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintOptionsX::SerializeToPrintDataParent(nsIPrintSettings* aSettings,
|
||||
nsIWebBrowserPrint* aWBP,
|
||||
PrintData* data)
|
||||
{
|
||||
RefPtr<nsPrintSettingsX> settingsX(do_QueryObject(aSettings));
|
||||
if (NS_WARN_IF(!settingsX)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -182,16 +156,126 @@ nsPrintOptionsX::DeserializeToPrintSettings(const PrintData& data,
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (data.orientation() == nsIPrintSettings::kPortraitOrientation) {
|
||||
settings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
|
||||
} else {
|
||||
settings->SetOrientation(nsIPrintSettings::kLandscapeOrientation);
|
||||
}
|
||||
|
||||
RefPtr<nsPrintSettingsX> settingsX(do_QueryObject(settings));
|
||||
if (NS_WARN_IF(!settingsX)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NSPrintInfo* sharedPrintInfo = [NSPrintInfo sharedPrintInfo];
|
||||
if (NS_WARN_IF(!sharedPrintInfo)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NSDictionary* sharedDict = [sharedPrintInfo dictionary];
|
||||
if (NS_WARN_IF(!sharedDict)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// We need to create a new NSMutableDictionary to pass to NSPrintInfo with
|
||||
// the values that we got from the other process.
|
||||
NSMutableDictionary* newPrintInfoDict =
|
||||
[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 (printer) {
|
||||
[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];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithInt: data.endPageRange()]
|
||||
forKey: NSPrintLastPage];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: data.mustCollate()]
|
||||
forKey: NSPrintMustCollate];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: data.printReversed()]
|
||||
forKey: NSPrintReversePageOrder];
|
||||
|
||||
[newPrintInfoDict setObject: nsCocoaUtils::ToNSString(data.disposition())
|
||||
forKey: NSPrintJobDisposition];
|
||||
|
||||
[newPrintInfoDict setObject: nsCocoaUtils::ToNSString(data.paperName())
|
||||
forKey: NSPrintPaperName];
|
||||
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithFloat: data.scalingFactor()]
|
||||
forKey: NSPrintScalingFactor];
|
||||
|
||||
CGFloat width = data.paperWidth() * data.widthScale();
|
||||
CGFloat height = data.paperHeight() * data.heightScale();
|
||||
[newPrintInfoDict setObject: [NSValue valueWithSize:NSMakeSize(width,height)]
|
||||
forKey: NSPrintPaperSize];
|
||||
|
||||
int paperOrientation;
|
||||
if (data.orientation() == nsIPrintSettings::kPortraitOrientation) {
|
||||
paperOrientation = NS_PAPER_ORIENTATION_PORTRAIT;
|
||||
settings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
|
||||
} else {
|
||||
paperOrientation = NS_PAPER_ORIENTATION_LANDSCAPE;
|
||||
settings->SetOrientation(nsIPrintSettings::kLandscapeOrientation);
|
||||
}
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithInt:paperOrientation]
|
||||
forKey: NSPrintOrientation];
|
||||
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithShort: data.pagesAcross()]
|
||||
forKey: NSPrintPagesAcross];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithShort: data.pagesDown()]
|
||||
forKey: NSPrintPagesDown];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: data.detailedErrorReporting()]
|
||||
forKey: NSPrintDetailedErrorReporting];
|
||||
[newPrintInfoDict setObject: nsCocoaUtils::ToNSString(data.faxNumber())
|
||||
forKey: NSPrintFaxNumber];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: data.addHeaderAndFooter()]
|
||||
forKey: NSPrintHeaderAndFooter];
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: data.fileNameExtensionHidden()]
|
||||
forKey: NSPrintJobSavingFileNameExtensionHidden];
|
||||
|
||||
// At this point, the base class should have properly deserialized the print
|
||||
// options bitfield for nsIPrintSettings, so that it holds the correct value
|
||||
// for kEnableSelectionRB, which we use to set NSPrintSelectionOnly.
|
||||
|
||||
bool printSelectionOnly = false;
|
||||
rv = settings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &printSelectionOnly);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: printSelectionOnly]
|
||||
forKey: NSPrintSelectionOnly];
|
||||
} else {
|
||||
[newPrintInfoDict setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: NSPrintSelectionOnly];
|
||||
}
|
||||
|
||||
NSURL* jobSavingURL =
|
||||
[NSURL URLWithString: nsCocoaUtils::ToNSString(data.toFileName())];
|
||||
if (jobSavingURL) {
|
||||
[newPrintInfoDict setObject: jobSavingURL forKey: NSPrintJobSavingURL];
|
||||
}
|
||||
|
||||
NSTimeInterval timestamp = data.printTime();
|
||||
NSDate* printTime = [NSDate dateWithTimeIntervalSinceReferenceDate: timestamp];
|
||||
if (printTime) {
|
||||
[newPrintInfoDict setObject: printTime forKey: NSPrintTime];
|
||||
}
|
||||
|
||||
// Next, we create a new NSPrintInfo with the values in our dictionary.
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: newPrintInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// And now swap in the new NSPrintInfo we've just populated.
|
||||
settingsX->SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
|
||||
settingsX->SetAdjustedPaperSize(data.adjustedPaperWidth(),
|
||||
data.adjustedPaperHeight());
|
||||
|
||||
|
@ -294,24 +294,17 @@ nsPrintSettingsX::SetScaling(double aScaling)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject: [NSNumber numberWithFloat: aScaling]
|
||||
forKey: NSPrintScalingFactor];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
} else {
|
||||
nsPrintSettings::SetScaling(aScaling);
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject: [NSNumber numberWithFloat: aScaling]
|
||||
forKey: NSPrintScalingFactor];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -322,19 +315,12 @@ nsPrintSettingsX::GetScaling(double *aScaling)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
NSDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
|
||||
*aScaling =
|
||||
[[printInfoDict objectForKey: NSPrintScalingFactor] doubleValue];
|
||||
*aScaling = [[printInfoDict objectForKey: NSPrintScalingFactor] doubleValue];
|
||||
|
||||
// Limit scaling precision to whole number percent values
|
||||
*aScaling = round(*aScaling * 100.0) / 100.0;
|
||||
} else {
|
||||
nsPrintSettings::GetScaling(aScaling);
|
||||
}
|
||||
// Limit scaling precision to whole number percent values
|
||||
*aScaling = round(*aScaling * 100.0) / 100.0;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -383,16 +369,10 @@ nsPrintSettingsX::SetToFileName(const nsAString& aToFileName)
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettingsX::GetOrientation(int32_t *aOrientation)
|
||||
{
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
if ([mPrintInfo orientation] == NS_PAPER_ORIENTATION_PORTRAIT) {
|
||||
*aOrientation = nsIPrintSettings::kPortraitOrientation;
|
||||
} else {
|
||||
*aOrientation = nsIPrintSettings::kLandscapeOrientation;
|
||||
}
|
||||
if ([mPrintInfo orientation] == NS_PAPER_ORIENTATION_PORTRAIT) {
|
||||
*aOrientation = nsIPrintSettings::kPortraitOrientation;
|
||||
} else {
|
||||
nsPrintSettings::GetOrientation(aOrientation);
|
||||
*aOrientation = nsIPrintSettings::kLandscapeOrientation;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -402,29 +382,22 @@ nsPrintSettingsX::SetOrientation(int32_t aOrientation)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
if (aOrientation == nsIPrintSettings::kPortraitOrientation) {
|
||||
[printInfoDict setObject: [NSNumber numberWithInt: NS_PAPER_ORIENTATION_PORTRAIT]
|
||||
forKey: NSPrintOrientation];
|
||||
} else {
|
||||
[printInfoDict setObject: [NSNumber numberWithInt: NS_PAPER_ORIENTATION_LANDSCAPE]
|
||||
forKey: NSPrintOrientation];
|
||||
}
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
if (aOrientation == nsIPrintSettings::kPortraitOrientation) {
|
||||
[printInfoDict setObject: [NSNumber numberWithInt: NS_PAPER_ORIENTATION_PORTRAIT]
|
||||
forKey: NSPrintOrientation];
|
||||
} else {
|
||||
nsPrintSettings::SetOrientation(aOrientation);
|
||||
[printInfoDict setObject: [NSNumber numberWithInt: NS_PAPER_ORIENTATION_LANDSCAPE]
|
||||
forKey: NSPrintOrientation];
|
||||
}
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -436,24 +409,17 @@ nsPrintSettingsX::SetUnwriteableMarginTop(double aUnwriteableMarginTop)
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsPrintSettings::SetUnwriteableMarginTop(aUnwriteableMarginTop);
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject :
|
||||
[NSNumber numberWithDouble: aUnwriteableMarginTop]
|
||||
forKey : NSPrintTopMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginTop]
|
||||
forKey : NSPrintTopMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -465,23 +431,17 @@ nsPrintSettingsX::SetUnwriteableMarginLeft(double aUnwriteableMarginLeft)
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsPrintSettings::SetUnwriteableMarginLeft(aUnwriteableMarginLeft);
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginLeft]
|
||||
forKey : NSPrintLeftMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginLeft]
|
||||
forKey : NSPrintLeftMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -493,23 +453,17 @@ nsPrintSettingsX::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom)
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsPrintSettings::SetUnwriteableMarginBottom(aUnwriteableMarginBottom);
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginBottom]
|
||||
forKey : NSPrintBottomMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginBottom]
|
||||
forKey : NSPrintBottomMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -521,23 +475,17 @@ nsPrintSettingsX::SetUnwriteableMarginRight(double aUnwriteableMarginRight)
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsPrintSettings::SetUnwriteableMarginRight(aUnwriteableMarginRight);
|
||||
|
||||
// Only use NSPrintInfo data in the parent process. The
|
||||
// child process' instance is not needed or used.
|
||||
if (XRE_IsParentProcess()) {
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginRight]
|
||||
forKey : NSPrintRightMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
NSMutableDictionary* printInfoDict = [mPrintInfo dictionary];
|
||||
[printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginRight]
|
||||
forKey : NSPrintRightMargin];
|
||||
NSPrintInfo* newPrintInfo =
|
||||
[[NSPrintInfo alloc] initWithDictionary: printInfoDict];
|
||||
if (NS_WARN_IF(!newPrintInfo)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
SetCocoaPrintInfo(newPrintInfo);
|
||||
[newPrintInfo release];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
Loading…
Reference in New Issue
Block a user