Bug 1354933 - Back out diagnostic asserts from Gecko 55. a=jcristau
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 22 Jun 2017 15:40:40 -0500
changeset 414069 f018f0849a049c6bd0b9fb96eebfe858014f3847
parent 414068 d5d30ef9787f6b0eaf1c480d200cdb9e31812f58
child 414070 4436ddd408221bc023885feec793c8e09104741b
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/PresShell.cpp
layout/base/nsDocumentViewer.cpp
view/nsView.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1162,22 +1162,16 @@ LogTextPerfStats(gfxTextPerfMetrics* aTe
   }
 }
 
 void
 PresShell::Destroy()
 {
   // Do not add code before this line please!
   if (mHaveShutDown) {
-    // If we never got a root frame the root view could exist now still.
-    // In that case assert that it has no children and no frame.
-    MOZ_RELEASE_ASSERT(!mViewManager || !mViewManager->GetRootView() ||
-      (!mViewManager->GetRootView()->GetFrame() &&
-       !mViewManager->GetRootView()->GetFirstChild()));
-    MOZ_RELEASE_ASSERT(!mFrameConstructor || !mFrameConstructor->GetRootFrame());
     return;
   }
 
   NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
     "destroy called on presshell while scripts not blocked");
 
   // dump out cumulative text perf metrics
   gfxTextPerfMetrics* tp;
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -404,18 +404,16 @@ protected:
   int32_t mHintCharsetSource;
   nsCString mHintCharset;
   nsCString mForceCharacterSet;
   
   bool mIsPageMode;
   bool mInitializedForPrintPreview;
   bool mHidden;
   bool mPrintRelated; // Only use for asserts.
