<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200108] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200108">200108</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-26 15:07:27 -0700 (Tue, 26 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshtml5libgeneratedruntemplatedataexpectedtxt">trunk/LayoutTests/html5lib/generated/run-template-data-expected.txt</a></li>
<li><a href="#trunkLayoutTestshtml5libgeneratedruntemplatewriteexpectedtxt">trunk/LayoutTests/html5lib/generated/run-template-write-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsscripting1thetemplateelementtemplateelementtemplateasadescendantexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsscripting1thetemplateelementtemplateelementtemplatedescendantframesetexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesetexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTreeBuildercpp">trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLTemplateElementparsingtemplatewithframesetexpectedtxt">trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLTemplateElementparsingtemplatewithframesethtml">trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/ChangeLog        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-04-26 Ryosuke Niwa <rniwa@webkit.org>
+
+ ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder::finished
+ https://bugs.webkit.org/show_bug.cgi?id=143519
+
+ Reviewed by Darin Adler.
+
+ 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:
+
</ins><span class="cx"> 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
</span><span class="cx">
</span><span class="cx"> calling super() a second time in a constructor should throw
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLTemplateElementparsingtemplatewithframesetexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt (0 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This tests parsing a template element with a frameset element. WebKit should not hit an assertion.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLTemplateElementparsingtemplatewithframesethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html (0 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLTemplateElement/parsing-template-with-frameset.html        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<!DOCTYPE html>
+<ins></ins>
+<template>
+ <frameset></frameset>
+</template>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+document.write('This tests parsing a template element with a frameset element. WebKit should not hit an assertion.');
+
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestshtml5libgeneratedruntemplatedataexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/html5lib/generated/run-template-data-expected.txt (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/html5lib/generated/run-template-data-expected.txt        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/html5lib/generated/run-template-data-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,76 +1 @@
</span><del>-../resources/template.dat:
-40
-41
-68
-94
-
-Test 40 of 108 in ../resources/template.dat failed. Input:
-<frameset><template><frame></frame></template></frameset>
-Got:
-| <html>
-| <head>
-| <frameset>
-| <template>
-| content
-| <frame>
-Expected:
-| <html>
-| <head>
-| <frameset>
-| <frame>
-
-Test 41 of 108 in ../resources/template.dat failed. Input:
-<template><frame></frame></frameset><frame></frame></template>
-Got:
-| <html>
-| <head>
-| <template>
-| content
-| <frame>
-| <frame>
-| <body>
-Expected:
-| <html>
-| <head>
-| <template>
-| content
-| <body>
-
-Test 68 of 108 in ../resources/template.dat failed. Input:
-<html a=b><template><frame></frame><html b=c><frame></frame></template>
-Got:
-| <html>
-| a="b"
-| <head>
-| <template>
-| content
-| <frame>
-| <frame>
-| <body>
-Expected:
-| <html>
-| a="b"
-| <head>
-| <template>
-| content
-| <body>
-
-Test 94 of 108 in ../resources/template.dat failed. Input:
-<template><template><frame>
-Got:
-| <html>
-| <head>
-| <template>
-| content
-| <template>
-| content
-| <frame>
-| <body>
-Expected:
-| <html>
-| <head>
-| <template>
-| content
-| <template>
-| content
-| <body>
</del><ins>+../resources/template.dat: PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshtml5libgeneratedruntemplatewriteexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/html5lib/generated/run-template-write-expected.txt (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/html5lib/generated/run-template-write-expected.txt        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/html5lib/generated/run-template-write-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,76 +1 @@
</span><del>-../resources/template.dat:
-40
-41
-68
-94
-
-Test 40 of 108 in ../resources/template.dat failed. Input:
-<frameset><template><frame></frame></template></frameset>
-Got:
-| <html>
-| <head>
-| <frameset>
-| <template>
-| content
-| <frame>
-Expected:
-| <html>
-| <head>
-| <frameset>
-| <frame>
-
-Test 41 of 108 in ../resources/template.dat failed. Input:
-<template><frame></frame></frameset><frame></frame></template>
-Got:
-| <html>
-| <head>
-| <template>
-| content
-| <frame>
-| <frame>
-| <body>
-Expected:
-| <html>
-| <head>
-| <template>
-| content
-| <body>
-
-Test 68 of 108 in ../resources/template.dat failed. Input:
-<html a=b><template><frame></frame><html b=c><frame></frame></template>
-Got:
-| <html>
-| a="b"
-| <head>
-| <template>
-| content
-| <frame>
-| <frame>
-| <body>
-Expected:
-| <html>
-| a="b"
-| <head>
-| <template>
-| content
-| <body>
-
-Test 94 of 108 in ../resources/template.dat failed. Input:
-<template><template><frame>
-Got:
-| <html>
-| <head>
-| <template>
-| content
-| <template>
-| content
-| <frame>
-| <body>
-Expected:
-| <html>
-| <head>
-| <template>
-| content
-| <template>
-| content
-| <body>
</del><ins>+../resources/template.dat: PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-04-26 Ryosuke Niwa <rniwa@webkit.org>
+
+ ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder::finished
+ https://bugs.webkit.org/show_bug.cgi?id=143519
+
+ Reviewed by Darin Adler.
+
+ 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:
+
</ins><span class="cx"> 2016-04-25 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Update template element tests
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsscripting1thetemplateelementtemplateelementtemplateasadescendantexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-as-a-descendant-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><span class="cx">
</span><span class="cx"> PASS Template element as a descendant of the BODY element. Template element is created by innerHTML
</span><span class="cx"> PASS Template element as a descendant of the HEAD element. Template element is created by innerHTML
</span><del>-PASS Template element as a descendant of the FRAMESET element. Template element is created by innerHTML
</del><ins>+FAIL Template element as a descendant of the FRAMESET element. Template element is created by innerHTML assert_not_equals: Template element should be a descendant of the FRAMESET element got disallowed value null
</ins><span class="cx"> PASS Template element as an indirect descendant of the BODY element. Template element is created by innerHTML
</span><span class="cx"> PASS Template element as an indirect descendant of the HEAD element. Template element is created by innerHTML
</span><del>-PASS Template element as an indirect descendant of the FRAMESET element. Template element is created by innerHTML
</del><ins>+FAIL Template element as an indirect descendant of the FRAMESET element. Template element is created by innerHTML assert_not_equals: Template element should be a descendant of the FRAMESET element got disallowed value null
</ins><span class="cx"> PASS Template element as a descendant of the BODY element. Template element is appended by appendChild()
</span><span class="cx"> PASS Template element as a descendant of the HEAD element. Template element is appended by appendChild()
</span><span class="cx"> PASS Template element as a descendant of the FRAMESET element. Template element is appended by appendChild()
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsscripting1thetemplateelementtemplateelementtemplatedescendantframesetexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-template-element/template-element/template-descendant-frameset-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,7 +1,5 @@
</span><span class="cx">
</span><del>-FAIL Template element as a descendant of the frameset element. Test loading from a file assert_equals: Template element should not be a descendant of the frameset element expected null but got Element node <template>
- <div>Hello, template</div>
- </templ...
-FAIL Template element as a descendant of the frameset element. Test template element is assigned to frameset's innerHTML) assert_equals: Template element should not be a descendant of the frameset element expected null but got Element node <template>some text</template>
-FAIL Template element as a descendant of the frameset element. Test template element appended to frameset by appendChild() assert_equals: Template element should be a descendant of the frameset element expected 1 but got 2
</del><ins>+PASS Template element as a descendant of the frameset element. Test loading from a file
+PASS Template element as a descendant of the frameset element. Test template element is assigned to frameset's innerHTML)
+PASS Template element as a descendant of the frameset element. Test template element appended to frameset by appendChild()
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsyntaxparsingtemplateadditionstotheinframesetinsertionmodeendtagframesetexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/template/additions-to-the-in-frameset-insertion-mode/end-tag-frameset-expected.txt        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL <template> tag should be ignored in "in frameset" insertion mode assert_equals: Wrong number of frameset children elements expected 0 but got 1
</del><ins>+PASS <template> tag should be ignored in "in frameset" insertion mode
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/Source/WebCore/ChangeLog        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-04-26 Ryosuke Niwa <rniwa@webkit.org>
+
+ ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder::finished
+ https://bugs.webkit.org/show_bug.cgi?id=143519
+
+ Reviewed by Darin Adler.
+
+ 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
+
</ins><span class="cx"> 2016-04-26 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> WebCore on Mac ignores the user's preferred region (country) while getting the language
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTreeBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (200107 => 200108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2016-04-26 21:47:20 UTC (rev 200107)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2016-04-26 22:07:27 UTC (rev 200108)
</span><span class="lines">@@ -896,6 +896,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (token.name() == templateTag) {
</span><ins>+ m_framesetOk = false;
</ins><span class="cx"> processTemplateStartTag(token);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -1288,10 +1289,6 @@
</span><span class="cx"> processStartTagForInHead(token);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- if (token.name() == templateTag) {
- processTemplateStartTag(token);
- return;
- }
</del><span class="cx"> parseError(token);
</span><span class="cx"> break;
</span><span class="cx"> case InsertionMode::AfterFrameset:
</span><span class="lines">@@ -1393,9 +1390,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> InsertionMode insertionMode = InsertionMode::TemplateContents;
</span><del>- if (token.name() == frameTag)
- insertionMode = InsertionMode::InFrameset;
- else if (token.name() == colTag)
</del><ins>+ if (token.name() == colTag)
</ins><span class="cx"> insertionMode = InsertionMode::InColumnGroup;
</span><span class="cx"> else if (isCaptionColOrColgroupTag(token.name()) || isTableBodyContextTag(token.name()))
</span><span class="cx"> insertionMode = InsertionMode::InTable;
</span><span class="lines">@@ -2137,10 +2132,6 @@
</span><span class="cx"> m_insertionMode = InsertionMode::AfterFrameset;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- if (token.name() == templateTag) {
- processTemplateEndTag(token);
- return;
- }
</del><span class="cx"> break;
</span><span class="cx"> case InsertionMode::AfterFrameset:
</span><span class="cx"> if (token.name() == htmlTag) {
</span><span class="lines">@@ -2679,6 +2670,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> if (token.name() == templateTag) {
</span><ins>+ m_framesetOk = false;
</ins><span class="cx"> processTemplateStartTag(token);
</span><span class="cx"> return true;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>