From fe5860e42b13181b1ec7a3b664c0498da028ae93 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 16 Mar 2021 19:57:08 +0100 Subject: [PATCH] mshtml: Initialize HTMLDOMChildrenCollection object with compat mode. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmldoc.c | 14 ++++++------- dlls/mshtml/htmlelem.c | 14 ++++++------- dlls/mshtml/htmlnode.c | 38 ++++++++++++++++++------------------ dlls/mshtml/mshtml_private.h | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 6eb6fcc1f49..27ff9c00349 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4349,21 +4349,21 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface HTMLDocument *This = impl_from_IDocumentSelector(iface); nsIDOMNodeList *node_list; nsAString nsstr; - nsresult nsres; + HRESULT hres; TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); 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); - if(NS_FAILED(nsres)) { - ERR("QuerySelectorAll failed: %08x\n", nsres); - return E_FAIL; + if(FAILED(hres)) { + ERR("QuerySelectorAll failed: %08x\n", hres); + 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); - return *pel ? S_OK : E_OUTOFMEMORY; + return hres; } static const IDocumentSelectorVtbl DocumentSelectorVtbl = { diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 04e59eafdae..8e79da70571 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -5740,7 +5740,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, HTMLElement *This = impl_from_IElementSelector(iface); nsIDOMNodeList *node_list; nsAString nsstr; - nsresult nsres; + HRESULT hres; 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); - nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list); + hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list)); nsAString_Finish(&nsstr); - if(NS_FAILED(nsres)) { - ERR("QuerySelectorAll failed: %08x\n", nsres); - return E_FAIL; + if(FAILED(hres)) { + ERR("QuerySelectorAll failed: %08x\n", hres); + 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); - return *pel ? S_OK : E_OUTOFMEMORY; + return hres; } static const IElementSelectorVtbl ElementSelectorVtbl = { diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index b2d35f46601..89160aaa0b1 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -436,24 +436,24 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = { 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(!ret) - return NULL; + if(!(collection = heap_alloc_zero(sizeof(*collection)))) + return E_OUTOFMEMORY; - ret->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl; - ret->ref = 1; + collection->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl; + collection->ref = 1; nsIDOMNodeList_AddRef(nslist); - ret->nslist = nslist; + collection->nslist = nslist; - init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLDOMChildrenCollection_iface, - &HTMLDOMChildrenCollection_dispex); + init_dispex_with_compat_mode(&collection->dispex, (IUnknown*)&collection->IHTMLDOMChildrenCollection_iface, + &HTMLDOMChildrenCollection_dispex, compat_mode); - return &ret->IHTMLDOMChildrenCollection_iface; + *ret = &collection->IHTMLDOMChildrenCollection_iface; + return S_OK; } 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); nsIDOMNodeList *nslist; - nsresult nsres; + HRESULT hres; TRACE("(%p)->(%p)\n", This, p); - nsres = nsIDOMNode_GetChildNodes(This->nsnode, &nslist); - if(NS_FAILED(nsres)) { - ERR("GetChildNodes failed: %08x\n", nsres); - return E_FAIL; + hres = map_nsresult(nsIDOMNode_GetChildNodes(This->nsnode, &nslist)); + if(FAILED(hres)) { + ERR("GetChildNodes failed: %08x\n", hres); + 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); - - return *p ? S_OK : E_OUTOFMEMORY; + return hres; } static HRESULT WINAPI HTMLDOMNode_get_attributes(IHTMLDOMNode *iface, IDispatch **p) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c58a6a563df..5e52eb3d7ad 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1143,7 +1143,7 @@ HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) 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_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 get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;