Ensure that CanPropagate and CreateContextStackFor are consistent.
bug 423373, r+sr=sicking a=beltzner
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1056,17 +1056,17 @@ CNavDTD::HandleDefaultStartToken(CToken*
theParentContains = PR_TRUE;
} else {
CloseContainersTo(theIndex, aChildTag, PR_TRUE);
}
} else {
break;
}
} else {
- CreateContextStackFor(aChildTag);
+ CreateContextStackFor(theParentTag, aChildTag);
theIndex = mBodyContext->GetCount();
}
}
break;
case eLetInlineContainBlock:
// Break out of this loop and open the block.
theParentContains = theChildAgrees = PR_TRUE;
@@ -3095,29 +3095,28 @@ CNavDTD::AddHeadContent(nsIParserNode *a
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::AddHeadContent(), this=%p\n", this));
START_TIMER();
}
return result;
}
void
-CNavDTD::CreateContextStackFor(eHTMLTags aChild)
+CNavDTD::CreateContextStackFor(eHTMLTags aParent, eHTMLTags aChild)
{
mScratch.Truncate();
- eHTMLTags theTop = mBodyContext->Last();
- PRBool result = ForwardPropagate(mScratch, theTop, aChild);
+ PRBool result = ForwardPropagate(mScratch, aParent, aChild);
if (!result) {
- if (eHTMLTag_unknown == theTop) {
+ if (eHTMLTag_unknown == aParent) {
result = BackwardPropagate(mScratch, eHTMLTag_html, aChild);
- } else if (theTop != aChild) {
+ } else if (aParent != aChild) {
// Don't even bother if we're already inside a similar element...
- result = BackwardPropagate(mScratch, theTop, aChild);
+ result = BackwardPropagate(mScratch, aParent, aChild);
}
}
if (!result) {
return;
}
PRInt32 theLen = mScratch.Length();
--- a/parser/htmlparser/src/CNavDTD.h
+++ b/parser/htmlparser/src/CNavDTD.h
@@ -216,19 +216,20 @@ private:
PRBool BackwardPropagate(nsString& aSequence,
eHTMLTags aParent,
eHTMLTags aChild) const;
/**
* Attempt forward and/or backward propagation for the given child within
* the current context vector stack. And actually open the required tags.
*
+ * @param aParent The tag we're trying to open this element inside of.
* @param aChild Type of child to be propagated.
*/
- void CreateContextStackFor(eHTMLTags aChild);
+ void CreateContextStackFor(eHTMLTags aParent, eHTMLTags aChild);
/**
* Ask if a given container is open anywhere on its stack
*
* @param id of container you want to test for
* @return TRUE if the given container type is open -- otherwise FALSE
*/
PRBool HasOpenContainer(eHTMLTags aContainer) const;
new file mode 100644
--- /dev/null
+++ b/parser/htmlparser/tests/crashtests/423373-1.html
@@ -0,0 +1,1 @@
+<body><asdf><legend>
new file mode 100644
--- /dev/null
+++ b/parser/htmlparser/tests/crashtests/crashtests.list
@@ -0,0 +1,1 @@
+load 423373-1.html
--- a/testing/crashtest/crashtests.list
+++ b/testing/crashtest/crashtests.list
@@ -38,13 +38,15 @@ include ../../layout/svg/crashtests/cras
include ../../layout/tables/crashtests/crashtests.list
include ../../layout/xul/base/src/crashtests/crashtests.list
include ../../layout/xul/base/src/grid/crashtests/crashtests.list
include ../../layout/xul/base/src/tree/src/crashtests/crashtests.list
include ../../gfx/src/thebes/crashtests/crashtests.list
include ../../gfx/thebes/crashtests/crashtests.list
+include ../../parser/htmlparser/tests/crashtests/crashtests.list
+
include ../../security/manager/ssl/crashtests/crashtests.list
include ../../view/crashtests/crashtests.list
include ../../widget/src/cocoa/crashtests/crashtests.list