From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/htmldoc.c | 21 ++++++++++----------- dlls/mshtml/tests/xhr.js | 2 ++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 547de31afe1..7c6b64a04e9 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -651,21 +651,20 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme return E_UNEXPECTED; } - if(!This->html_document) { - FIXME("Not implemented for XML document\n"); - return E_NOTIMPL; - } + if(This->doc_type == DOCTYPE_XHTML) + FIXME("Not implemented for XHTML Document, returning empty list\n"); - nsres = nsIDOMHTMLDocument_GetAnchors(This->html_document, &nscoll); - if(NS_FAILED(nsres)) { - ERR("GetAnchors failed: %08lx\n", nsres); - return E_FAIL; + if(This->html_document) { + nsres = nsIDOMHTMLDocument_GetAnchors(This->html_document, &nscoll); + if(NS_FAILED(nsres)) { + ERR("GetAnchors failed: %08lx\n", nsres); + return E_FAIL; + } } - if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); + *p = create_collection_from_htmlcol(nscoll, &This->node.event_target.dispex); + if(nscoll) nsIDOMHTMLCollection_Release(nscoll); - } return S_OK; } diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 7c553dc25ea..7685a5a8486 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -49,6 +49,8 @@ async_test("async_xhr", function() { }else { ok("anchors" in x, "anchors not in returned XML document"); ok(!x.hasOwnProperty("createElement"), "createElement is a prop of returned XML document"); + r = x.anchors; + ok(r.length === 0, "anchors.length of returned XML document = " + r.length); } if(complete_cnt++ && !("onloadend" in xhr)) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8821