Module: wine Branch: master Commit: a03d0bcaa98ee9697962322984188b2bd67c42fc URL: http://source.winehq.org/git/wine.git/?a=commit;h=a03d0bcaa98ee9697962322984...
Author: Andrew Eikum aeikum@codeweavers.com Date: Fri Oct 16 11:45:37 2009 -0500
mshtml: Reimplement HTMLLocation::get_pathname.
---
dlls/mshtml/htmllocation.c | 27 ++++++--------------------- dlls/mshtml/tests/htmllocation.c | 8 ++++---- 2 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 4655a63..5f09958 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -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; diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c index 671d460..e4d545e 100644 --- a/dlls/mshtml/tests/htmllocation.c +++ b/dlls/mshtml/tests/htmllocation.c @@ -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 };