Jacek Caban : mshtml: Fixed handing non-element nodes in IHTMLElementCollection.
Alexandre Julliard
julliard at winehq.org
Tue Oct 7 08:53:57 CDT 2008
Module: wine
Branch: master
Commit: 7db77df36d41d0150a9cc53ef122919c25fc17a7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7db77df36d41d0150a9cc53ef122919c25fc17a7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Oct 6 09:53:35 2008 -0500
mshtml: Fixed handing non-element nodes in IHTMLElementCollection.
---
dlls/mshtml/htmlelemcol.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c
index cf11234..f0ca6d7 100644
--- a/dlls/mshtml/htmlelemcol.c
+++ b/dlls/mshtml/htmlelemcol.c
@@ -359,6 +359,9 @@ static HRESULT HTMLElementCollection_get_dispid(IUnknown *iface, BSTR name, DWOR
WCHAR *ptr;
DWORD idx=0;
+ if(!*name)
+ return DISP_E_UNKNOWNNAME;
+
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
idx = idx*10 + (*ptr-'0');
@@ -484,8 +487,9 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn
nsIDOMNodeList_GetLength(nslist, &length);
- buf.len = buf.size = length;
- if(buf.len) {
+ buf.len = 0;
+ buf.size = length;
+ if(length) {
nsIDOMNode *nsnode;
buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*));
@@ -493,9 +497,11 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn
for(i=0; i<length; i++) {
nsIDOMNodeList_Item(nslist, i, &nsnode);
if(is_elem_node(nsnode))
- buf.buf[i] = HTMLELEM_NODE_THIS(get_node(doc, nsnode, TRUE));
+ buf.buf[buf.len++] = HTMLELEM_NODE_THIS(get_node(doc, nsnode, TRUE));
nsIDOMNode_Release(nsnode);
}
+
+ elem_vector_normalize(&buf);
}else {
buf.buf = NULL;
}
More information about the wine-cvs
mailing list