Bug 1467526 - Add a few MOZ_DIAGNOSTIC_ASSERT in nsLineBox::DeleteLineList to enforce our invariants better. r=emilio
authorMats Palmgren <mats@mozilla.com>
Thu, 07 Jun 2018 20:20:34 +0200
changeset 421828 3f9536c4da4d8a22545b83eebca4d1d62b236535
parent 421827 8a4c492cbecd339d1cd5a7a630575d8d628d3217
child 421829 705c8b40f4c1c51bd4f9c46a5d854ec439454ff2
push id34107
push useraciure@mozilla.com
push dateThu, 07 Jun 2018 21:50:48 +0000
treeherdermozilla-central@ea21bf3e665d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1467526
milestone62.0a1
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
Bug 1467526 - Add a few MOZ_DIAGNOSTIC_ASSERT in nsLineBox::DeleteLineList to enforce our invariants better. r=emilio
layout/generic/nsLineBox.cpp
--- a/layout/generic/nsLineBox.cpp
+++ b/layout/generic/nsLineBox.cpp
@@ -391,22 +391,24 @@ nsLineBox::DeleteLineList(nsPresContext*
   // frame tree while we're destroying.
   while (!aLines.empty()) {
     nsLineBox* line = aLines.front();
     if (MOZ_UNLIKELY(line->mFlags.mHasHashedFrames)) {
       line->SwitchToCounter();  // Avoid expensive has table removals.
     }
     while (line->GetChildCount() > 0) {
       nsIFrame* child = aFrames->RemoveFirstChild();
-      MOZ_ASSERT(child == line->mFirstChild, "Lines out of sync");
+      MOZ_DIAGNOSTIC_ASSERT(child->PresContext() == aPresContext);
+      MOZ_DIAGNOSTIC_ASSERT(child == line->mFirstChild, "Lines out of sync");
       line->mFirstChild = aFrames->FirstChild();
       line->NoteFrameRemoved(child);
       child->DestroyFrom(aDestructRoot, aPostDestroyData);
     }
-
+    MOZ_DIAGNOSTIC_ASSERT(line == aLines.front(),
+                          "destroying child frames messed up our lines!");
     aLines.pop_front();
     line->Destroy(shell);
   }
 }
 
 bool
 nsLineBox::RFindLineContaining(nsIFrame* aFrame,
                                const nsLineList::iterator& aBegin,