diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index 0fc3d5f7d52..0e7b218879f 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -318,8 +318,19 @@ static HRESULT WINAPI HTMLIFrameElement3_Invoke(IHTMLIFrameElement3 *iface, DISP static HRESULT WINAPI HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3 *iface, IDispatch **p) { HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + IHTMLDocument2 *doc; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->framebase.content_window) { + *p = NULL; + return S_OK; + } + + hres = IHTMLWindow2_get_document(&This->framebase.content_window->base.IHTMLWindow2_iface, &doc); + *p = (IDispatch*)doc; + return hres; } static HRESULT WINAPI HTMLIFrameElement3_put_src(IHTMLIFrameElement3 *iface, BSTR v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 371da77512f..d55c3d76964 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5082,6 +5082,7 @@ static void test_frame_doc(IUnknown *frame_elem, BOOL iframe) static void test_iframe_elem(IHTMLElement *elem) { IHTMLDocument2 *content_doc, *owner_doc; + IHTMLIFrameElement3 *iframe3; IHTMLElementCollection *col; IHTMLWindow2 *content_window; IHTMLElement *body; @@ -5108,6 +5109,18 @@ static void test_iframe_elem(IHTMLElement *elem) content_doc = get_window_doc(content_window); IHTMLWindow2_Release(content_window); + hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLIFrameElement3, (void**)&iframe3); + if(SUCCEEDED(hres)) { + hres = IHTMLIFrameElement3_get_contentDocument(iframe3, &disp); + ok(hres == S_OK, "get_contentDocument failed: %08x\n", hres); + ok(iface_cmp((IUnknown*)content_doc, (IUnknown*)disp), "content_doc != disp\n"); + IDispatch_Release(disp); + + IHTMLIFrameElement3_Release(iframe3); + }else { + win_skip("IHTMLIFrameElement3 not supported\n"); + } + str = a2bstr("text/html"); V_VT(&errv) = VT_ERROR; disp = NULL;