Bug 818626 - Remove debugging info. r=roc a=lsblakk
authorCameron McCormack <cam@mcc.id.au>
Thu, 24 Jan 2013 11:13:55 +1100
changeset 127299 dd357e872f398a62e3b73e9bc933c82d8d1dc9cf
parent 127298 326cf46aa524f67ced7d005e3062d2bda4792795
child 127300 90839133382ebbf7651be9fefbf6e69124461ac1
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs818626
milestone20.0a2
Bug 818626 - Remove debugging info. r=roc a=lsblakk
layout/printing/nsPrintData.cpp
layout/printing/nsPrintEngine.cpp
layout/printing/nsPrintObject.cpp
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -7,20 +7,16 @@
 
 #include "nsIStringBundle.h"
 #include "nsIServiceManager.h"
 #include "nsPrintObject.h"
 #include "nsPrintPreviewListener.h"
 #include "nsIWebProgressListener.h"
 #include "mozilla/Services.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 //-----------------------------------------------------
 // PR LOGGING
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG /* Allow logging in the release build */
 #endif
 
 #include "prlog.h"
 
@@ -65,132 +61,16 @@ nsPrintData::nsPrintData(ePrintDataType 
   }
 
   if (!mBrandName) {
     mBrandName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
   }
 
 }
 
-#ifdef MOZ_CRASHREPORTER
-#define ASSERT_AND_NOTE(message) \
-  { NS_ASSERTION(false, message); \
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING(message "\n")); }
-#else
-#define ASSERT_AND_NOTE(message) \
-  NS_ASSERTION(false, message);
-#endif
-
-static void
-AssertPresShellsAndContextsSane(nsPrintObject* aPO,
-                                nsTArray<nsIPresShell*>& aPresShells,
-                                nsTArray<nsPresContext*>& aPresContexts)
-{
-  if (aPO->mPresShell) {
-    if (aPresShells.Contains(aPO->mPresShell)) {
-      ASSERT_AND_NOTE("duplicate pres shells in print object tree");
-    } else {
-      aPresShells.AppendElement(aPO->mPresShell);
-    }
-  }
-  if (aPO->mPresContext) {
-    if (aPresContexts.Contains(aPO->mPresContext)) {
-      ASSERT_AND_NOTE("duplicate pres contexts in print object tree");
-    } else {
-      aPresContexts.AppendElement(aPO->mPresContext);
-    }
-  }
-  if (aPO->mPresShell && !aPO->mPresContext) {
-    ASSERT_AND_NOTE("print object has pres shell but no pres context");
-  }
-  if (!aPO->mPresShell && aPO->mPresContext) {
-    ASSERT_AND_NOTE("print object has pres context but no pres shell");
-  }
-  if (aPO->mPresContext &&
-      aPO->mPresShell &&
-      aPO->mPresContext->GetPresShell() &&
-      aPO->mPresContext->GetPresShell() != aPO->mPresShell) {
-    ASSERT_AND_NOTE("print object has mismatching pres shell and pres context");
-  }
-
-  for (uint32_t i = 0; i < aPO->mKids.Length(); i++) {
-    AssertPresShellsAndContextsSane(aPO->mKids[i], aPresShells, aPresContexts);
-  }
-}
-
-#ifdef MOZ_CRASHREPORTER
-static void
-AppendBoolean(nsCString& aString, bool aValue)
-{
-  if (aValue) {
-    aString.AppendLiteral("true");
-  } else {
-    aString.AppendLiteral("false");
-  }
-}
-
-static void
-NotePrintObjectTree(nsPrintObject* aPO, int32_t aDepth)
-{
-  nsCString note;
-  for (int32_t i = 0; i < aDepth; i++) {
-    note.AppendLiteral("  ");
-  }
-  note.AppendInt(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(aPO)), 16);
-  note.AppendLiteral(" = { mFrameType = ");
-  note.AppendInt(aPO->mFrameType);
-  note.AppendLiteral(", mHasBeenPrinted = ");
-  AppendBoolean(note, aPO->mHasBeenPrinted);
-  note.AppendLiteral(", mDontPrint = ");
-  AppendBoolean(note, aPO->mDontPrint);
-  note.AppendLiteral(", mPrintAsIs = ");
-  AppendBoolean(note, aPO->mPrintAsIs);
-  note.AppendLiteral(", mInvisible = ");
-  AppendBoolean(note, aPO->mInvisible);
-  note.AppendLiteral(", mPrintPreview = ");
-  AppendBoolean(note, aPO->mPrintPreview);
-  note.AppendLiteral(", mDidCreateDocShell = ");
-  AppendBoolean(note, aPO->mDidCreateDocShell);
-  note.AppendLiteral(", mShrinkRatio = ");
-  note.AppendFloat(aPO->mShrinkRatio);
-  note.AppendLiteral(", mZoomRatio = ");
-  note.AppendFloat(aPO->mZoomRatio);
-  note.AppendLiteral(", mContent = ");
-  if (aPO->mContent) {
-    nsString tag;
-    aPO->mContent->Tag()->ToString(tag);
-    LossyAppendUTF16toASCII(tag, note);
-  } else {
-    note.AppendLiteral("null");
-  }
-  note.AppendLiteral(" }\n");
-  CrashReporter::AppendAppNotesToCrashReport(note);
-  for (uint32_t i = 0; i < aPO->mKids.Length(); i++) {
-    NotePrintObjectTree(aPO->mKids[i], aDepth + 1);
-  }
-}
-
-static void
-NotePrintObjectTree(nsPrintObject* aPO)
-{
-  CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Print object tree:\n"));
-  NotePrintObjectTree(aPO, 1);
-}
-#endif
-
-#undef ASSERT_AND_NOTE
-
-static void
-AssertPresShellsAndContextsSane(nsPrintObject* aPO)
-{
-  nsTArray<nsIPresShell*> presShells;
-  nsTArray<nsPresContext*> presContexts;
-  AssertPresShellsAndContextsSane(aPO, presShells, presContexts);
-}
-
 nsPrintData::~nsPrintData()
 {
   MOZ_COUNT_DTOR(nsPrintData);
   // remove the event listeners
   if (mPPEventListeners) {
     mPPEventListeners->RemoveListeners();
     NS_RELEASE(mPPEventListeners);
   }
@@ -214,20 +94,16 @@ nsPrintData::~nsPrintData()
         rv = mPrintDC->AbortDocument();  
       }
       if (NS_FAILED(rv)) {
         // XXX nsPrintData::ShowPrintErrorDialog(rv);
       }
     }
   }
 
