Andrew Eikum : mshtml: Implement IHTMLLocation::get_hash.
Alexandre Julliard
julliard at winehq.org
Tue Oct 20 10:33:34 CDT 2009
Module: wine
Branch: master
Commit: 4ebf01f681b00b56d3ef913234e01d6bf8c702d3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ebf01f681b00b56d3ef913234e01d6bf8c702d3
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon Oct 19 11:18:15 2009 -0500
mshtml: Implement IHTMLLocation::get_hash.
---
dlls/mshtml/htmllocation.c | 26 ++++++++++++++++++++++++--
dlls/mshtml/tests/htmllocation.c | 12 ++++++------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 5f09958..b97cb01 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -480,12 +480,34 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
{
HTMLLocation *This = HTMLLOCATION_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
+ URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
+ const WCHAR hash[] = {'#',0};
+ DWORD hash_pos = 0;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_POINTER;
- return E_NOTIMPL;
+ url.dwExtraInfoLength = 1;
+ hres = get_url_components(This, &url);
+ if(FAILED(hres))
+ return hres;
+
+ if(!url.dwExtraInfoLength){
+ *p = NULL;
+ return S_OK;
+ }
+
+ hash_pos = strcspnW(url.lpszExtraInfo, hash);
+ url.dwExtraInfoLength -= hash_pos;
+
+ *p = SysAllocStringLen(url.lpszExtraInfo + hash_pos, url.dwExtraInfoLength);
+
+ if(!*p)
+ return E_OUTOFMEMORY;
+ return S_OK;
}
static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL flag)
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index e4d545e..e6b43e2 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -63,7 +63,7 @@ static const struct location_test http_test = {
"80", TRUE,
"", TRUE,
"?search", FALSE,
- "#hash", FALSE
+ "#hash", TRUE
};
static const WCHAR http_file_url[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','f','i','l','e','?','s','e','a','r','c','h','#','h','a','s','h',0};
@@ -77,7 +77,7 @@ static const struct location_test http_file_test = {
"80", TRUE,
"file", TRUE,
"?search", FALSE,
- "#hash", FALSE
+ "#hash", TRUE
};
static const WCHAR ftp_url[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g','/',0};
@@ -91,7 +91,7 @@ static const struct location_test ftp_test = {
"21", TRUE,
"", TRUE,
NULL, FALSE,
- NULL, FALSE
+ NULL, TRUE
};
static const WCHAR ftp_file_url[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g','/','f','i','l','e',0};
@@ -105,7 +105,7 @@ static const struct location_test ftp_file_test = {
"21", TRUE,
"file", TRUE,
NULL, FALSE,
- NULL, FALSE
+ NULL, TRUE
};
static const WCHAR file_url[] = {'f','i','l','e',':','/','/','C',':','\\','w','i','n','d','o','w','s','\\','w','i','n','.','i','n','i',0};
@@ -119,7 +119,7 @@ static const struct location_test file_test = {
"", TRUE,
"C:\\windows\\win.ini", TRUE,
NULL, FALSE,
- NULL, FALSE
+ NULL, TRUE
};
static int str_eq_wa(LPCWSTR strw, const char *stra)
@@ -315,7 +315,7 @@ static void test_hash(IHTMLLocation *loc, const struct location_test *test)
test->name, E_POINTER, hres);
hres = IHTMLLocation_get_hash(loc, &str);
- todo_wine ok(hres == S_OK, "%s: get_hash failed: 0x%08x\n", test->name, hres);
+ ok(hres == S_OK, "%s: get_hash failed: 0x%08x\n", test->name, hres);
if(hres == S_OK){
if(test->hash_ok)
ok(str_eq_wa(str, test->hash),
More information about the wine-cvs
mailing list