Back out changeset 43af422173e3 (add diagnostic asserts) (bug 1354933)
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 22 Jun 2017 15:40:40 -0500
changeset 371889 20cfd275556463d76fbf17197796291c8897901e
parent 371888 58ec9fceb4acff9dfbb798d9cf9a859af6295521
child 371890 9ff81e376529981389074a985083d161e2f155d3
push id32256
push userarchaeopteryx@coole-files.de
push dateSun, 30 Jul 2017 09:19:42 +0000
treeherdermozilla-central@8b577b152383 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1354933
milestone56.0a1
backs out43af422173e3bdfddc18c02d7f7c430d6ec9cdfe
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
Back out changeset 43af422173e3 (add diagnostic asserts) (bug 1354933)
layout/base/PresShell.cpp
layout/base/nsDocumentViewer.cpp
view/nsView.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1159,22 +1159,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;
   const Encoding* mHintCharset;
   const Encoding* 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).
  *
@@ -542,19 +540,17 @@ nsDocumentViewer::nsDocumentViewer()
 #endif // DEBUG
 #endif // NS_PRINTING
     mHintCharsetSource(kCharsetUninitialized),
     mHintCharset(nullptr),
     mForceCharacterSet(nullptr),
     mIsPageMode(false),
     mInitializedForPrintPreview(false),
     mHidden(false),
-    mPrintRelated(false),
-    mPresShellDestroyed(true),
-    mDestroyWasFull(false)
+    mPrintRelated(false)
 {
   PrepareToStartLoad();
 }
 
 void
 nsDocumentViewer::SetPrintRelated()
 {
   if (!mPrintRelated) {
@@ -581,40 +577,25 @@ 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();
   }
@@ -733,17 +714,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
@@ -1839,18 +1819,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) {
@@ -4772,42 +4750,24 @@ nsDocumentViewer::DestroyPresShell()
 {
   // We assert this because destroying the pres shell could otherwise cause
   // re-entrancy into nsDocumentViewer methods, and all callers of
   // DestroyPresShell need to do other cleanup work afterwards before it
   // is safe for those re-entrant method calls to be made.
   MOZ_ASSERT(!nsContentUtils::IsSafeToRunScript(),
              "DestroyPresShell must only be called when scripts are blocked");
 
-  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);
 
-  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);
@@ -475,18 +471,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)