mshtml: Implement IHTMLLocation::get_protocol.
This commit is contained in:
parent
7189c58f2f
commit
c9adc4149c
|
@ -191,12 +191,31 @@ static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
|
||||||
static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
|
static HRESULT WINAPI HTMLLocation_get_protocol(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;
|
||||||
|
|
||||||
|
url.dwSchemeLength = 1;
|
||||||
|
hres = get_url_components(This, &url);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
if(!url.dwSchemeLength) {
|
||||||
|
FIXME("Unexpected blank protocol\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
}else {
|
||||||
|
WCHAR buf[url.dwSchemeLength + 1];
|
||||||
|
memcpy(buf, url.lpszScheme, url.dwSchemeLength * sizeof(WCHAR));
|
||||||
|
buf[url.dwSchemeLength] = ':';
|
||||||
|
*p = SysAllocStringLen(buf, url.dwSchemeLength + 1);
|
||||||
|
}
|
||||||
|
if(!*p)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLLocation_put_host(IHTMLLocation *iface, BSTR v)
|
static HRESULT WINAPI HTMLLocation_put_host(IHTMLLocation *iface, BSTR v)
|
||||||
|
|
|
@ -57,7 +57,7 @@ static const struct location_test http_test = {
|
||||||
"HTTP",
|
"HTTP",
|
||||||
http_url,
|
http_url,
|
||||||
"http://www.winehq.org/?search#hash", FALSE,
|
"http://www.winehq.org/?search#hash", FALSE,
|
||||||
"http:", FALSE,
|
"http:", TRUE,
|
||||||
"www.winehq.org:80", FALSE,
|
"www.winehq.org:80", FALSE,
|
||||||
"www.winehq.org", FALSE,
|
"www.winehq.org", FALSE,
|
||||||
"80", TRUE,
|
"80", TRUE,
|
||||||
|
@ -71,7 +71,7 @@ static const struct location_test http_file_test = {
|
||||||
"HTTP with file",
|
"HTTP with file",
|
||||||
http_file_url,
|
http_file_url,
|
||||||
"http://www.winehq.org/file?search#hash", TRUE,
|
"http://www.winehq.org/file?search#hash", TRUE,
|
||||||
"http:", FALSE,
|
"http:", TRUE,
|
||||||
"www.winehq.org:80", FALSE,
|
"www.winehq.org:80", FALSE,
|
||||||
"www.winehq.org", FALSE,
|
"www.winehq.org", FALSE,
|
||||||
"80", TRUE,
|
"80", TRUE,
|
||||||
|
@ -85,7 +85,7 @@ static const struct location_test ftp_test = {
|
||||||
"FTP",
|
"FTP",
|
||||||
ftp_url,
|
ftp_url,
|
||||||
"ftp://ftp.winehq.org/", TRUE,
|
"ftp://ftp.winehq.org/", TRUE,
|
||||||
"ftp:", FALSE,
|
"ftp:", TRUE,
|
||||||
"ftp.winehq.org:21", FALSE,
|
"ftp.winehq.org:21", FALSE,
|
||||||
"ftp.winehq.org", FALSE,
|
"ftp.winehq.org", FALSE,
|
||||||
"21", TRUE,
|
"21", TRUE,
|
||||||
|
@ -99,7 +99,7 @@ static const struct location_test ftp_file_test = {
|
||||||
"FTP with file",
|
"FTP with file",
|
||||||
ftp_file_url,
|
ftp_file_url,
|
||||||
"ftp://ftp.winehq.org/file", TRUE,
|
"ftp://ftp.winehq.org/file", TRUE,
|
||||||
"ftp:", FALSE,
|
"ftp:", TRUE,
|
||||||
"ftp.winehq.org:21", FALSE,
|
"ftp.winehq.org:21", FALSE,
|
||||||
"ftp.winehq.org", FALSE,
|
"ftp.winehq.org", FALSE,
|
||||||
"21", TRUE,
|
"21", TRUE,
|
||||||
|
@ -113,7 +113,7 @@ static const struct location_test file_test = {
|
||||||
"FILE",
|
"FILE",
|
||||||
file_url,
|
file_url,
|
||||||
"file:///C:/windows/win.ini", FALSE,
|
"file:///C:/windows/win.ini", FALSE,
|
||||||
"file:", FALSE,
|
"file:", TRUE,
|
||||||
NULL, FALSE,
|
NULL, FALSE,
|
||||||
NULL, FALSE,
|
NULL, FALSE,
|
||||||
"", TRUE,
|
"", TRUE,
|
||||||
|
@ -171,7 +171,7 @@ static void test_protocol(IHTMLLocation *loc, const struct location_test *test)
|
||||||
test->name, E_POINTER, hres);
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
hres = IHTMLLocation_get_protocol(loc, &str);
|
hres = IHTMLLocation_get_protocol(loc, &str);
|
||||||
todo_wine ok(hres == S_OK, "%s: get_protocol failed: 0x%08x\n", test->name, hres);
|
ok(hres == S_OK, "%s: get_protocol failed: 0x%08x\n", test->name, hres);
|
||||||
if(hres == S_OK){
|
if(hres == S_OK){
|
||||||
if(test->protocol_ok)
|
if(test->protocol_ok)
|
||||||
ok(str_eq_wa(str, test->protocol),
|
ok(str_eq_wa(str, test->protocol),
|
||||||
|
|
Loading…
Reference in New Issue