Commit a03d0bca authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mshtml: Reimplement HTMLLocation::get_pathname.

parent 6a456fa6
......@@ -428,10 +428,7 @@ static HRESULT WINAPI HTMLLocation_put_pathname(IHTMLLocation *iface, BSTR v)
static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
{
HTMLLocation *This = HTMLLOCATION_THIS(iface);
WCHAR buf[INTERNET_MAX_PATH_LENGTH];
URL_COMPONENTSW url = {sizeof(url)};
const WCHAR *doc_url;
DWORD size = 0;
URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
......@@ -439,29 +436,17 @@ static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
if(!p)
return E_POINTER;
hres = get_url(This, &doc_url);
if(FAILED(hres))
return hres;
hres = CoInternetParseUrl(doc_url, PARSE_PATH_FROM_URL, 0, buf, sizeof(buf), &size, 0);
if(SUCCEEDED(hres)) {
*p = SysAllocString(buf);
if(!*p)
return E_OUTOFMEMORY;
return S_OK;
}
url.dwUrlPathLength = 1;
url.dwExtraInfoLength = 1;
hres = get_url_components(This, &url);
if(FAILED(hres))
return hres;
if(!url.dwUrlPathLength) {
*p = NULL;
return S_OK;
}
if(url.dwUrlPathLength && url.lpszUrlPath[0] == '/')
*p = SysAllocStringLen(url.lpszUrlPath + 1, url.dwUrlPathLength - 1);
else
*p = SysAllocStringLen(url.lpszUrlPath, url.dwUrlPathLength);
*p = SysAllocStringLen(url.lpszUrlPath, url.dwUrlPathLength);
if(!*p)
return E_OUTOFMEMORY;
return S_OK;
......
......@@ -61,7 +61,7 @@ static const struct location_test http_test = {
"www.winehq.org:80", TRUE,
"www.winehq.org", TRUE,
"80", TRUE,
"", FALSE,
"", TRUE,
"?search", FALSE,
"#hash", FALSE
};
......@@ -75,7 +75,7 @@ static const struct location_test http_file_test = {
"www.winehq.org:80", TRUE,
"www.winehq.org", TRUE,
"80", TRUE,
"file", FALSE,
"file", TRUE,
"?search", FALSE,
"#hash", FALSE
};
......@@ -89,7 +89,7 @@ static const struct location_test ftp_test = {
"ftp.winehq.org:21", TRUE,
"ftp.winehq.org", TRUE,
"21", TRUE,
"", FALSE,
"", TRUE,
NULL, FALSE,
NULL, FALSE
};
......@@ -103,7 +103,7 @@ static const struct location_test ftp_file_test = {
"ftp.winehq.org:21", TRUE,
"ftp.winehq.org", TRUE,
"21", TRUE,
"file", FALSE,
"file", TRUE,
NULL, FALSE,
NULL, FALSE
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment