msxml3: Fix IXMLDOMNamedNodeMap_getNamedItem() conformance on error.

This commit is contained in:
Dan Hipschman 2006-09-20 16:41:30 -07:00 committed by Alexandre Julliard
parent 4195697cc1
commit 47b6d3a1e3
2 changed files with 21 additions and 2 deletions

View File

@ -165,7 +165,10 @@ static HRESULT WINAPI xmlnodemap_getNamedItem(
xmlAttrPtr attr; xmlAttrPtr attr;
xmlNodePtr node; xmlNodePtr node;
TRACE("%p %s\n", This, debugstr_w(name) ); TRACE("%p %s %p\n", This, debugstr_w(name), namedItem );
if ( !namedItem )
return E_INVALIDARG;
node = xmlNodePtr_from_domnode( This->node, 0 ); node = xmlNodePtr_from_domnode( This->node, 0 );
if ( !node ) if ( !node )
@ -176,7 +179,10 @@ static HRESULT WINAPI xmlnodemap_getNamedItem(
HeapFree( GetProcessHeap(), 0, element_name ); HeapFree( GetProcessHeap(), 0, element_name );
if ( !attr ) if ( !attr )
return E_FAIL; {
*namedItem = NULL;
return S_FALSE;
}
*namedItem = create_node( (xmlNodePtr) attr ); *namedItem = create_node( (xmlNodePtr) attr );

View File

@ -396,6 +396,19 @@ todo_wine
IXMLDOMNode_Release(node); IXMLDOMNode_Release(node);
SysFreeString( str ); SysFreeString( str );
str = SysAllocString( szdl );
r = IXMLDOMNamedNodeMap_getNamedItem( map, str, NULL );
ok( r == E_INVALIDARG, "getNamedItem should return E_INVALIDARG\n");
SysFreeString( str );
/* something that isn't in szComplete4 */
str = SysAllocString( szOpen );
node = (IXMLDOMNode *) 1;
r = IXMLDOMNamedNodeMap_getNamedItem( map, str, &node );
ok( r = S_FALSE, "getNamedItem found a node that wasn't there\n");
ok( node == NULL, "getNamedItem should have returned NULL\n");
SysFreeString( str );
/* test indexed access of attributes */ /* test indexed access of attributes */
r = IXMLDOMNamedNodeMap_get_length( map, &count ); r = IXMLDOMNamedNodeMap_get_length( map, &count );
ok ( r == S_OK, "get_length wrong code\n"); ok ( r == S_OK, "get_length wrong code\n");