mshtml: Return self as a parent of global top window.

This commit is contained in:
Jacek Caban 2012-04-11 11:03:43 +02:00 committed by Alexandre Julliard
parent 706d9df8d9
commit 325f8c8172
2 changed files with 14 additions and 7 deletions

View File

@ -779,14 +779,14 @@ static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p) static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
{ {
HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLWindow *This = impl_from_IHTMLWindow2(iface);
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
if(This->parent) { if(!This->parent)
*p = &This->parent->IHTMLWindow2_iface; return IHTMLWindow2_get_self(&This->IHTMLWindow2_iface, p);
IHTMLWindow2_AddRef(*p);
}else
*p = NULL;
*p = &This->parent->IHTMLWindow2_iface;
IHTMLWindow2_AddRef(*p);
return S_OK; return S_OK;
} }

View File

@ -4479,7 +4479,7 @@ static void test_body_funs(IHTMLBodyElement *body)
static void test_window(IHTMLDocument2 *doc) static void test_window(IHTMLDocument2 *doc)
{ {
IHTMLWindow2 *window, *window2, *self; IHTMLWindow2 *window, *window2, *self, *parent;
IHTMLDocument2 *doc2 = NULL; IHTMLDocument2 *doc2 = NULL;
IDispatch *disp; IDispatch *disp;
IUnknown *unk; IUnknown *unk;
@ -4528,7 +4528,6 @@ static void test_window(IHTMLDocument2 *doc)
ok(self == window2, "self != window2\n"); ok(self == window2, "self != window2\n");
IHTMLWindow2_Release(window2); IHTMLWindow2_Release(window2);
IHTMLWindow2_Release(self);
disp = NULL; disp = NULL;
hres = IHTMLDocument2_get_Script(doc, &disp); hres = IHTMLDocument2_get_Script(doc, &disp);
@ -4551,6 +4550,14 @@ static void test_window(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_opener failed: %08x\n", hres); ok(hres == S_OK, "get_opener failed: %08x\n", hres);
ok(V_VT(&v) == VT_EMPTY, "V_VT(opener) = %d\n", V_VT(&v)); ok(V_VT(&v) == VT_EMPTY, "V_VT(opener) = %d\n", V_VT(&v));
parent = NULL;
hres = IHTMLWindow2_get_parent(window, &parent);
ok(hres == S_OK, "get_parent failed: %08x\n", hres);
ok(parent != NULL, "parent == NULL\n");
ok(parent == self, "parent != window\n");
IHTMLWindow2_Release(parent);
IHTMLWindow2_Release(self);
test_window_name(window, NULL); test_window_name(window, NULL);
set_window_name(window, "test"); set_window_name(window, "test");
test_window_length(window, 0); test_window_length(window, 0);