Back out changeset 43af422173e3 (add diagnostic asserts) (bug 1354933)

This commit is contained in:
Timothy Nikkel 2017-06-22 15:40:40 -05:00
parent 5db4da69f6
commit 417163a1db
3 changed files with 2 additions and 54 deletions

View File

@ -1164,12 +1164,6 @@ 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;
}

View File

@ -409,8 +409,6 @@ protected:
bool mInitializedForPrintPreview;
bool mHidden;
bool mPrintRelated; // Only use for asserts.
bool mPresShellDestroyed; // Only use for asserts.
bool mDestroyWasFull; // Only use for asserts.
};
namespace mozilla {
@ -547,9 +545,7 @@ nsDocumentViewer::nsDocumentViewer()
mIsPageMode(false),
mInitializedForPrintPreview(false),
mHidden(false),
mPrintRelated(false),
mPresShellDestroyed(true),
mDestroyWasFull(false)
mPrintRelated(false)
{
PrepareToStartLoad();
}
@ -586,31 +582,16 @@ nsDocumentViewer::~nsDocumentViewer()
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();
}
@ -738,7 +719,6 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow)
styleSet->Delete();
return NS_ERROR_FAILURE;
}
mPresShellDestroyed = false;
// We're done creating the style set
styleSet->EndUpdate();
@ -1844,8 +1824,6 @@ nsDocumentViewer::Destroy()
mViewManager = nullptr;
mContainer = WeakPtr<nsDocShell>();
mDestroyWasFull = true;
return NS_OK;
}
@ -4777,13 +4755,6 @@ nsDocumentViewer::DestroyPresShell()
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();
@ -4791,18 +4762,7 @@ nsDocumentViewer::DestroyPresShell()
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;
}

View File

@ -68,10 +68,6 @@ nsView::~nsView()
bool printRelated = mViewManager && mViewManager->GetPrintRelated();
if (mViewManager && (mViewManager->GetRootView() == this)) {
MOZ_RELEASE_ASSERT(!GetFirstChild());
}
while (GetFirstChild())
{
nsView* child = GetFirstChild();
@ -480,8 +476,6 @@ void nsView::InsertChild(nsView *aChild, nsView *aSibling)
{
aChild->SetNextSibling(mFirstChild);
mFirstChild = aChild;
MOZ_RELEASE_ASSERT(!mFirstChild || mFrame ||
mFirstChild->GetViewManager() != GetViewManager());
}
aChild->SetParent(this);