Backed out 4 changesets (bug 1185236) for Windows build bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 12 Oct 2017 19:50:07 -0700
changeset 385983 7ec4ec57761e35268664383f94c1bb21d91d0384
parent 385982 c42cf76778166be6c6f63de92149645863517169
child 385984 1af9973680715ff5af6ad0e093858e1d36b2f457
push id32672
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:00:05 +0000
treeherdermozilla-central@3efcb26e5f37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1185236
milestone58.0a1
backs outeda76603d637de47018e7244fc65b816a82077fe
2cbe403d5c16ca26e4fc4af2b2153c337429070b
0466471b9f67aa6a60bf3fb98515532e8a53095d
445f1e6fc862f32dc126085c01452dd0e3a03fb6
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
Backed out 4 changesets (bug 1185236) for Windows build bustage CLOSED TREE Backed out changeset eda76603d637 (bug 1185236) Backed out changeset 2cbe403d5c16 (bug 1185236) Backed out changeset 0466471b9f67 (bug 1185236) Backed out changeset 445f1e6fc862 (bug 1185236) MozReview-Commit-ID: 2nL4nUNNhcs
gfx/thebes/PrintTarget.cpp
gfx/thebes/PrintTarget.h
widget/cocoa/nsDeviceContextSpecX.mm
widget/cocoa/nsPrintDialogX.mm
widget/gtk/nsDeviceContextSpecG.cpp
--- a/gfx/thebes/PrintTarget.cpp
+++ b/gfx/thebes/PrintTarget.cpp
@@ -10,21 +10,16 @@
 #include "cairo-quartz.h"
 #endif
 #ifdef CAIRO_HAS_WIN32_SURFACE
 #include "cairo-win32.h"
 #endif
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/HelpersCairo.h"
 #include "mozilla/gfx/Logging.h"
-#include "nsUTF8Utils.h"
-
-// IPP spec disallow the job-name which is over 255 characters.
-// RFC: https://tools.ietf.org/html/rfc2911#section-4.1.2
-#define IPP_JOB_NAME_LIMIT_LENGTH 255
 
 namespace mozilla {
 namespace gfx {
 
 PrintTarget::PrintTarget(cairo_surface_t* aCairoSurface, const IntSize& aSize)
   : mCairoSurface(aCairoSurface)
   , mSize(aSize)
   , mIsFinished(false)
@@ -160,43 +155,16 @@ PrintTarget::GetReferenceDrawTarget(Draw
 #endif
 
     return do_AddRef(mRecordingRefDT);
   }
 
   return do_AddRef(mRefDT);
 }
 
-/* static */
-void
-PrintTarget::AdjustPrintJobNameForIPP(const nsAString& aJobName,
-                                      nsCString& aAdjustedJobName)
-{
-  CopyUTF16toUTF8(aJobName, aAdjustedJobName);
-
-  if (aAdjustedJobName.Length() > IPP_JOB_NAME_LIMIT_LENGTH) {
-    uint32_t length =
-      RewindToPriorUTF8Codepoint(aAdjustedJobName.get(),
-                                 (IPP_JOB_NAME_LIMIT_LENGTH - 3U));
-    aAdjustedJobName.SetLength(length);
-    aAdjustedJobName.AppendLiteral("...");
-  }
-}
-
-/* static */
-void
-PrintTarget::AdjustPrintJobNameForIPP(const nsAString& aJobName,
-                                      nsString& aAdjustedJobName)
-{
-  nsAutoCString jobName;
-  AdjustPrintJobNameForIPP(aJobName, jobName);
-
-  CopyUTF8toUTF16(jobName, aAdjustedJobName);
-}
-
 /* static */ already_AddRefed<DrawTarget>
 PrintTarget::CreateWrapAndRecordDrawTarget(DrawEventRecorder* aRecorder,
                                        DrawTarget* aDrawTarget)
 {
   MOZ_ASSERT(aRecorder);
   MOZ_ASSERT(aDrawTarget);
 
   RefPtr<DrawTarget> dt;
--- a/gfx/thebes/PrintTarget.h
+++ b/gfx/thebes/PrintTarget.h
@@ -131,21 +131,16 @@ public:
   /**
    * Returns a reference DrawTarget. Unlike MakeDrawTarget, this method is not
    * restricted to being called between BeginPage()/EndPage() calls, and the
    * returned DrawTarget it is still valid to use after EndPage() has been
    * called.
    */
   virtual already_AddRefed<DrawTarget> GetReferenceDrawTarget(DrawEventRecorder* aRecorder);
 
-  static void AdjustPrintJobNameForIPP(const nsAString& aJobName,
-                                       nsCString& aAdjustedJobName);
-  static void AdjustPrintJobNameForIPP(const nsAString& aJobName,
-                                       nsString& aAdjustedJobName);
-
 protected:
 
   // Only created via subclass's constructors
   explicit PrintTarget(cairo_surface_t* aCairoSurface, const IntSize& aSize);
 
   // Protected because we're refcounted
   virtual ~PrintTarget();
 
--- a/widget/cocoa/nsDeviceContextSpecX.mm
+++ b/widget/cocoa/nsDeviceContextSpecX.mm
@@ -118,43 +118,36 @@ 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;
-
-  // 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);
+    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
-  if (!adjustedTitle.IsEmpty()) {
-    CFStringRef cfString =
-      ::CFStringCreateWithCharacters(NULL,
-                                     reinterpret_cast<const UniChar*>(adjustedTitle.BeginReading()),
-                                     adjustedTitle.Length());
-    if (cfString) {
-      ::PMPrintSettingsSetJobName(mPrintSettings, cfString);
-      ::CFRelease(cfString);
+    if (!aTitle.IsEmpty()) {
+      CFStringRef cfString =
+        ::CFStringCreateWithCharacters(NULL, reinterpret_cast<const UniChar*>(aTitle.BeginReading()),
+                                             aTitle.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,26 +54,18 @@ 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) {
-    // 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());
+    CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, reinterpret_cast<const UniChar*>(docTitles[0]),
+                                                             NS_strlen(docTitles[0]));
     if (cfTitleString) {
       ::PMPrintSettingsSetJobName(settingsX->GetPMPrintSettings(), cfTitleString);
       CFRelease(cfTitleString);
     }
     for (int32_t i = titleCount - 1; i >= 0; i--) {
       free(docTitles[i]);
     }
     free(docTitles);
--- a/widget/gtk/nsDeviceContextSpecG.cpp
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
@@ -290,24 +290,18 @@ nsDeviceContextSpecGTK::EnumeratePrinter
                          nullptr, TRUE);
 }
 
 NS_IMETHODIMP
 nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle,
                                       const nsAString& aPrintToFileName,
                                       int32_t aStartPage, int32_t aEndPage)
 {
-  // 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);
-  }
-
+  mTitle.Truncate();
+  AppendUTF16toUTF8(aTitle, mTitle);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
 {
   if (mToPrinter) {
     // At this point, we might have a GtkPrinter set up in nsPrintSettingsGTK,
     // or we might not. In the single-process case, we probably will, as this