mshtml: Added IHTMLDocument2::get_domain implementation.

This commit is contained in:
Jacek Caban 2012-03-29 15:05:43 +02:00 committed by Alexandre Julliard
parent f11ed78b2e
commit 5b56d06074
2 changed files with 23 additions and 9 deletions

View File

@ -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)

View File

@ -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);