2009-02-02 Darin Adler <darin@apple.com>
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2009 20:11:08 +0000 (20:11 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2009 20:11:08 +0000 (20:11 +0000)
        Reviewed by Niko Zimmermann.

        Bug 23686: REGRESSION (r40475): Failure in fast/xpath/4XPath/Core/test_core_functions.html
        https://bugs.webkit.org/show_bug.cgi?id=23686
        rdar://problem/6547971

        Also fix other XPath tests that are crashing.

        * xml/XPathFunctions.cpp:
        (WebCore::XPath::FunLang::evaluate): Fix order of arguments when creating QualifiedName.
        * xml/XPathStep.cpp:
        (WebCore::XPath::Step::nodesInAxis): Use createAttrIfNeeded() rather than attr() since we
        need to make Attr nodes here. Yuck!

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

WebCore/ChangeLog
WebCore/xml/XPathFunctions.cpp
WebCore/xml/XPathStep.cpp

index 00ad2e7..7968b8a 100644 (file)
@@ -1,3 +1,19 @@
+2009-02-02  Darin Adler  <darin@apple.com>
+
+        Reviewed by Niko Zimmermann.
+
+        Bug 23686: REGRESSION (r40475): Failure in fast/xpath/4XPath/Core/test_core_functions.html
+        https://bugs.webkit.org/show_bug.cgi?id=23686
+        rdar://problem/6547971
+
+        Also fix other XPath tests that are crashing.
+
+        * xml/XPathFunctions.cpp:
+        (WebCore::XPath::FunLang::evaluate): Fix order of arguments when creating QualifiedName.
+        * xml/XPathStep.cpp:
+        (WebCore::XPath::Step::nodesInAxis): Use createAttrIfNeeded() rather than attr() since we
+        need to make Attr nodes here. Yuck!
+
 2009-02-02  Yichao Yin  <yichao.yin@torchmobile.com.cn>
 
         Reviewed by Niko Zimmermann.
index 9008d7c..93bffa4 100644 (file)
@@ -539,7 +539,7 @@ Value FunLang::evaluate() const
     while (node) {
         NamedAttrMap* attrs = node->attributes();
         if (attrs)
-            languageAttribute = attrs->getAttributeItem(QualifiedName(nullAtom, XMLNames::xmlNamespaceURI, "lang"));
+            languageAttribute = attrs->getAttributeItem(QualifiedName(nullAtom, "lang", XMLNames::xmlNamespaceURI));
         if (languageAttribute)
             break;
         node = node->parentNode();
index 9e3a197..ae8d9c4 100644 (file)
@@ -191,10 +191,10 @@ void Step::nodesInAxis(Node* context, NodeSet& nodes) const
             if (!attrs)
                 return;
 
-            for (unsigned long i = 0; i < attrs->length(); ++i) {
-                Attribute* attribute = attrs->attributeItem(i);
-                if (nodeMatches(attribute->attr()))
-                    nodes.append(attribute->attr());
+            for (unsigned i = 0; i < attrs->length(); ++i) {
+                RefPtr<Attr> attr = attrs->attributeItem(i)->createAttrIfNeeded(static_cast<Element*>(context));
+                if (nodeMatches(attr.get()))
+                    nodes.append(attr.release());
             }
             return;
         }