Jacek Caban : mshtml: Added IHTMLDocument2::get_domain implementation.
Alexandre Julliard
julliard at winehq.org
Thu Mar 29 15:48:58 CDT 2012
Module: wine
Branch: master
Commit: 5b56d06074883984c4723b602b71770223bc67ea
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b56d06074883984c4723b602b71770223bc67ea
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Mar 29 15:05:43 2012 +0200
mshtml: Added IHTMLDocument2::get_domain implementation.
---
dlls/mshtml/htmldoc.c | 13 +++++++++++--
dlls/mshtml/tests/htmllocation.c | 19 ++++++++++++-------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 32b54ec..3cbfe8d 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -622,8 +622,17 @@ static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ if(!This->window || !This->window->uri) {
+ FIXME("No current URI\n");
+ return E_FAIL;
+ }
+
+ hres = IUri_GetHost(This->window->uri, p);
+ return FAILED(hres) ? hres : S_OK;
}
static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index ebdb056..d314a13 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -105,11 +105,8 @@ static int str_eq_wa(LPCWSTR strw, const char *stra)
{
CHAR buf[512];
- if(strw == NULL || stra == NULL){
- if((void*)strw == (void*)stra)
- return 1;
- return 0;
- }
+ if(!strw || !stra)
+ return (void*)strw == (void*)stra;
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
return !lstrcmpA(stra, buf);
@@ -172,7 +169,7 @@ static void test_host(IHTMLLocation *loc, const struct location_test *test)
SysFreeString(str);
}
-static void test_hostname(IHTMLLocation *loc, const struct location_test *test)
+static void test_hostname(IHTMLLocation *loc, IHTMLDocument2 *doc, const struct location_test *test)
{
HRESULT hres;
BSTR str;
@@ -189,6 +186,14 @@ static void test_hostname(IHTMLLocation *loc, const struct location_test *test)
"%s: expected retrieved hostname to be L\"%s\", was: %s\n",
test->name, test->hostname, wine_dbgstr_w(str));
SysFreeString(str);
+
+ hres = IHTMLDocument2_get_domain(doc, &str);
+ ok(hres == S_OK, "%s: get_domain failed: 0x%08x\n", test->name, hres);
+ if(hres == S_OK)
+ ok(str_eq_wa(str, test->hostname ? test->hostname : ""),
+ "%s: expected retrieved domain to be L\"%s\", was: %s\n",
+ test->name, test->hostname, wine_dbgstr_w(str));
+ SysFreeString(str);
}
static void test_port(IHTMLLocation *loc, const struct location_test *test)
@@ -345,7 +350,7 @@ static void perform_test(const struct location_test* test)
test_href(location, test);
test_protocol(location, test);
test_host(location, test);
- test_hostname(location, test);
+ test_hostname(location, doc, test);
test_port(location, test);
test_pathname(location, test);
test_search(location, test);
More information about the wine-cvs
mailing list