Module: wine Branch: master Commit: 6c05460061fdef06150b828a9e1892455a68debf URL: http://source.winehq.org/git/wine.git/?a=commit;h=6c05460061fdef06150b828a9e...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Feb 25 12:35:23 2013 +0100
mshtml: Added IHTMLAnchorElement::get_hostname implementation.
---
dlls/mshtml/htmlanchor.c | 10 ++++++++-- dlls/mshtml/tests/dom.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 2b6d818..2478472 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -374,8 +374,14 @@ static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p) { HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString hostname_str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&hostname_str, NULL); + nsres = nsIDOMHTMLAnchorElement_GetHostname(This->nsanchor, &hostname_str); + return return_nsstr(nsres, &hostname_str, p); }
static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 2013b53..70ba26d 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -1370,6 +1370,21 @@ static void _test_anchor_put_name(unsigned line, IUnknown *unk, const char *name _test_anchor_name(line, unk, name); }
+#define test_anchor_hostname(a,h) _test_anchor_hostname(__LINE__,a,h) +static void _test_anchor_hostname(unsigned line, IUnknown *unk, const char *hostname) +{ + IHTMLAnchorElement *anchor = _get_anchor_iface(line, unk); + BSTR str; + HRESULT hres; + + hres = IHTMLAnchorElement_get_hostname(anchor, &str); + ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres); + if(hostname) + ok_(__FILE__,line)(!strcmp_wa(str, hostname), "hostname = %s, expected %s\n", wine_dbgstr_w(str), hostname); + else + ok_(__FILE__,line)(str == NULL, "hostname = %s, expected NULL\n", wine_dbgstr_w(str)); + SysFreeString(str); +}
#define test_option_text(o,t) _test_option_text(__LINE__,o,t) static void _test_option_text(unsigned line, IHTMLOptionElement *option, const char *text) @@ -6035,10 +6050,12 @@ static void test_elems(IHTMLDocument2 *doc) /* Change the href */ test_anchor_put_href((IUnknown*)elem, "http://test1/"); test_anchor_href((IUnknown*)elem, "http://test1/"); + test_anchor_hostname((IUnknown*)elem, "test1");
/* Restore the href */ test_anchor_put_href((IUnknown*)elem, "http://test/"); test_anchor_href((IUnknown*)elem, "http://test/"); + test_anchor_hostname((IUnknown*)elem, "test");
/* target */ test_anchor_get_target((IUnknown*)elem, NULL);