Jacek Caban : mshtml: Return self as a parent of global top window.
Alexandre Julliard
julliard at winehq.org
Wed Apr 11 12:56:46 CDT 2012
Module: wine
Branch: master
Commit: 325f8c8172dbcdf1d510ae9760e5645ea4d6243e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=325f8c8172dbcdf1d510ae9760e5645ea4d6243e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Apr 11 11:03:43 2012 +0200
mshtml: Return self as a parent of global top window.
---
dlls/mshtml/htmlwindow.c | 10 +++++-----
dlls/mshtml/tests/dom.c | 11 +++++++++--
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 4242a77..5f68e6d 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -779,14 +779,14 @@ static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
+
TRACE("(%p)->(%p)\n", This, p);
- if(This->parent) {
- *p = &This->parent->IHTMLWindow2_iface;
- IHTMLWindow2_AddRef(*p);
- }else
- *p = NULL;
+ if(!This->parent)
+ return IHTMLWindow2_get_self(&This->IHTMLWindow2_iface, p);
+ *p = &This->parent->IHTMLWindow2_iface;
+ IHTMLWindow2_AddRef(*p);
return S_OK;
}
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index b951724..4176394 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -4479,7 +4479,7 @@ static void test_body_funs(IHTMLBodyElement *body)
static void test_window(IHTMLDocument2 *doc)
{
- IHTMLWindow2 *window, *window2, *self;
+ IHTMLWindow2 *window, *window2, *self, *parent;
IHTMLDocument2 *doc2 = NULL;
IDispatch *disp;
IUnknown *unk;
@@ -4528,7 +4528,6 @@ static void test_window(IHTMLDocument2 *doc)
ok(self == window2, "self != window2\n");
IHTMLWindow2_Release(window2);
- IHTMLWindow2_Release(self);
disp = NULL;
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(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);
set_window_name(window, "test");
test_window_length(window, 0);
More information about the wine-cvs
mailing list