mshtml: Implement IHTMLLocation::get_hostname.

This commit is contained in:
Andrew Eikum 2009-10-15 16:17:39 -05:00 committed by Alexandre Julliard
parent 7cb9fe1064
commit fc3808e553
2 changed files with 24 additions and 8 deletions

View File

@ -274,12 +274,28 @@ static HRESULT WINAPI HTMLLocation_put_hostname(IHTMLLocation *iface, BSTR v)
static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p) static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
{ {
HTMLLocation *This = HTMLLOCATION_THIS(iface); HTMLLocation *This = HTMLLOCATION_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
if(!p) if(!p)
return E_POINTER; return E_POINTER;
return E_NOTIMPL; url.dwHostNameLength = 1;
hres = get_url_components(This, &url);
if(FAILED(hres))
return hres;
if(!url.dwHostNameLength){
*p = NULL;
return S_OK;
}
*p = SysAllocStringLen(url.lpszHostName, url.dwHostNameLength);
if(!*p)
return E_OUTOFMEMORY;
return S_OK;
} }
static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v) static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v)

View File

@ -59,7 +59,7 @@ static const struct location_test http_test = {
"http://www.winehq.org/?search#hash", FALSE, "http://www.winehq.org/?search#hash", FALSE,
"http:", TRUE, "http:", TRUE,
"www.winehq.org:80", TRUE, "www.winehq.org:80", TRUE,
"www.winehq.org", FALSE, "www.winehq.org", TRUE,
"80", TRUE, "80", TRUE,
"", FALSE, "", FALSE,
"?search", FALSE, "?search", FALSE,
@ -73,7 +73,7 @@ static const struct location_test http_file_test = {
"http://www.winehq.org/file?search#hash", TRUE, "http://www.winehq.org/file?search#hash", TRUE,
"http:", TRUE, "http:", TRUE,
"www.winehq.org:80", TRUE, "www.winehq.org:80", TRUE,
"www.winehq.org", FALSE, "www.winehq.org", TRUE,
"80", TRUE, "80", TRUE,
"file", FALSE, "file", FALSE,
"?search", FALSE, "?search", FALSE,
@ -87,7 +87,7 @@ static const struct location_test ftp_test = {
"ftp://ftp.winehq.org/", TRUE, "ftp://ftp.winehq.org/", TRUE,
"ftp:", TRUE, "ftp:", TRUE,
"ftp.winehq.org:21", TRUE, "ftp.winehq.org:21", TRUE,
"ftp.winehq.org", FALSE, "ftp.winehq.org", TRUE,
"21", TRUE, "21", TRUE,
"", FALSE, "", FALSE,
NULL, FALSE, NULL, FALSE,
@ -101,7 +101,7 @@ static const struct location_test ftp_file_test = {
"ftp://ftp.winehq.org/file", TRUE, "ftp://ftp.winehq.org/file", TRUE,
"ftp:", TRUE, "ftp:", TRUE,
"ftp.winehq.org:21", TRUE, "ftp.winehq.org:21", TRUE,
"ftp.winehq.org", FALSE, "ftp.winehq.org", TRUE,
"21", TRUE, "21", TRUE,
"file", FALSE, "file", FALSE,
NULL, FALSE, NULL, FALSE,
@ -115,7 +115,7 @@ static const struct location_test file_test = {
"file:///C:/windows/win.ini", FALSE, "file:///C:/windows/win.ini", FALSE,
"file:", TRUE, "file:", TRUE,
NULL, TRUE, NULL, TRUE,
NULL, FALSE, NULL, TRUE,
"", TRUE, "", TRUE,
"C:\\windows\\win.ini", TRUE, "C:\\windows\\win.ini", TRUE,
NULL, FALSE, NULL, FALSE,
@ -219,7 +219,7 @@ static void test_hostname(IHTMLLocation *loc, const struct location_test *test)
test->name, E_POINTER, hres); test->name, E_POINTER, hres);
hres = IHTMLLocation_get_hostname(loc, &str); hres = IHTMLLocation_get_hostname(loc, &str);
todo_wine ok(hres == S_OK, "%s: get_hostname failed: 0x%08x\n", test->name, hres); ok(hres == S_OK, "%s: get_hostname failed: 0x%08x\n", test->name, hres);
if(hres == S_OK){ if(hres == S_OK){
if(test->hostname_ok) if(test->hostname_ok)
ok(str_eq_wa(str, test->hostname), ok(str_eq_wa(str, test->hostname),