Changeset 143673 in webkit


Ignore:
Timestamp:
Feb 21, 2013 5:27:56 PM (11 years ago)
Author:
eric@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143670 r143673  
     12013-02-21  Eric Seidel  <eric@webkit.org>
     2
     3        tables/mozilla/bugs/bug8950.html fails with threaded parser due to attribute duplication
     4        https://bugs.webkit.org/show_bug.cgi?id=110532
     5
     6        Reviewed by Adam Barth.
     7
     8        This is a very basic failure which we should have caught earlier with the html5lib parser
     9        tests, except those use document.write and thus avoid the threaded parser.
     10
     11        AtomicHTMLToken expects its attributes to be unique.  We were not doing that for the
     12        CompactHTMLToken path, and this ancient mozilla table test caught that.
     13
     14        Fixes tables/mozilla/bugs/bug8950.html.
     15
     16        * html/parser/AtomicHTMLToken.h:
     17        (WebCore::AtomicHTMLToken::AtomicHTMLToken):
     18        (WebCore::AtomicHTMLToken::initializeAttributes):
     19
    1202013-02-21  Adam Barth  <abarth@webkit.org>
    221
  • trunk/Source/WebCore/html/parser/AtomicHTMLToken.h

    r143415 r143673  
    202202        case HTMLToken::StartTag:
    203203            m_attributes.reserveInitialCapacity(token.attributes().size());
    204             for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it)
    205                 m_attributes.append(Attribute(QualifiedName(nullAtom, it->name, nullAtom), it->value));
     204            for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it) {
     205                QualifiedName name(nullAtom, it->name, nullAtom);
     206                // FIXME: This is N^2 for the number of attributes.
     207                if (!findAttributeInVector(m_attributes, name))
     208                    m_attributes.append(Attribute(name, it->value));
     209            }
    206210            // Fall through!
    207211        case HTMLToken::EndTag:
     
    301305        AtomicString value(attribute.value);
    302306        const QualifiedName& name = nameForAttribute(attribute);
     307        // FIXME: This is N^2 for the number of attributes.
    303308        if (!findAttributeInVector(m_attributes, name))
    304309            m_attributes.append(Attribute(name, value));
Note: See TracChangeset for help on using the changeset viewer.