Bug 1354933 - Back out diagnostic asserts from Gecko 55. a=jcristau
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 07 Jul 2017 14:54:55 -0500
changeset 414239 e777857c44d262ec5bf5c152730a7929b57947c3
parent 414238 735095797d9ec0a5dbf24f8c557299a27b54bede
child 414240 610e42d0872d39989b98abb3a5918ac5a39be495
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcristau
bugs1354933
milestone55.0
Bug 1354933 - Back out diagnostic asserts from Gecko 55. a=jcristau
layout/base/nsDocumentViewer.cpp
view/nsView.cpp
view/nsViewManager.cpp
view/nsViewManager.h
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -321,18 +321,16 @@ private:
 protected:
   // These return the current shell/prescontext etc.
   nsIPresShell* GetPresShell();
   nsPresContext* GetPresContext();
   nsViewManager* GetViewManager();
 
   void DetachFromTopLevelWidget();
 
-  void SetPrintRelated();
-
   // IMPORTANT: The ownership implicit in the following member
   // variables has been explicitly checked and set using nsCOMPtr
   // for owning pointers and raw COM interface pointers for weak
   // (ie, non owning) references. If you add any members to this
   // class, please make the ownership explicit (pinkerton, scc).
 
   WeakPtr<nsDocShell> mContainer; // it owns me!
   nsWeakPtr mTopContainerWhilePrinting;
@@ -403,17 +401,16 @@ protected:
   /* character set member data */
   int32_t mHintCharsetSource;
   nsCString mHintCharset;
   nsCString mForceCharacterSet;
   
   bool mIsPageMode;
   bool mInitializedForPrintPreview;
   bool mHidden;
