Bug 596180 - Limit the number of iterations in the adoption agency algorithm. rs=jonas, a=blocking2.0-betaN.

--HG--
extra : rebase_source : 3fd176ad6b1bddee3c11b9f9002e21c64a5c1927
This commit is contained in:
Henri Sivonen 2010-09-15 11:37:55 +03:00
Родитель f148f1431c
Коммит 98fc3b277e
3 изменённых файлов: 7 добавлений и 4 удалений

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

@ -336,6 +336,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
private static final int NOT_FOUND_ON_STACK = Integer.MAX_VALUE;
private static final int AAA_MAX_ITERATIONS = 10;
// [NOCPP[
private static final @Local String HTML_LOCAL = "html";
@ -4334,7 +4336,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
private void adoptionAgencyEndTag(@Local String name) throws SAXException {
// If you crash around here, perhaps some stack node variable claimed to
// be a weak ref isn't.
for (;;) {
for (int i = 0; i < AAA_MAX_ITERATIONS; ++i) {
int formattingEltListPos = listPtr;
while (formattingEltListPos > -1) {
StackNode<T> listNode = listOfActiveFormattingElements[formattingEltListPos]; // weak
@ -4410,7 +4412,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
int bookmark = formattingEltListPos;
int nodePos = furthestBlockPos;
StackNode<T> lastNode = furthestBlock; // weak ref
for (;;) {
for (int j = 0; j < AAA_MAX_ITERATIONS; ++j) {
nodePos--;
StackNode<T> node = stack[nodePos]; // weak ref
int nodeListPos = findInListOfActiveFormattingElements(node);

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

@ -3180,7 +3180,7 @@ nsHtml5TreeBuilder::removeFromListOfActiveFormattingElements(PRInt32 pos)
void
nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
{
for (; ; ) {
for (PRInt32 i = 0; i < NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS; ++i) {
PRInt32 formattingEltListPos = listPtr;
while (formattingEltListPos > -1) {
nsHtml5StackNode* listNode = listOfActiveFormattingElements[formattingEltListPos];
@ -3238,7 +3238,7 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
PRInt32 bookmark = formattingEltListPos;
PRInt32 nodePos = furthestBlockPos;
nsHtml5StackNode* lastNode = furthestBlock;
for (; ; ) {
for (PRInt32 j = 0; j < NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS; ++j) {
nodePos--;
nsHtml5StackNode* node = stack[nodePos];
PRInt32 nodeListPos = findInListOfActiveFormattingElements(node);

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

@ -350,6 +350,7 @@ jArray<const char*,PRInt32> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = nsnull;
#define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
#define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
#define NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS 10
#endif