зеркало из https://github.com/mozilla/gecko-dev.git
bug 288460: Make ScanDocStructure() more strict about tags that break the ShouldVerifyHeirarchy check and mark all children of the tag as malformed so that its children don't think they're well formed. r=rbs sr=bzbarsky a=shaver
This commit is contained in:
Родитель
687a20b886
Коммит
550985b369
|
@ -426,15 +426,23 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk)
|
||||||
PRInt32 earlyPos = FindLastIndexOfTag(theTag, theStack);
|
PRInt32 earlyPos = FindLastIndexOfTag(theTag, theStack);
|
||||||
if (earlyPos != kNotFound) {
|
if (earlyPos != kNotFound) {
|
||||||
// Uh-oh, we've found a tag that is not allowed to nest at
|
// Uh-oh, we've found a tag that is not allowed to nest at
|
||||||
// all. Mark the previous one as malformed to increase our
|
// all. Mark the previous one and all of its children as
|
||||||
// chances of doing RS handling on it. We want to do this
|
// malformed to increase our chances of doing RS handling
|
||||||
// for cases such as: <a><div><a></a></div></a>.
|
// on all of them. We want to do this for cases such as:
|
||||||
|
// <a><div><a></a></div></a>.
|
||||||
|
// Note that we have to iterate through all of the chilren
|
||||||
|
// of the original malformed tag to protect against:
|
||||||
|
// <a><font><div><a></a></div></font></a>, so that the <font>
|
||||||
|
// is allowed to contain the <div>.
|
||||||
// XXX What about <a><span><a>, where the second <a> closes
|
// XXX What about <a><span><a>, where the second <a> closes
|
||||||
// the <span>?
|
// the <span>?
|
||||||
CHTMLToken *theMalformedToken =
|
nsDequeIterator it(theStack, earlyPos), end(theStack.End());
|
||||||
NS_STATIC_CAST(CHTMLToken*, theStack.ObjectAt(earlyPos));
|
while (it < end) {
|
||||||
|
CHTMLToken *theMalformedToken =
|
||||||
|
NS_STATIC_CAST(CHTMLToken*, it++);
|
||||||
|
|
||||||
theMalformedToken->SetContainerInfo(eMalformed);
|
theMalformedToken->SetContainerInfo(eMalformed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ void XXXNeverCalled()
|
||||||
a.Free(0, 0);
|
a.Free(0, 0);
|
||||||
nsIThread::GetCurrent(nsnull);
|
nsIThread::GetCurrent(nsnull);
|
||||||
nsDeque(nsnull);
|
nsDeque(nsnull);
|
||||||
|
nsDequeIterator(nsDeque());
|
||||||
nsTraceRefcnt::LogAddCOMPtr(nsnull, nsnull);
|
nsTraceRefcnt::LogAddCOMPtr(nsnull, nsnull);
|
||||||
nsTraceRefcntImpl::DumpStatistics();
|
nsTraceRefcntImpl::DumpStatistics();
|
||||||
NS_NewEmptyEnumerator(nsnull);
|
NS_NewEmptyEnumerator(nsnull);
|
||||||
|
|
|
@ -245,7 +245,7 @@ private:
|
||||||
* Here comes the nsDequeIterator class...
|
* Here comes the nsDequeIterator class...
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
class nsDequeIterator {
|
class NS_COM nsDequeIterator {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* DequeIterator is an object that knows how to iterate
|
* DequeIterator is an object that knows how to iterate
|
||||||
|
|
Загрузка…
Ссылка в новой задаче