-  bool mPrintRelated; // Only use for asserts.
 };
 
 namespace mozilla {
 
 /**
  * A RAII class for automatic dispatch of the 'beforeprint' and 'afterprint'
  * events ('beforeprint' on construction, 'afterprint' on destruction).
  *
@@ -537,33 +534,21 @@ nsDocumentViewer::nsDocumentViewer()
 #endif // NS_PRINT_PREVIEW
 #ifdef DEBUG
     mDebugFile(nullptr),
 #endif // DEBUG
 #endif // NS_PRINTING
     mHintCharsetSource(kCharsetUninitialized),
     mIsPageMode(false),
     mInitializedForPrintPreview(false),
-    mHidden(false),
-    mPrintRelated(false)
+    mHidden(false)
 {
   PrepareToStartLoad();
 }
 
-void
-nsDocumentViewer::SetPrintRelated()
-{
-  if (!mPrintRelated) {
-    if (mViewManager) {
-      mViewManager->SetPrintRelated();
-    }
-  }
-  mPrintRelated = true;
-}
-
 NS_IMPL_ADDREF(nsDocumentViewer)
 NS_IMPL_RELEASE(nsDocumentViewer)
 
 NS_INTERFACE_MAP_BEGIN(nsDocumentViewer)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewer)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewerFile)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewerEdit)
     NS_INTERFACE_MAP_ENTRY(nsIDocumentViewerPrint)
@@ -2525,20 +2510,16 @@ nsDocumentViewer::MakeWindow(const nsSiz
   mViewManager = new nsViewManager();
 
   nsDeviceContext *dx = mPresContext->DeviceContext();
 
   nsresult rv = mViewManager->Init(dx);
   if (NS_FAILED(rv))
     return rv;
 
-  if (mPrintRelated) {
-    mViewManager->SetPrintRelated();
-  }
-
   // The root view is always at 0,0.
   nsRect tbounds(nsPoint(0, 0), aSize);
   // Create a view
   nsView* view = mViewManager->CreateView(tbounds, aContainerView);
   if (!view)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Create a widget if we were given a parent widget or don't have a
@@ -2851,18 +2832,16 @@ NS_IMETHODIMP nsDocumentViewer::SetComma
  *	@update 01/24/00 dwc
  */
 NS_IMETHODIMP
 nsDocumentViewer::Print(bool              aSilent,
                           FILE *            aDebugFile,
                           nsIPrintSettings* aPrintSettings)
 {
 #ifdef NS_PRINTING
-  SetPrintRelated();
-
   nsCOMPtr<nsIPrintSettings> printSettings;
 
 #ifdef DEBUG
   nsresult rv = NS_ERROR_FAILURE;
 
   mDebugFile = aDebugFile;
   // if they don't pass in a PrintSettings, then make one
   // it will have all the default values
@@ -3874,18 +3853,16 @@ nsDocViewerFocusListener::Init(nsDocumen
  */
 
 #ifdef NS_PRINTING
 
 NS_IMETHODIMP
 nsDocumentViewer::Print(nsIPrintSettings*       aPrintSettings,
                           nsIWebProgressListener* aWebProgressListener)
 {
-  SetPrintRelated();
-
   // Printing XUL documents is not supported.
   nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
   if (xulDoc) {
     return NS_ERROR_FAILURE;
   }
 
   if (!mContainer) {
     PR_PL(("Container was destroyed yet we are still trying to use it!"));
@@ -3981,18 +3958,16 @@ nsDocumentViewer::Print(nsIPrintSettings
   return rv;
 }
 
 NS_IMETHODIMP
 nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings, 
                                mozIDOMWindowProxy* aChildDOMWin, 
                                nsIWebProgressListener* aWebProgressListener)
 {
-  SetPrintRelated();
-
 #if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
   NS_WARNING_ASSERTION(
     IsInitializedForPrintPreview(),
     "Using docshell.printPreview is the preferred way for print previewing!");
 
   NS_ENSURE_ARG_POINTER(aChildDOMWin);
   nsresult rv = NS_OK;
 
@@ -4075,18 +4050,16 @@ nsDocumentViewer::PrintPreview(nsIPrintS
   return NS_ERROR_FAILURE;
 #endif
 }
 
 //----------------------------------------------------------------------
 NS_IMETHODIMP
 nsDocumentViewer::PrintPreviewNavigate(int16_t aType, int32_t aPageNum)
 {
-  SetPrintRelated();
-
   if (!GetIsPrintPreview() ||
       mPrintEngine->GetIsCreatingPrintPreview())
     return NS_ERROR_FAILURE;
 
   nsIScrollableFrame* sf =
     mPrintEngine->GetPrintPreviewPresShell()->GetRootScrollFrameAsScrollable();
   if (!sf)
     return NS_OK;
@@ -4419,19 +4392,16 @@ nsDocumentViewer::GetIsPrinting()
 }
 
 //------------------------------------------------------------
 // Notification from the PrintEngine of the current Printing status
 void
 nsDocumentViewer::SetIsPrinting(bool aIsPrinting)
 {
 #ifdef NS_PRINTING
-  if (aIsPrinting) {
-    SetPrintRelated();
-  }
   // Set all the docShells in the docshell tree to be printing.
   // that way if anyone of them tries to "navigate" it can't
   nsCOMPtr<nsIDocShell> docShell(mContainer);
   if (docShell || !aIsPrinting) {
     SetIsPrintingInDocShellTree(docShell, aIsPrinting, true);
   } else {
     NS_WARNING("Did you close a window before printing?");
   }
@@ -4459,19 +4429,16 @@ nsDocumentViewer::GetIsPrintPreview()
 }
 
 //------------------------------------------------------------
 // Notification from the PrintEngine of the current PP status
 void
 nsDocumentViewer::SetIsPrintPreview(bool aIsPrintPreview)
 {
 #ifdef NS_PRINTING
-  if (aIsPrintPreview) {
-    SetPrintRelated();
-  }
   // Set all the docShells in the docshell tree to be printing.
   // that way if anyone of them tries to "navigate" it can't
   nsCOMPtr<nsIDocShell> docShell(mContainer);
   if (docShell || !aIsPrintPreview) {
     SetIsPrintingInDocShellTree(docShell, aIsPrintPreview, true);
   }
   if (!aIsPrintPreview) {
     // Dispatch the 'afterprint' event now, if pending:
@@ -4496,17 +4463,16 @@ nsDocumentViewer::SetIsPrintPreview(bool
 //----------------------------------------------------------------------------------
 // nsIDocumentViewerPrint IFace
 //----------------------------------------------------------------------------------
 
 //------------------------------------------------------------
 void
 nsDocumentViewer::IncrementDestroyRefCount()
 {
-  SetPrintRelated();
   ++mDestroyRefCount;
 }
 
 //------------------------------------------------------------
 
 #if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
 //------------------------------------------------------------
 // Reset ESM focus for all descendent doc shells.
@@ -4533,18 +4499,16 @@ ResetFocusState(nsIDocShell* aDocShell)
   }
 }
 #endif // NS_PRINTING && NS_PRINT_PREVIEW
 
 void
 nsDocumentViewer::ReturnToGalleyPresentation()
 {
 #if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
-  SetPrintRelated();
-
   if (!GetIsPrintPreview()) {
     NS_ERROR("Wow, we should never get here!");
     return;
   }
 
   SetIsPrintPreview(false);
 
   mPrintEngine->TurnScriptingOn(true);
@@ -4574,17 +4538,16 @@ nsDocumentViewer::ReturnToGalleyPresenta
 //   This IS called from two places in this module for cleaning
 //   up when an error occurred during the start up printing 
 //   and print preview
 //
 void
 nsDocumentViewer::OnDonePrinting() 
 {
 #if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
-  SetPrintRelated();
   if (mPrintEngine) {
     RefPtr<nsPrintEngine> pe = mPrintEngine;
     if (GetIsPrintPreview()) {
       pe->DestroyPrintingData();
     } else {
       mPrintEngine = nullptr;
       pe->Destroy();
     }
@@ -4605,20 +4568,16 @@ nsDocumentViewer::OnDonePrinting()
       mClosingWhilePrinting = false;
     }
   }
 #endif // NS_PRINTING && NS_PRINT_PREVIEW
 }
 
 NS_IMETHODIMP nsDocumentViewer::SetPageMode(bool aPageMode, nsIPrintSettings* aPrintSettings)
 {
-  if (aPageMode) {
-    SetPrintRelated();
-  }
-
   // XXX Page mode is only partially working; it's currently used for
   // reftests that require a paginated context
   mIsPageMode = aPageMode;
 
   // The DestroyPresShell call requires a script blocker, since the
   // PresShell::Destroy call it does can cause scripts to run, which could
   // re-entrantly call methods on the nsDocumentViewer.
   nsAutoScriptBlocker scriptBlocker;
@@ -4721,17 +4680,16 @@ bool
 nsDocumentViewer::IsInitializedForPrintPreview()
 {
   return mInitializedForPrintPreview;
 }
 
 void
 nsDocumentViewer::InitializeForPrintPreview()
 {
-  SetPrintRelated();
   mInitializedForPrintPreview = true;
 }
 
 void
 nsDocumentViewer::SetPrintPreviewPresentation(nsViewManager* aViewManager,
                                               nsPresContext* aPresContext,
                                               nsIPresShell* aPresShell)
 {
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -61,18 +61,16 @@ void nsView::DropMouseGrabbing()
   if (presShell)
     presShell->ClearMouseCaptureOnView(this);
 }
 
 nsView::~nsView()
 {
   MOZ_COUNT_DTOR(nsView);
 
-  bool printRelated = mViewManager && mViewManager->GetPrintRelated();
-
   while (GetFirstChild())
   {
     nsView* child = GetFirstChild();
     if (child->GetViewManager() == mViewManager) {
       child->Destroy();
     } else {
       // just unhook it. Someone else will want to destroy this.
       RemoveChild(child);
@@ -114,21 +112,16 @@ nsView::~nsView()
   if (mPreviousWindow) {
     mPreviousWindow->SetPreviouslyAttachedWidgetListener(nullptr);
   }
 
   // Destroy and release the widget
   DestroyWidget();
 
   delete mDirtyRegion;
-
-  if (MOZ_UNLIKELY(mFrame)) {
-    gfxCriticalNoteOnce << "~nsView mFrame printRelated " << (printRelated ? "true" : "false");
-  }
-  MOZ_RELEASE_ASSERT(!mFrame);
 }
 
 class DestroyWidgetRunnable : public Runnable {
 public:
   NS_DECL_NSIRUNNABLE
 
   explicit DestroyWidgetRunnable(nsIWidget* aWidget) : mWidget(aWidget) {}
 
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -58,17 +58,16 @@ nsViewManager::nsViewManager()
   : mPresShell(nullptr)
   , mDelayedResize(NSCOORD_NONE, NSCOORD_NONE)
   , mRootView(nullptr)
   , mRootViewManager(this)
   , mRefreshDisableCount(0)
   , mPainting(false)
   , mRecursiveRefreshPending(false)
   , mHasPendingWidgetGeometryChanges(false)
-  , mPrintRelated(false)
 {
   if (gViewManagers == nullptr) {
     // Create an array to hold a list of view managers
     gViewManagers = new nsTArray<nsViewManager*>;
   }
  
   gViewManagers->AppendElement(this);
 }
--- a/view/nsViewManager.h
+++ b/view/nsViewManager.h
@@ -314,19 +314,16 @@ public:
    */
   void UpdateWidgetGeometry();
 
   int32_t AppUnitsPerDevPixel() const
   {
     return mContext->AppUnitsPerDevPixel();
   }
 
-  void SetPrintRelated() { mPrintRelated = true; }
-  bool GetPrintRelated() { return mPrintRelated; }
-
 private:
   static uint32_t gLastUserEventTime;
 
   /* Update the cached RootViewManager pointer on this view manager. */
   void InvalidateHierarchy();
   void FlushPendingInvalidates();
 
   void ProcessPendingUpdatesForView(nsView *aView,
@@ -405,17 +402,16 @@ private:
   // the root view manager.  Some have accessor functions to enforce
   // this, as noted.
 
   int32_t           mRefreshDisableCount;
   // Use IsPainting() and SetPainting() to access mPainting.
   bool              mPainting;
   bool              mRecursiveRefreshPending;
   bool              mHasPendingWidgetGeometryChanges;
-  bool              mPrintRelated;
 
   //from here to public should be static and locked... MMP
 
   //list of view managers
   static nsTArray<nsViewManager*> *gViewManagers;
 };
 
 /**