-  AssertPresShellsAndContextsSane(mPrintObject);
-#ifdef MOZ_CRASHREPORTER
-  NotePrintObjectTree(mPrintObject);
-#endif
   delete mPrintObject;
 
   if (mBrandName) {
     NS_Free(mBrandName);
   }
 }
 
 void nsPrintData::OnStartPrinting()
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -119,20 +119,16 @@ static const char kPrintingPromptService
 
 #include "nsFocusManager.h"
 #include "nsRange.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIURIFixup.h"
 #include "mozilla/dom/Element.h"
 #include "nsContentList.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //-----------------------------------------------------
 // PR LOGGING
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG /* Allow logging in the release build */
 #endif
@@ -1537,19 +1533,16 @@ nsresult nsPrintEngine::CleanupOnFailure
    * 
    * When rv == NS_ERROR_ABORT, it means we want out of the 
    * print job without displaying any error messages
    */
   if (aResult != NS_ERROR_ABORT) {
     ShowPrintErrorDialog(aResult, aIsPrinting);
   }
 
-#ifdef MOZ_CRASHREPORTER
-  CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Unsuccessful print.\n"));
-#endif
   FirePrintCompletionEvent();
 
   return aResult;
 
 }
 
 //---------------------------------------------------------------------
 void
@@ -3180,19 +3173,16 @@ nsPrintEngine::DonePrintingPages(nsPrint
     bool didPrint = PrintDocContent(mPrt->mPrintObject, rv);
     if (NS_SUCCEEDED(rv) && didPrint) {
       PR_PL(("****** In DV::DonePrintingPages PO: %p (%s) didPrint:%s (Not Done Printing)\n", aPO, gFrameTypesStr[aPO->mFrameType], PRT_YESNO(didPrint)));
       return false;
     }
   }
 
   if (NS_SUCCEEDED(aResult)) {
-#ifdef MOZ_CRASHREPORTER
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Successful print.\n"));
-#endif
     FirePrintCompletionEvent();
   }
 
   TurnScriptingOn(true);
   SetIsPrinting(false);
 
   // Release reference to mPagePrintTimer; the timer object destroys itself
   // after this returns true
--- a/layout/printing/nsPrintObject.cpp
+++ b/layout/printing/nsPrintObject.cpp
@@ -9,20 +9,16 @@
 #include "nsContentUtils.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsGkAtoms.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIBaseWindow.h"
                                                    
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 //---------------------------------------------------
 //-- nsPrintObject Class Impl
 //---------------------------------------------------
 nsPrintObject::nsPrintObject() :
   mContent(nullptr), mFrameType(eFrame), mParent(nullptr),
   mHasBeenPrinted(false), mDontPrint(true), mPrintAsIs(false),
   mInvisible(false), mDidCreateDocShell(false),
   mShrinkRatio(1.0), mZoomRatio(1.0)
@@ -100,22 +96,16 @@ nsPrintObject::Init(nsIDocShell* aDocShe
 }
 
 //------------------------------------------------------------------
 // Resets PO by destroying the presentation
 void 
 nsPrintObject::DestroyPresentation()
 {
   if (mPresShell) {
-#ifdef MOZ_CRASHREPORTER
-    if (mPresShell->GetPresContext() && !mPresShell->GetPresContext()->GetPresShell()) {
-      NS_ASSERTION(false, "about to destroy print object's PresShell when its pres context no longer has it");
-      CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("about to destroy print object's PresShell when its pres context no longer has it\n"));
-    }
-#endif
     mPresShell->EndObservingDocument();
     nsAutoScriptBlocker scriptBlocker;
     nsCOMPtr<nsIPresShell> shell = mPresShell;
     mPresShell = nullptr;
     shell->Destroy();
   }
   mPresContext = nullptr;
   mViewManager = nullptr;