Add checks to VerifyList that previous siblings match next siblings. (Bug 563584, patch 21) r=roc

This commit is contained in:
L. David Baron 2010-08-05 21:59:20 -07:00
Родитель 6aaed7c6a6
Коммит c2bbf775c6
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -606,13 +606,16 @@ nsFrameList::VerifyList() const
// 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;
@ -620,7 +623,12 @@ nsFrameList::VerifyList() const
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");