Changeset 83699 in webkit


Ignore:
Timestamp:
Apr 12, 2011 10:07:59 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-12 Sergey Glazunov <serg.glazunov@gmail.com>

Reviewed by Dimitri Glazkov.

Element::setAttribute should check the namespace of an id attribute
https://bugs.webkit.org/show_bug.cgi?id=58359

  • fast/dom/id-attribute-with-namespace-crash-expected.txt: Added.
  • fast/dom/id-attribute-with-namespace-crash.html: Added.

2011-04-12 Sergey Glazunov <serg.glazunov@gmail.com>

Reviewed by Dimitri Glazkov.

Element::setAttribute should check the namespace of an id attribute
https://bugs.webkit.org/show_bug.cgi?id=58359

Test: fast/dom/id-attribute-with-namespace-crash.html

  • dom/Element.cpp: (WebCore::Element::setAttribute):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83696 r83699  
     12011-04-12  Sergey Glazunov  <serg.glazunov@gmail.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Element::setAttribute should check the namespace of an id attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=58359
     7
     8        * fast/dom/id-attribute-with-namespace-crash-expected.txt: Added.
     9        * fast/dom/id-attribute-with-namespace-crash.html: Added.
     10
    1112011-04-12  Andrey Kosyakov  <caseq@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r83698 r83699  
     12011-04-12  Sergey Glazunov  <serg.glazunov@gmail.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Element::setAttribute should check the namespace of an id attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=58359
     7
     8        Test: fast/dom/id-attribute-with-namespace-crash.html
     9
     10        * dom/Element.cpp:
     11        (WebCore::Element::setAttribute):
     12
    1132011-04-12  Mike Lawther  <mikelawther@chromium.org>
    214
  • trunk/Source/WebCore/dom/Element.cpp

    r83256 r83699  
    658658
    659659    const AtomicString& localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    660 
     660    QualifiedName attributeName(nullAtom, localName, nullAtom);
     661   
    661662    // Allocate attribute map if necessary.
    662663    Attribute* old = attributes(false)->getAttributeItem(localName, false);
     
    664665    document()->incDOMTreeVersion();
    665666
    666     // FIXME: This check is probably not correct for the case where the document has an id attribute
    667     // with a non-null namespace, because it will return true if the local name happens to match
    668     // but the namespace does not.
    669     if (localName == document()->idAttributeName().localName())
     667    if (isIdAttributeName(old ? old->name() : attributeName))
    670668        updateId(old ? old->value() : nullAtom, value);
    671669
     
    673671        m_attributeMap->removeAttribute(old->name());
    674672    else if (!old && !value.isNull())
    675         m_attributeMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value));
     673        m_attributeMap->addAttribute(createAttribute(attributeName, value));
    676674    else if (old && !value.isNull()) {
    677675        if (Attr* attrNode = old->attr())
Note: See TracChangeset for help on using the changeset viewer.