diff --git a/parser/html/javasrc/TreeBuilder.java b/parser/html/javasrc/TreeBuilder.java index 06039af91b5a..c9385b801668 100644 --- a/parser/html/javasrc/TreeBuilder.java +++ b/parser/html/javasrc/TreeBuilder.java @@ -1281,7 +1281,7 @@ public abstract class TreeBuilder 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 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 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; } } diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index 573bd14091cd..390ed92e2370 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -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; } } diff --git a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat index 182af997e01d..867bbeecd50c 100644 --- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat +++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests26.dat @@ -396,3 +396,16 @@ Line 1 Col 19 Expected closing tag. Unexpected end of file. | | | + +#data +XXX +#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 +| +| +| +|