Bug 1005580 - Fix "after after frameset" insertion mode in HTML parser for handling characters. r=hsivonen

This commit is contained in:
William Chen 2014-05-06 13:29:31 -07:00
parent df6a5c2c11
commit 507c29aa81
3 changed files with 29 additions and 10 deletions

View File

@ -1281,7 +1281,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
if (start < i) {
accumulateCharacters(buf, start, i
- start);
start = i;
// start index is adjusted below.
}
/*
* Parse error.
@ -1296,7 +1296,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
if (start < i) {
accumulateCharacters(buf, start, i
- start);
start = i;
// start index is adjusted below.
}
/*
* Parse error.
@ -1320,13 +1320,19 @@ public abstract class TreeBuilder<T> implements TokenHandler,
i--;
continue;
case AFTER_AFTER_FRAMESET:
if (start < i) {
accumulateCharacters(buf, start, i
- start);
// start index is adjusted below.
}
/*
* Parse error.
*/
errNonSpaceInTrailer();
/*
* Switch back to the main mode and
* reprocess the token.
* Ignore the token.
*/
mode = IN_FRAMESET;
i--;
start = i + 1;
continue;
}
}

View File

@ -395,7 +395,6 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt
case NS_HTML5TREE_BUILDER_IN_FRAMESET: {
if (start < i) {
accumulateCharacters(buf, start, i - start);
start = i;
}
errNonSpaceInFrameset();
start = i + 1;
@ -404,7 +403,6 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt
case NS_HTML5TREE_BUILDER_AFTER_FRAMESET: {
if (start < i) {
accumulateCharacters(buf, start, i - start);
start = i;
}
errNonSpaceAfterFrameset();
start = i + 1;
@ -417,9 +415,11 @@ nsHtml5TreeBuilder::characters(const char16_t* buf, int32_t start, int32_t lengt
continue;
}
case NS_HTML5TREE_BUILDER_AFTER_AFTER_FRAMESET: {
if (start < i) {
accumulateCharacters(buf, start, i - start);
}
errNonSpaceInTrailer();
mode = NS_HTML5TREE_BUILDER_IN_FRAMESET;
i--;
start = i + 1;
continue;
}
}

View File

@ -396,3 +396,16 @@ Line 1 Col 19 Expected closing tag. Unexpected end of file.
| <html>
| <head>
| <frameset>
#data
<!DOCTYPE html><html><frameset></frameset></html>XXX</frameset>
#errors
52: Non-space character in page trailer.
52: Non-space character in page trailer.
52: Non-space character in page trailer.
63: Stray end tag “frameset”.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>