mshtml: Correctly handle documents with no window associated in IHTMLDocument2::get_location.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-13 17:54:30 +01:00 committed by Alexandre Julliard
parent 7e0e55f76f
commit fc1bdc65a7
2 changed files with 12 additions and 3 deletions

View file

@ -745,12 +745,12 @@ static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
HTMLDocumentNode *This = impl_from_IHTMLDocument2(iface)->doc_node;
TRACE("(%p)->(%p)\n", This, p);
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->nsdoc || !This->window) {
WARN("NULL window\n");
return E_UNEXPECTED;
}

View file

@ -6921,7 +6921,9 @@ static void test_dom_implementation(IHTMLDocument2 *doc)
hres = IHTMLDOMImplementation_QueryInterface(dom_implementation, &IID_IHTMLDOMImplementation2,
(void**)&dom_implementation2);
if(SUCCEEDED(hres)) {
IHTMLDocument2 *new_document2;
IHTMLDocument7 *new_document;
IHTMLLocation *location;
str = a2bstr("test");
hres = IHTMLDOMImplementation2_createHTMLDocument(dom_implementation2, str, &new_document);
@ -6930,6 +6932,13 @@ static void test_dom_implementation(IHTMLDocument2 *doc)
test_disp((IUnknown*)new_document, &DIID_DispHTMLDocument, &CLSID_HTMLDocument, "[object]");
test_ifaces((IUnknown*)new_document, doc_node_iids);
hres = IHTMLDocument7_QueryInterface(new_document, &IID_IHTMLDocument2, (void**)&new_document2);
ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
hres = IHTMLDocument2_get_location(new_document2, &location);
ok(hres == E_UNEXPECTED, "get_location returned: %08x\n", hres);
IHTMLDocument2_Release(new_document2);
IHTMLDocument7_Release(new_document);
IHTMLDOMImplementation2_Release(dom_implementation2);
}else {