Module: wine Branch: master Commit: 75b58fb537a0ead31bd0bb9309161da0fc72e105 URL: http://source.winehq.org/git/wine.git/?a=commit;h=75b58fb537a0ead31bd0bb9309...
Author: Andrew Eikum aeikum@codeweavers.com Date: Fri Nov 13 14:13:12 2009 -0600
mshtml: Implement IHTMLWindow2::get_parent.
---
dlls/mshtml/htmlwindow.c | 11 +++++++++-- dlls/mshtml/tests/dom.c | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 41c5cbe..073a5ae 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -696,8 +696,15 @@ static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p) static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p) { HTMLWindow *This = HTMLWINDOW2_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + + if(This->parent) { + *p = HTMLWINDOW2(This->parent); + IHTMLWindow2_AddRef(*p); + }else + *p = NULL; + + return S_OK; }
static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index a75f9e1..cf69c63 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5554,6 +5554,8 @@ static void test_cond_comment(IHTMLDocument2 *doc)
static void test_frame(IDispatch *disp, const char *exp_id) { + IHTMLWindow2 *frame2, *parent; + IHTMLDocument2 *parent_doc; IHTMLWindow4 *frame; IHTMLFrameBase *frame_elem; IHTMLElement *html_elem; @@ -5582,6 +5584,29 @@ static void test_frame(IDispatch *disp, const char *exp_id) ok(!strcmp_wa(bstr, exp_id), "Expected ID: "%s", found ID: %s\n", exp_id, wine_dbgstr_w(bstr)); IHTMLElement_Release(html_elem); SysFreeString(bstr); + + hres = IDispatch_QueryInterface(disp, &IID_IHTMLWindow2, (void**)&frame2); + ok(hres == S_OK, "Could not get IHTMLWindow2 interface: 0x%08x\n", hres); + if(FAILED(hres)) + return; + + hres = IHTMLWindow2_get_parent(frame2, &parent); + ok(hres == S_OK, "IHTMLWindow2_get_parent failed: 0x%08x\n", hres); + IHTMLWindow2_Release(frame2); + if(FAILED(hres)) + return; + + hres = IHTMLWindow2_get_document(parent, &parent_doc); + ok(hres == S_OK, "IHTMLWindow2_get_document failed: 0x%08x\n", hres); + IHTMLWindow2_Release(parent); + if(FAILED(hres)) + return; + + hres = IHTMLDocument2_get_title(parent_doc, &bstr); + ok(hres == S_OK, "IHTMLDocument2_get_title failed: 0x%08x\n", hres); + ok(!strcmp_wa(bstr, "frameset test"), "Did not get the right parent. Expected "frameset test", found %s\n", wine_dbgstr_w(bstr)); + IHTMLDocument2_Release(parent_doc); + SysFreeString(bstr); }
static void test_frameset(IHTMLDocument2 *doc)