Commit 75606f35 authored by Michael Karcher's avatar Michael Karcher Committed by Alexandre Julliard

msxml3: removeChild can only delete direct children.

parent d1c8083b
...@@ -619,7 +619,7 @@ static HRESULT WINAPI xmlnode_removeChild( ...@@ -619,7 +619,7 @@ static HRESULT WINAPI xmlnode_removeChild(
IXMLDOMNode** oldChild) IXMLDOMNode** oldChild)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface ); xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlNode *ancestor, *child_node_ptr; xmlNode *child_node_ptr;
HRESULT hr; HRESULT hr;
IXMLDOMNode *child; IXMLDOMNode *child;
...@@ -634,14 +634,8 @@ static HRESULT WINAPI xmlnode_removeChild( ...@@ -634,14 +634,8 @@ static HRESULT WINAPI xmlnode_removeChild(
if(FAILED(hr)) if(FAILED(hr))
return hr; return hr;
child_node_ptr = ancestor = impl_from_IXMLDOMNode(child)->node; child_node_ptr = impl_from_IXMLDOMNode(child)->node;
while(ancestor->parent) if(child_node_ptr->parent != This->node)
{
if(ancestor->parent == This->node)
break;
ancestor = ancestor->parent;
}
if(!ancestor->parent)
{ {
WARN("childNode %p is not a child of %p\n", childNode, iface); WARN("childNode %p is not a child of %p\n", childNode, iface);
IXMLDOMNode_Release(child); IXMLDOMNode_Release(child);
......
...@@ -1797,8 +1797,8 @@ static void test_removeChild(void) ...@@ -1797,8 +1797,8 @@ static void test_removeChild(void)
/* ba_node is a descendant of element, but not a direct child. */ /* ba_node is a descendant of element, but not a direct child. */
removed_node = (void*)0xdeadbeef; removed_node = (void*)0xdeadbeef;
r = IXMLDOMElement_removeChild( element, ba_node, &removed_node ); r = IXMLDOMElement_removeChild( element, ba_node, &removed_node );
todo_wine ok( r == E_INVALIDARG, "ret %08x\n", r ); ok( r == E_INVALIDARG, "ret %08x\n", r );
todo_wine ok( removed_node == NULL, "%p\n", removed_node ); ok( removed_node == NULL, "%p\n", removed_node );
r = IXMLDOMElement_removeChild( element, fo_node, &removed_node ); r = IXMLDOMElement_removeChild( element, fo_node, &removed_node );
ok( r == S_OK, "ret %08x\n", r); ok( r == S_OK, "ret %08x\n", r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment