Jacek Caban : mshtml: Correctly handle documents with no window associated in IHTMLDocument2:: get_location.
Alexandre Julliard
julliard at winehq.org
Wed Mar 13 18:10:52 CDT 2019
Module: wine
Branch: master
Commit: fc1bdc65a7b909aba258d871c7840ec52635790c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fc1bdc65a7b909aba258d871c7840ec52635790c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 13 17:54:30 2019 +0100
mshtml: Correctly handle documents with no window associated in IHTMLDocument2::get_location.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmldoc.c | 6 +++---
dlls/mshtml/tests/dom.c | 9 +++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 9d57ef9..d5e2a70 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -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;
}
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index adb1fa5..52d353f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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 {
More information about the wine-cvs
mailing list