msxml3: replaceNode accepts IXMLDOMElement instead of IXMLDOMNode.

This commit is contained in:
Michael Karcher 2008-10-07 11:55:45 +02:00 committed by Alexandre Julliard
parent 6fe686f599
commit 27e9a98350
2 changed files with 16 additions and 2 deletions

View File

@ -613,6 +613,8 @@ static HRESULT WINAPI xmlnode_replaceChild(
xmlNode *old_child_ptr, *new_child_ptr;
xmlDocPtr leaving_doc;
xmlNode *my_ancestor;
IXMLDOMNode *realOldChild;
HRESULT hr;
TRACE("%p->(%p,%p,%p)\n",This,newChild,oldChild,outOldChild);
@ -624,7 +626,12 @@ static HRESULT WINAPI xmlnode_replaceChild(
if(outOldChild)
*outOldChild = NULL;
old_child_ptr = impl_from_IXMLDOMNode(oldChild)->node;
hr = IXMLDOMNode_QueryInterface(oldChild,&IID_IXMLDOMNode,(LPVOID*)&realOldChild);
if(FAILED(hr))
return hr;
old_child_ptr = impl_from_IXMLDOMNode(realOldChild)->node;
IXMLDOMNode_Release(realOldChild);
if(old_child_ptr->parent != This->node)
{
WARN("childNode %p is not a child of %p\n", oldChild, iface);

View File

@ -1842,7 +1842,7 @@ static void test_replaceChild(void)
BSTR str;
VARIANT_BOOL b;
IXMLDOMDocument *doc;
IXMLDOMElement *element;
IXMLDOMElement *element, *ba_element;
IXMLDOMNode *fo_node, *ba_node, *lc_node, *removed_node, *temp_node;
IXMLDOMNodeList *root_list, *fo_list;
IUnknown * unk1, *unk2;
@ -1925,6 +1925,13 @@ static void test_replaceChild(void)
r = IXMLDOMNode_get_childNodes( fo_node, &fo_list );
ok( r == S_OK, "ret %08x\n", r );
/* MS quirk: replaceChild also accepts elements instead of nodes */
r = IXMLDOMNode_QueryInterface( ba_node, &IID_IXMLDOMElement, (void**)&ba_element);
ok( r == S_OK, "ret %08x\n", r );
r = IXMLDOMElement_replaceChild( element, ba_node, (IXMLDOMNode*)ba_element, &removed_node );
ok( r == S_OK, "ret %08x\n", r );
r = IXMLDOMNodeList_get_length( fo_list, &len);
ok( r == S_OK, "ret %08x\n", r );
ok( len == 0, "len %ld\n", len);