[HTMLTemplateElement] processTemplateEndTag() needs to check for template in html...
authorrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Mar 2013 01:29:38 +0000 (01:29 +0000)
committerrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Mar 2013 01:29:38 +0000 (01:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111880

Reviewed by Eric Seidel.

Source/WebCore:

Currently, </template> handling exits with an error if there is not a template tag "in scope"
which will be true if there is a table (for instance) below a template. This makes it so that
the search (correctly) examines the entire element stack.

Tests added to html5lib testing library.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processTemplateEndTag):

LayoutTests:

* html5lib/resources/template.dat:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145293 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/html5lib/resources/template.dat
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLTreeBuilder.cpp

index a8cdb80..f6a6736 100644 (file)
@@ -1,3 +1,12 @@
+2013-03-08  Rafael Weinstein  <rafaelw@chromium.org>
+
+        [HTMLTemplateElement] processTemplateEndTag() needs to check for template in html scope
+        https://bugs.webkit.org/show_bug.cgi?id=111880
+
+        Reviewed by Eric Seidel.
+
+        * html5lib/resources/template.dat:
+
 2013-03-08  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add a failing test expectation per bug 111901.
index 7f9bf59..691d5e0 100644 (file)
 |             <style>
 |               "var i"
 |   <body>
+
+#data
+<template><table></template><body><span>Foo
+#errors
+#document
+| <html>
+|   <head>
+|     <template>
+|       content
+|         <table>
+|   <body>
+|     <span>
+|       "Foo"
+
+#data
+<template><td></template><body><span>Foo
+#errors
+#document
+| <html>
+|   <head>
+|     <template>
+|       content
+|         <td>
+|   <body>
+|     <span>
+|       "Foo"
+
+#data
+<template><object></template><body><span>Foo
+#errors
+#document
+| <html>
+|   <head>
+|     <template>
+|       content
+|         <object>
+|   <body>
+|     <span>
+|       "Foo"
index 5bda1a8..c3fad01 100644 (file)
@@ -1,3 +1,19 @@
+2013-03-08  Rafael Weinstein  <rafaelw@chromium.org>
+
+        [HTMLTemplateElement] processTemplateEndTag() needs to check for template in html scope
+        https://bugs.webkit.org/show_bug.cgi?id=111880
+
+        Reviewed by Eric Seidel.
+
+        Currently, </template> handling exits with an error if there is not a template tag "in scope"
+        which will be true if there is a table (for instance) below a template. This makes it so that
+        the search (correctly) examines the entire element stack.
+
+        Tests added to html5lib testing library.
+
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processTemplateEndTag):
+
 2013-03-08  Eric Seidel  <eric@webkit.org>
 
         BackgroundHTMLParser should be able to atomize well-known strings
index f0072d5..b1d0293 100644 (file)
@@ -958,7 +958,8 @@ void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken* token)
 {
-    if (!m_tree.openElements()->inScope(token->name())) {
+    if (!m_tree.openElements()->hasTemplateInHTMLScope()) {
+        ASSERT(m_templateInsertionModes.isEmpty());
         parseError(token);
         return;
     }