Add checks to VerifyList that previous siblings match next siblings. (Bug 563584, patch 21) r=roc
authorL. David Baron <dbaron@dbaron.org>
Thu, 05 Aug 2010 21:59:20 -0700
changeset 48998 917317ddc51157cdb1ee3a756912da80c20bc752
parent 48997 e136a9f13eb6a1a1763084264426526b17418b0c
child 48999 66c78df18e5018ca151d7e8b4ec9675b1230fb28
push id14884
push userdbaron@mozilla.com
push dateFri, 06 Aug 2010 05:01:26 +0000
treeherderautoland@8ab7ef79b673 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs563584
milestone2.0b4pre
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
Add checks to VerifyList that previous siblings match next siblings. (Bug 563584, patch 21) r=roc
layout/generic/nsFrameList.cpp
--- a/layout/generic/nsFrameList.cpp
+++ b/layout/generic/nsFrameList.cpp
@@ -601,31 +601,39 @@ nsFrameList::VerifyList() const
                "bad list state");
 
   if (IsEmpty()) {
     return;
   }
 
   // Simple algorithm to find a loop in a linked list -- advance pointers
   // through it at speeds of 1 and 2, and if they ever get to be equal bail
+  NS_ASSERTION(!mFirstChild->GetPrevSibling(), "bad prev sibling pointer");
   nsIFrame *first = mFirstChild, *second = mFirstChild;
-  do {
+  for (;;) {
     first = first->GetNextSibling();
     second = second->GetNextSibling();
     if (!second) {
       break;
     }
+    NS_ASSERTION(second->GetPrevSibling()->GetNextSibling() == second,
+                 "bad prev sibling pointer");
     second = second->GetNextSibling();
     if (first == second) {
       // Loop detected!  Since second advances faster, they can't both be null;
       // we would have broken out of the loop long ago.
       NS_ERROR("loop in frame list.  This will probably hang soon.");
       return;
     }                           
-  } while (first && second);
+    if (!second) {
+      break;
+    }
+    NS_ASSERTION(second->GetPrevSibling()->GetNextSibling() == second,
+                 "bad prev sibling pointer");
+  }
 
   NS_ASSERTION(mLastChild == nsLayoutUtils::GetLastSibling(mFirstChild),
                "bogus mLastChild");
   // XXX we should also assert that all GetParent() are either null or
   // the same non-null value, but nsCSSFrameConstructor::nsFrameItems
   // prevents that, e.g. table captions.
 }
 #endif