Try to avoid crashing in HTML5 parser cycle collection

This commit is contained in:
Henri Sivonen 2009-06-24 13:38:11 +03:00
parent d88f6b6525
commit b01c3bdb49

View File

@ -556,13 +556,16 @@ nsHtml5TreeBuilder::DoTraverse(nsCycleCollectionTraversalCallback &cb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(formPointer);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(headPointer);
if (stack) {
for (PRInt32 i = 0; i <= currentPtr; i++) {
#ifdef DEBUG_CC
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "stack[i]");
#endif
cb.NoteNativeChild(stack[i], &NS_CYCLE_COLLECTION_NAME(nsHtml5StackNode));
}
}
if (listOfActiveFormattingElements) {
for (PRInt32 i = 0; i <= listPtr; i++) {
if (listOfActiveFormattingElements[i]) {
#ifdef DEBUG_CC
@ -571,6 +574,7 @@ nsHtml5TreeBuilder::DoTraverse(nsCycleCollectionTraversalCallback &cb)
cb.NoteNativeChild(listOfActiveFormattingElements[i], &NS_CYCLE_COLLECTION_NAME(nsHtml5StackNode));
}
}
}
const nsHtml5TreeOperation* start = mOpQueue.Elements();
const nsHtml5TreeOperation* end = start + mOpQueue.Length();