Title: [143673] trunk/Source/WebCore
Revision
143673
Author
e...@webkit.org
Date
2013-02-21 17:27:56 -0800 (Thu, 21 Feb 2013)

Log Message

tables/mozilla/bugs/bug8950.html fails with threaded parser due to attribute duplication
https://bugs.webkit.org/show_bug.cgi?id=110532

Reviewed by Adam Barth.

This is a very basic failure which we should have caught earlier with the html5lib parser
tests, except those use document.write and thus avoid the threaded parser.

AtomicHTMLToken expects its attributes to be unique.  We were not doing that for the
CompactHTMLToken path, and this ancient mozilla table test caught that.

Fixes tables/mozilla/bugs/bug8950.html.

* html/parser/AtomicHTMLToken.h:
(WebCore::AtomicHTMLToken::AtomicHTMLToken):
(WebCore::AtomicHTMLToken::initializeAttributes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143672 => 143673)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 01:26:22 UTC (rev 143672)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 01:27:56 UTC (rev 143673)
@@ -1,3 +1,22 @@
+2013-02-21  Eric Seidel  <e...@webkit.org>
+
+        tables/mozilla/bugs/bug8950.html fails with threaded parser due to attribute duplication
+        https://bugs.webkit.org/show_bug.cgi?id=110532
+
+        Reviewed by Adam Barth.
+
+        This is a very basic failure which we should have caught earlier with the html5lib parser
+        tests, except those use document.write and thus avoid the threaded parser.
+
+        AtomicHTMLToken expects its attributes to be unique.  We were not doing that for the
+        CompactHTMLToken path, and this ancient mozilla table test caught that.
+
+        Fixes tables/mozilla/bugs/bug8950.html.
+
+        * html/parser/AtomicHTMLToken.h:
+        (WebCore::AtomicHTMLToken::AtomicHTMLToken):
+        (WebCore::AtomicHTMLToken::initializeAttributes):
+
 2013-02-21  Adam Barth  <aba...@webkit.org>
 
         Threaded HTML Parser fails fast/dom/Document/readystate.html

Modified: trunk/Source/WebCore/html/parser/AtomicHTMLToken.h (143672 => 143673)


--- trunk/Source/WebCore/html/parser/AtomicHTMLToken.h	2013-02-22 01:26:22 UTC (rev 143672)
+++ trunk/Source/WebCore/html/parser/AtomicHTMLToken.h	2013-02-22 01:27:56 UTC (rev 143673)
@@ -201,8 +201,12 @@
             break;
         case HTMLToken::StartTag:
             m_attributes.reserveInitialCapacity(token.attributes().size());
-            for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it)
-                m_attributes.append(Attribute(QualifiedName(nullAtom, it->name, nullAtom), it->value));
+            for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it) {
+                QualifiedName name(nullAtom, it->name, nullAtom);
+                // FIXME: This is N^2 for the number of attributes.
+                if (!findAttributeInVector(m_attributes, name))
+                    m_attributes.append(Attribute(name, it->value));
+            }
             // Fall through!
         case HTMLToken::EndTag:
             m_selfClosing = token.selfClosing();
@@ -300,6 +304,7 @@
 
         AtomicString value(attribute.value);
         const QualifiedName& name = nameForAttribute(attribute);
+        // FIXME: This is N^2 for the number of attributes.
         if (!findAttributeInVector(m_attributes, name))
             m_attributes.append(Attribute(name, value));
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to