[PATCH] Implement IHTMLLocation get_href

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Aug 16 04:57:58 CDT 2009


---
 dlls/mshtml/htmllocation.c |   16 ++++++++++++++--
 dlls/mshtml/tests/dom.c    |    7 +++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index e2001bb..2026a06 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -128,8 +128,20 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = HTMLLOCATION_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!p)
+        return E_POINTER;
+
+    if(!This->doc || !This->doc->url) {
+        FIXME("No current URL\n");
+        return E_NOTIMPL;
+    }
+
+    *p = SysAllocString(This->doc->url);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 87581f1..2bd5145 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2411,6 +2411,13 @@ static void test_location(IHTMLDocument2 *doc)
     ok(hres == S_OK, "get_pathname failed: %08x\n", hres);
     ok(!strcmp_wa(str, "blank"), "unexpected pathname %s\n", dbgstr_w(str));
 
+    hres = IHTMLLocation_get_href(location, NULL);
+    ok(hres == E_POINTER, "get_href passed: %08x\n", hres);
+
+    hres = IHTMLLocation_get_href(location, &str);
+    ok(hres == S_OK, "get_href failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "about:blank"), "unexpected href %s\n", dbgstr_w(str));
+
     ref = IHTMLLocation_Release(location);
     ok(!ref, "location chould be destroyed here\n");
 }
-- 
1.6.2.5


--------------020600020102000200020201--



More information about the wine-patches mailing list