From 431e77bec4a022dbed0dc2ead80d20250193fdaf Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 3 Mar 2013 21:38:27 +0400 Subject: [PATCH] msxml3: CDATA nodes can't have children. --- dlls/msxml3/cdata.c | 20 ++++++++++---------- dlls/msxml3/tests/domdoc.c | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c index 6b3c06529f7..7fd4a37eb5f 100644 --- a/dlls/msxml3/cdata.c +++ b/dlls/msxml3/cdata.c @@ -290,10 +290,9 @@ static HRESULT WINAPI domcdata_insertBefore( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - - FIXME("(%p)->(%p %s %p) needs test\n", This, newNode, debugstr_variant(&refChild), outOldNode); - - return node_insert_before(&This->node, newNode, &refChild, outOldNode); + TRACE("(%p)->(%p %s %p)\n", This, newNode, debugstr_variant(&refChild), outOldNode); + if (outOldNode) *outOldNode = NULL; + return E_FAIL; } static HRESULT WINAPI domcdata_replaceChild( @@ -303,10 +302,9 @@ static HRESULT WINAPI domcdata_replaceChild( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - - FIXME("(%p)->(%p %p %p) needs tests\n", This, newNode, oldNode, outOldNode); - - return node_replace_child(&This->node, newNode, oldNode, outOldNode); + TRACE("(%p)->(%p %p %p)\n", This, newNode, oldNode, outOldNode); + if (outOldNode) *outOldNode = NULL; + return E_FAIL; } static HRESULT WINAPI domcdata_removeChild( @@ -315,7 +313,8 @@ static HRESULT WINAPI domcdata_removeChild( { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); TRACE("(%p)->(%p %p)\n", This, child, oldChild); - return node_remove_child(&This->node, child, oldChild); + if (oldChild) *oldChild = NULL; + return E_FAIL; } static HRESULT WINAPI domcdata_appendChild( @@ -324,7 +323,8 @@ static HRESULT WINAPI domcdata_appendChild( { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); TRACE("(%p)->(%p %p)\n", This, child, outChild); - return node_append_child(&This->node, child, outChild); + if (outChild) *outChild = NULL; + return E_FAIL; } static HRESULT WINAPI domcdata_hasChildNodes( diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 794df033319..d69547f9e7a 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -8370,6 +8370,22 @@ static void test_insertBefore(void) ok(hr == S_OK, "got 0x%08x\n", hr); ok(cdata != NULL, "got %p\n", cdata); + EXPECT_NO_CHILDREN(cdata); + + /* attribute to cdata */ + V_VT(&v) = VT_NULL; + node = (void*)0xdeadbeef; + hr = IXMLDOMNode_insertBefore(cdata, (IXMLDOMNode*)attr, v, &node); + ok(hr == E_FAIL, "got 0x%08x\n", hr); + ok(node == NULL, "got %p\n", node); + + /* document to cdata */ + V_VT(&v) = VT_NULL; + node = (void*)0xdeadbeef; + hr = IXMLDOMNode_insertBefore(cdata, (IXMLDOMNode*)doc, v, &node); + ok(hr == E_FAIL, "got 0x%08x\n", hr); + ok(node == NULL, "got %p\n", node); + V_VT(&v) = VT_NULL; node = (void*)0xdeadbeef; hr = IXMLDOMDocument_insertBefore(doc3, cdata, v, &node);