Bug 1185236 - Shorten print job name when GTK version is older than 3.18.2. r=karlt

Since GTK 3.18.2, GTK allows setting job name with more than 255 bytes.
As result, CUPS received the IPP error. (RFC 2911, Section 4.3.1)

This patch will shorten print job name, if runtime GTK version is older than 3.18.2.

MozReview-Commit-ID: EfB87Bvo6hX

--HG--
extra : rebase_source : f502cd49b128aecce4d8268783377c46a63ad669
This commit is contained in:
Mantaroh Yoshinaga 2017-10-13 09:46:39 +09:00
Родитель cb8af10152
Коммит 0c17c70a15
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -295,8 +295,14 @@ nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle,
const nsAString& aPrintToFileName,
int32_t aStartPage, int32_t aEndPage)
{
mTitle.Truncate();
AppendUTF16toUTF8(aTitle, mTitle);
// Print job names exceeding 255 bytes are safe with GTK version 3.18.2 or
// newer. This is a workaround for old GTK.
if (gtk_check_version(3,18,2) != nullptr) {
PrintTarget::AdjustPrintJobNameForIPP(aTitle, mTitle);
} else {
CopyUTF16toUTF8(aTitle, mTitle);
}
return NS_OK;
}