-  bool mPresShellDestroyed; // Only use for asserts.
-  bool mDestroyWasFull; // Only use for asserts.
 };
 
 namespace mozilla {
 
 /**
  * A RAII class for automatic dispatch of the 'beforeprint' and 'afterprint'
  * events ('beforeprint' on construction, 'afterprint' on destruction).
  *
@@ -540,19 +538,17 @@ nsDocumentViewer::nsDocumentViewer()
 #ifdef DEBUG
     mDebugFile(nullptr),
 #endif // DEBUG
 #endif // NS_PRINTING
     mHintCharsetSource(kCharsetUninitialized),
     mIsPageMode(false),
     mInitializedForPrintPreview(false),
     mHidden(false),
-    mPrintRelated(false),
-    mPresShellDestroyed(true),
-    mDestroyWasFull(false)
+    mPrintRelated(false)
 {
   PrepareToStartLoad();
 }
 
 void
 nsDocumentViewer::SetPrintRelated()
 {
   if (!mPrintRelated) {
@@ -579,41 +575,26 @@ NS_INTERFACE_MAP_END
 
 nsDocumentViewer::~nsDocumentViewer()
 {
   if (mDocument) {
     Close(nullptr);
     mDocument->Destroy();
   }
 
-  nsIFrame* vmRootFrame =
-    mViewManager && mViewManager->GetRootView()
-      ? mViewManager->GetRootView()->GetFrame()
-      : nullptr;
-  nsIFrame* psRootFrame = mPresShell ? mPresShell->GetRootFrame() : nullptr;
-  MOZ_RELEASE_ASSERT(vmRootFrame == psRootFrame);
-
   NS_ASSERTION(!mPresShell && !mPresContext,
                "User did not call nsIContentViewer::Destroy");
   if (mPresShell || mPresContext) {
     // Make sure we don't hand out a reference to the content viewer to
     // the SHEntry!
     mSHEntry = nullptr;
-    mDestroyWasFull = false;
+
     Destroy();
-    MOZ_RELEASE_ASSERT(mDestroyWasFull);
   }
 
-  MOZ_RELEASE_ASSERT(mPresShellDestroyed);
-
-  MOZ_RELEASE_ASSERT(!mPresShell || !mPresShell->GetRootFrame());
-  MOZ_RELEASE_ASSERT(!mViewManager || !mViewManager->GetRootView() ||
-    (!mViewManager->GetRootView()->GetFrame() &&
-     !mViewManager->GetRootView()->GetFirstChild()));
-
   if (mSelectionListener) {
     mSelectionListener->Disconnect();
   }
 
   if (mFocusListener) {
     mFocusListener->Disconnect();
   }
 
@@ -722,17 +703,16 @@ nsDocumentViewer::InitPresentationStuff(
   StyleSetHandle styleSet = CreateStyleSet(mDocument);
 
   // Now make the shell for the document
   mPresShell = mDocument->CreateShell(mPresContext, mViewManager, styleSet);
   if (!mPresShell) {
     styleSet->Delete();
     return NS_ERROR_FAILURE;
   }
-  mPresShellDestroyed = false;
 
   // We're done creating the style set
   styleSet->EndUpdate();
 
   if (aDoInitialReflow) {
     // Since Initialize() will create frames for *all* items
     // that are currently in the document tree, we need to flush
     // any pending notifications to prevent the content sink from
@@ -1811,18 +1791,16 @@ nsDocumentViewer::Destroy()
   if (mPresContext) {
     DestroyPresContext();
   }
 
   mWindow = nullptr;
   mViewManager = nullptr;
   mContainer = WeakPtr<nsDocShell>();
 
-  mDestroyWasFull = true;
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocumentViewer::Stop(void)
 {
   NS_ASSERTION(mDocument, "Stop called too early or too late");
   if (mDocument) {
@@ -4674,43 +4652,25 @@ nsDocumentViewer::SetIsHidden(bool aHidd
 {
   mHidden = aHidden;
   return NS_OK;
 }
 
 void
 nsDocumentViewer::DestroyPresShell()
 {
-  nsIFrame* vmRootFrame =
-    mViewManager && mViewManager->GetRootView()
-      ? mViewManager->GetRootView()->GetFrame()
-      : nullptr;
-  nsIFrame* psRootFrame = mPresShell ? mPresShell->GetRootFrame() : nullptr;
-  MOZ_RELEASE_ASSERT(vmRootFrame == psRootFrame);
-
   // Break circular reference (or something)
   mPresShell->EndObservingDocument();
 
   RefPtr<mozilla::dom::Selection> selection = GetDocumentSelection();
   if (selection && mSelectionListener)
     selection->RemoveSelectionListener(mSelectionListener);
 
   nsAutoScriptBlocker scriptBlocker;
-  bool hadRootFrame = !!mPresShell->GetRootFrame();
   mPresShell->Destroy();
-  mPresShellDestroyed = true;
-  MOZ_RELEASE_ASSERT(!mPresShell->GetRootFrame());
-  // destroying the frame tree via presshell destroy should have done this
-  if (hadRootFrame) {
-    MOZ_RELEASE_ASSERT(!mViewManager || !mViewManager->GetRootView());
-  }
-  MOZ_RELEASE_ASSERT(!mViewManager || !mViewManager->GetRootView() ||
-    (!mViewManager->GetRootView()->GetFrame() &&
-     !mViewManager->GetRootView()->GetFirstChild()));
-
   mPresShell = nullptr;
 }
 
 void
 nsDocumentViewer::DestroyPresContext()
 {
   mPresContext->Detach();
   mPresContext = nullptr;
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -63,20 +63,16 @@ void nsView::DropMouseGrabbing()
 }
 
 nsView::~nsView()
 {
   MOZ_COUNT_DTOR(nsView);
 
   bool printRelated = mViewManager && mViewManager->GetPrintRelated();
 
-  if (mViewManager && (mViewManager->GetRootView() == this)) {
-    MOZ_RELEASE_ASSERT(!GetFirstChild());
-  }
-
   while (GetFirstChild())
   {
     nsView* child = GetFirstChild();
     if (child->GetViewManager() == mViewManager) {
       child->Destroy();
     } else {
       // just unhook it. Someone else will want to destroy this.
       RemoveChild(child);
@@ -471,18 +467,16 @@ void nsView::InsertChild(nsView *aChild,
       //insert after sibling
       aChild->SetNextSibling(aSibling->GetNextSibling());
       aSibling->SetNextSibling(aChild);
     }
     else
     {
       aChild->SetNextSibling(mFirstChild);
       mFirstChild = aChild;
-      MOZ_RELEASE_ASSERT(!mFirstChild || mFrame ||
-        mFirstChild->GetViewManager() != GetViewManager());
     }
     aChild->SetParent(this);
 
     // If we just inserted a root view, then update the RootViewManager
     // on all view managers in the new subtree.
 
     nsViewManager *vm = aChild->GetViewManager();
     if (vm->GetRootView() == aChild)