author | Mantaroh Yoshinaga <mantaroh@gmail.com> |
Fri, 13 Oct 2017 15:48:40 +0900 | |
changeset 386093 | 672c5ee7b8e4fb261294f4b73fb60175df73921c |
parent 386092 | fb2b1aa5bb5e0521012c3c0bab7f7feb9da13b70 |
child 386094 | 51a852b856dc35ed68a65cc8795ec76f9f550e65 |
push id | 32675 |
push user | archaeopteryx@coole-files.de |
push date | Fri, 13 Oct 2017 21:36:21 +0000 |
treeherder | mozilla-central@684b9ee0468e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mstange |
bugs | 1185236, 34428043 |
milestone | 58.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
|
widget/cocoa/nsDeviceContextSpecX.mm | file | annotate | diff | comparison | revisions | |
widget/cocoa/nsPrintDialogX.mm | file | annotate | diff | comparison | revisions |
--- a/widget/cocoa/nsDeviceContextSpecX.mm +++ b/widget/cocoa/nsDeviceContextSpecX.mm @@ -118,36 +118,43 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init } #endif return NS_OK; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } -NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(const nsAString& aTitle, +NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(const nsAString& aTitle, const nsAString& aPrintToFileName, - int32_t aStartPage, + int32_t aStartPage, int32_t aEndPage) { - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; + + // Print Core of Application Service sent print job with names exceeding + // 255 bytes. This is a workaround until fix it. + // (https://openradar.appspot.com/34428043) + nsAutoString adjustedTitle; + PrintTarget::AdjustPrintJobNameForIPP(aTitle, adjustedTitle); - if (!aTitle.IsEmpty()) { - CFStringRef cfString = - ::CFStringCreateWithCharacters(NULL, reinterpret_cast<const UniChar*>(aTitle.BeginReading()), - aTitle.Length()); - if (cfString) { - ::PMPrintSettingsSetJobName(mPrintSettings, cfString); - ::CFRelease(cfString); - } + if (!adjustedTitle.IsEmpty()) { + CFStringRef cfString = + ::CFStringCreateWithCharacters(NULL, + reinterpret_cast<const UniChar*>(adjustedTitle.BeginReading()), + adjustedTitle.Length()); + if (cfString) { + ::PMPrintSettingsSetJobName(mPrintSettings, cfString); + ::CFRelease(cfString); } + } - return NS_OK; + return NS_OK; - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; + NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } NS_IMETHODIMP nsDeviceContextSpecX::EndDocument() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; #ifdef MOZ_ENABLE_SKIA_PDF if (mPrintViaSkPDF) {
--- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -54,18 +54,26 @@ nsPrintDialogServiceX::Show(nsPIDOMWindo nsCOMPtr<nsIPrintSettingsService> printSettingsSvc = do_GetService("@mozilla.org/gfx/printsettings-service;1"); // Set the print job title char16_t** docTitles; uint32_t titleCount; nsresult rv = aWebBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles); if (NS_SUCCEEDED(rv) && titleCount > 0) { - CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, reinterpret_cast<const UniChar*>(docTitles[0]), - NS_strlen(docTitles[0])); + // Print Core of Application Service sent print job with names exceeding + // 255 bytes. This is a workaround until fix it. + // (https://openradar.appspot.com/34428043) + nsAutoString adjustedTitle; + PrintTarget::AdjustPrintJobNameForIPP(nsDependentString(docTitles[0]), + adjustedTitle); + CFStringRef cfTitleString = + CFStringCreateWithCharacters(NULL, + reinterpret_cast<const UniChar*>(adjustedTitle.BeginReading()), + adjustedTitle.Length()); if (cfTitleString) { ::PMPrintSettingsSetJobName(settingsX->GetPMPrintSettings(), cfTitleString); CFRelease(cfTitleString); } for (int32_t i = titleCount - 1; i >= 0; i--) { free(docTitles[i]); } free(docTitles);