ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Apr 2016 22:07:27 +0000 (22:07 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Apr 2016 22:07:27 +0000 (22:07 +0000)
commit258984f5e178cd5a4649a4f9faa75f7f7fb80b9e
tree67a564c30e3f051a7798fd15a5759cd58df5f18b
parentd07f33f4430ec8a5d0bece53cba209dbc2554158
ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder::finished
https://bugs.webkit.org/show_bug.cgi?id=143519

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaselined the tests.

* web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt:
* web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt:
* web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt:

Source/WebCore:

The assertion failure was caused by our parser inconsistently following the spec. Fixed it by making our HTML parser
match the latest HTML5 specification. See inline comments below.

Tests: fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html
       html5lib/generated/run-template-data.html
       html5lib/generated/run-template-write.html
       imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant.html
       imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset.html
       imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset.html

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody): When parsing a template element for 'in body' insertion mode,
we process the token using the rules for 'in head' insertion mode, which sets the frameset-ok flag to "not ok".
In addition, 'in template' insertion mode should not special case a start tag whose tag name is "frame". Instead,
fallback to using 'in body' insertion mode.
https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
(WebCore::HTMLTreeBuilder::processStartTag): 'in frameset' insertion mode should not special case a start tag whose
tag name is "template": https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inframeset
(WebCore::HTMLTreeBuilder::processEndTag): Ditto for an end tag whose name is "template".
(WebCore::HTMLTreeBuilder::processStartTagForInHead): When parsing a template element in 'in head' inserting mode,
we set the frameset-ok flag to "not ok": https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead

LayoutTests:

Rebaselined the html5lib tests (now passes all the test cases!) and added a regression test for an assertion.

* fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt: Added.
* fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html: Added.
* html5lib/generated/run-template-data-expected.txt:
* html5lib/generated/run-template-write-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html [new file with mode: 0644]
LayoutTests/html5lib/generated/run-template-data-expected.txt
LayoutTests/html5lib/generated/run-template-write-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLTreeBuilder.cpp