Skip to content

Commit

Permalink
Back out changeset 43af422173e3 (add diagnostic asserts) (bug 1354933)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnikkel committed Jun 22, 2017
1 parent a8abd27 commit a3fe71b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 54 deletions.
6 changes: 0 additions & 6 deletions layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
44 changes: 2 additions & 42 deletions layout/base/nsDocumentViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ class nsDocumentViewer final : public nsIContentViewer,
bool mInitializedForPrintPreview;
bool mHidden;
bool mPrintRelated; // Only use for asserts.
bool mPresShellDestroyed; // Only use for asserts.
bool mDestroyWasFull; // Only use for asserts.
};

namespace mozilla {
Expand Down Expand Up @@ -547,9 +545,7 @@ nsDocumentViewer::nsDocumentViewer()
mIsPageMode(false),
mInitializedForPrintPreview(false),
mHidden(false),
mPrintRelated(false),
mPresShellDestroyed(true),
mDestroyWasFull(false)
mPrintRelated(false)
{
PrepareToStartLoad();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1844,8 +1824,6 @@ nsDocumentViewer::Destroy()
mViewManager = nullptr;
mContainer = WeakPtr<nsDocShell>();

mDestroyWasFull = true;

return NS_OK;
}

Expand Down Expand Up @@ -4777,32 +4755,14 @@ 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();

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;
}

Expand Down
6 changes: 0 additions & 6 deletions view/nsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit a3fe71b

Please sign in to comment.