Module: wine Branch: master Commit: 4bdd24292de298ef7a21b7d660da627b0207bc20 URL: https://source.winehq.org/git/wine.git/?a=commit;h=4bdd24292de298ef7a21b7d66...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Mar 19 18:13:11 2019 +0100
mshtml: Add IHTMLAnchorElement::get_host implementation.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/htmlanchor.c | 11 +++++++++-- dlls/mshtml/tests/elements.js | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index a4f8606..2fa059c 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -440,8 +440,15 @@ static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p) { HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + /* FIXME: IE always appends port number, even if it's implicit default number */ + nsAString_InitDepend(&str, NULL); + nsres = nsIDOMHTMLAnchorElement_GetHost(This->nsanchor, &str); + return return_nsstr(nsres, &str, p); }
static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v) diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js index 2652c6b..7213388 100644 --- a/dlls/mshtml/tests/elements.js +++ b/dlls/mshtml/tests/elements.js @@ -119,6 +119,30 @@ function test_iframe() { }); }
+function test_anchor() { + var iframe = document.body.firstChild; + var anchor = document.createElement("a"); + + var anchor_tests = [ + { href: "http://www.winehq.org:123/about", protocol: "http:", host: "www.winehq.org:123" }, + { href: "https://www.winehq.org:123/about", protocol: "https:", host: "www.winehq.org:123" }, + { href: "about:blank", protocol: "about:", host: "" }, + { href: "file:///c:/dir/file.html", protocol: "file:", host: "" }, + { href: "http://www.winehq.org/about", protocol: "http:", host: "www.winehq.org:80", todo_host: true }, + { href: "https://www.winehq.org/about", protocol: "https:", host: "www.winehq.org:443", todo_host: true }, + ]; + + for(var i in anchor_tests) { + var t = anchor_tests[i]; + anchor.href = t.href; + ok(anchor.protocol === t.protocol, "anchor(" + t.href + ").protocol = " + anchor.protocol); + todo_wine_if("todo_host" in t). + ok(anchor.host === t.host, "anchor(" + t.href + ").host = " + anchor.host); + } + + next_test(); +} + function test_getElementsByClassName() { var elems;
@@ -273,6 +297,7 @@ var tests = [ test_getElementsByClassName, test_head, test_iframe, + test_anchor, test_query_selector, test_compare_position, test_document_owner,