mshtml: Return NULL for document not attached to window in IHTMLDocument7::get_defaultView.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a124117f40
commit
51e6cbdbd8
|
@ -1627,10 +1627,12 @@ static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG
|
||||||
static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
|
static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
|
||||||
{
|
{
|
||||||
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, p);
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
return IHTMLDocument7_get_defaultView(&This->IHTMLDocument7_iface, p);
|
hres = IHTMLDocument7_get_defaultView(&This->IHTMLDocument7_iface, p);
|
||||||
|
return hres == S_OK && !*p ? E_FAIL : hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
|
static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
|
||||||
|
@ -3248,12 +3250,16 @@ static HRESULT WINAPI HTMLDocument7_Invoke(IHTMLDocument7 *iface, DISPID dispIdM
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p)
|
static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p)
|
||||||
{
|
{
|
||||||
HTMLDocument *This = impl_from_IHTMLDocument7(iface);
|
HTMLDocumentNode *This = impl_from_IHTMLDocument7(iface)->doc_node;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, p);
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
*p = &This->window->base.IHTMLWindow2_iface;
|
if(This->window && This->window->base.outer_window) {
|
||||||
IHTMLWindow2_AddRef(*p);
|
*p = &This->window->base.outer_window->base.IHTMLWindow2_iface;
|
||||||
|
IHTMLWindow2_AddRef(*p);
|
||||||
|
}else {
|
||||||
|
*p = NULL;
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6924,6 +6924,7 @@ static void test_dom_implementation(IHTMLDocument2 *doc)
|
||||||
IHTMLDocument2 *new_document2;
|
IHTMLDocument2 *new_document2;
|
||||||
IHTMLDocument7 *new_document;
|
IHTMLDocument7 *new_document;
|
||||||
IHTMLLocation *location;
|
IHTMLLocation *location;
|
||||||
|
IHTMLWindow2 *window;
|
||||||
|
|
||||||
str = a2bstr("test");
|
str = a2bstr("test");
|
||||||
hres = IHTMLDOMImplementation2_createHTMLDocument(dom_implementation2, str, &new_document);
|
hres = IHTMLDOMImplementation2_createHTMLDocument(dom_implementation2, str, &new_document);
|
||||||
|
@ -6932,9 +6933,20 @@ static void test_dom_implementation(IHTMLDocument2 *doc)
|
||||||
test_disp((IUnknown*)new_document, &DIID_DispHTMLDocument, &CLSID_HTMLDocument, "[object]");
|
test_disp((IUnknown*)new_document, &DIID_DispHTMLDocument, &CLSID_HTMLDocument, "[object]");
|
||||||
test_ifaces((IUnknown*)new_document, doc_node_iids);
|
test_ifaces((IUnknown*)new_document, doc_node_iids);
|
||||||
|
|
||||||
|
hres = IHTMLDocument7_get_defaultView(new_document, &window);
|
||||||
|
ok(hres == S_OK, "get_defaultView returned: %08x\n", hres);
|
||||||
|
ok(!window, "window = %p\n", window);
|
||||||
|
|
||||||
|
hres = IHTMLDocument7_get_parentWindow(new_document, &window);
|
||||||
|
ok(hres == S_OK, "get_parentWindow returned: %08x\n", hres);
|
||||||
|
ok(!window, "window = %p\n", window);
|
||||||
|
|
||||||
hres = IHTMLDocument7_QueryInterface(new_document, &IID_IHTMLDocument2, (void**)&new_document2);
|
hres = IHTMLDocument7_QueryInterface(new_document, &IID_IHTMLDocument2, (void**)&new_document2);
|
||||||
ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
|
ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IHTMLDocument2_get_parentWindow(new_document2, &window);
|
||||||
|
ok(hres == E_FAIL, "get_parentWindow returned: %08x\n", hres);
|
||||||
|
|
||||||
hres = IHTMLDocument2_get_location(new_document2, &location);
|
hres = IHTMLDocument2_get_location(new_document2, &location);
|
||||||
ok(hres == E_UNEXPECTED, "get_location returned: %08x\n", hres);
|
ok(hres == E_UNEXPECTED, "get_location returned: %08x\n", hres);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue