mshtml: Initialize HTMLDOMChildrenCollection object with compat mode.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-16 19:57:08 +01:00 committed by Alexandre Julliard
parent c4fe86dabd
commit fe5860e42b
4 changed files with 34 additions and 34 deletions

View File

@ -4349,21 +4349,21 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface
HTMLDocument *This = impl_from_IDocumentSelector(iface); HTMLDocument *This = impl_from_IDocumentSelector(iface);
nsIDOMNodeList *node_list; nsIDOMNodeList *node_list;
nsAString nsstr; nsAString nsstr;
nsresult nsres; HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v); nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &nsstr, &node_list); hres = map_nsresult(nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &nsstr, &node_list));
nsAString_Finish(&nsstr); nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) { if(FAILED(hres)) {
ERR("QuerySelectorAll failed: %08x\n", nsres); ERR("QuerySelectorAll failed: %08x\n", hres);
return E_FAIL; return hres;
} }
*pel = create_child_collection(node_list); hres = create_child_collection(node_list, dispex_compat_mode(&This->doc_node->node.event_target.dispex), pel);
nsIDOMNodeList_Release(node_list); nsIDOMNodeList_Release(node_list);
return *pel ? S_OK : E_OUTOFMEMORY; return hres;
} }
static const IDocumentSelectorVtbl DocumentSelectorVtbl = { static const IDocumentSelectorVtbl DocumentSelectorVtbl = {

View File

@ -5740,7 +5740,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
HTMLElement *This = impl_from_IElementSelector(iface); HTMLElement *This = impl_from_IElementSelector(iface);
nsIDOMNodeList *node_list; nsIDOMNodeList *node_list;
nsAString nsstr; nsAString nsstr;
nsresult nsres; HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
@ -5750,16 +5750,16 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
} }
nsAString_InitDepend(&nsstr, v); nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list); hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
nsAString_Finish(&nsstr); nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) { if(FAILED(hres)) {
ERR("QuerySelectorAll failed: %08x\n", nsres); ERR("QuerySelectorAll failed: %08x\n", hres);
return E_FAIL; return hres;
} }
*pel = create_child_collection(node_list); hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
nsIDOMNodeList_Release(node_list); nsIDOMNodeList_Release(node_list);
return *pel ? S_OK : E_OUTOFMEMORY; return hres;
} }
static const IElementSelectorVtbl ElementSelectorVtbl = { static const IElementSelectorVtbl ElementSelectorVtbl = {

View File

@ -436,24 +436,24 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = {
HTMLDOMNode_init_dispex_info HTMLDOMNode_init_dispex_info
}; };
IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList *nslist) HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mode, IHTMLDOMChildrenCollection **ret)
{ {
HTMLDOMChildrenCollection *ret; HTMLDOMChildrenCollection *collection;
ret = heap_alloc_zero(sizeof(*ret)); if(!(collection = heap_alloc_zero(sizeof(*collection))))
if(!ret) return E_OUTOFMEMORY;
return NULL;
ret->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl; collection->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl;
ret->ref = 1; collection->ref = 1;
nsIDOMNodeList_AddRef(nslist); nsIDOMNodeList_AddRef(nslist);
ret->nslist = nslist; collection->nslist = nslist;
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLDOMChildrenCollection_iface, init_dispex_with_compat_mode(&collection->dispex, (IUnknown*)&collection->IHTMLDOMChildrenCollection_iface,
&HTMLDOMChildrenCollection_dispex); &HTMLDOMChildrenCollection_dispex, compat_mode);
return &ret->IHTMLDOMChildrenCollection_iface; *ret = &collection->IHTMLDOMChildrenCollection_iface;
return S_OK;
} }
static inline HTMLDOMNode *impl_from_IHTMLDOMNode(IHTMLDOMNode *iface) static inline HTMLDOMNode *impl_from_IHTMLDOMNode(IHTMLDOMNode *iface)
@ -611,20 +611,20 @@ static HRESULT WINAPI HTMLDOMNode_get_childNodes(IHTMLDOMNode *iface, IDispatch
{ {
HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface); HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
nsIDOMNodeList *nslist; nsIDOMNodeList *nslist;
nsresult nsres; HRESULT hres;
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMNode_GetChildNodes(This->nsnode, &nslist); hres = map_nsresult(nsIDOMNode_GetChildNodes(This->nsnode, &nslist));
if(NS_FAILED(nsres)) { if(FAILED(hres)) {
ERR("GetChildNodes failed: %08x\n", nsres); ERR("GetChildNodes failed: %08x\n", hres);
return E_FAIL; return hres;
} }
*p = (IDispatch*)create_child_collection(nslist); hres = create_child_collection(nslist, dispex_compat_mode(&This->event_target.dispex),
(IHTMLDOMChildrenCollection**)p);
nsIDOMNodeList_Release(nslist); nsIDOMNodeList_Release(nslist);
return hres;
return *p ? S_OK : E_OUTOFMEMORY;
} }
static HRESULT WINAPI HTMLDOMNode_get_attributes(IHTMLDOMNode *iface, IDispatch **p) static HRESULT WINAPI HTMLDOMNode_get_attributes(IHTMLDOMNode *iface, IDispatch **p)

View File

@ -1143,7 +1143,7 @@ HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN; IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN; IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN; IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList*) DECLSPEC_HIDDEN; HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**) DECLSPEC_HIDDEN;
HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN; HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN; HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;