From 516ed8e71297e105ee71c7a48f88cd5e2803388f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 18 Nov 2014 15:01:10 +0100 Subject: [PATCH] mshtml: Added IHTMLFrameBase::get_src implementation. --- dlls/mshtml/htmlframebase.c | 18 ++++++++++++++++-- dlls/mshtml/tests/dom.c | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c index e0c64f45b81..bd5c1dec757 100644 --- a/dlls/mshtml/htmlframebase.c +++ b/dlls/mshtml/htmlframebase.c @@ -157,8 +157,22 @@ static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v) static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p) { HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->nsframe && !This->nsiframe) { + ERR("No attached frame object\n"); + return E_UNEXPECTED; + } + + nsAString_Init(&nsstr, NULL); + if(This->nsframe) + nsres = nsIDOMHTMLFrameElement_GetSrc(This->nsframe, &nsstr); + else + nsres = nsIDOMHTMLIFrameElement_GetSrc(This->nsiframe, &nsstr); + return return_nsstr(nsres, &nsstr, p); } static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 978b79cee1c..f0896f64fff 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5283,6 +5283,27 @@ static void _test_framebase_put_name(unsigned line, IHTMLElement *elem, const ch IHTMLFrameBase_Release(fbase); } +#define test_framebase_src(a,b) _test_framebase_src(__LINE__,a,b) +static void _test_framebase_src(unsigned line, IHTMLElement *elem, const char *src) +{ + BSTR str = (void*)0xdeadbeef; + IHTMLFrameBase *fbase; + HRESULT hres; + + hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLFrameBase, (void**)&fbase); + ok(hres == S_OK, "Could not get IHTMLFrameBase interface: 0x%08x\n", hres); + + hres = IHTMLFrameBase_get_src(fbase, &str); + ok_(__FILE__,line)(hres == S_OK, "IHTMLFrameBase_get_src failed: 0x%08x\n", hres); + if(src) + ok_(__FILE__,line)(!strcmp_wa(str, src), "src = %s, expected %s\n", wine_dbgstr_w(str), src); + else + ok_(__FILE__,line)(!str, "src = %s, expected NULL\n", wine_dbgstr_w(str)); + SysFreeString(str); + + IHTMLFrameBase_Release(fbase); +} + #define test_framebase_marginheight(a,b) _test_framebase_marginheight(__LINE__,a,b) static void _test_framebase_marginheight(unsigned line, IHTMLFrameBase *framebase, const char *exval) { @@ -6890,6 +6911,7 @@ static void test_iframe_elem(IHTMLElement *elem) set_iframe_width(elem, "150px"); set_iframe_width(elem, "70%"); test_iframe_width(elem, "70%"); + test_framebase_src(elem, "about:blank"); str = a2bstr("text/html"); V_VT(&errv) = VT_ERROR; @@ -8636,6 +8658,7 @@ static void test_frameset(IHTMLDocument2 *doc) test_framebase_put_name(elem, "frame name"); test_framebase_put_name(elem, NULL); test_framebase_put_name(elem, "nm1"); + test_framebase_src(elem, "about:blank"); IHTMLElement_Release(elem); /* get_name with no name attr */