Andrew Eikum : mshtml: Implement IHTMLLocation::get_search.

Alexandre Julliard julliard at winehq.org
Tue Oct 20 10:33:34 CDT 2009


Module: wine
Branch: master
Commit: bbf8a4baf570814aea05111da76d18615ca420af
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bbf8a4baf570814aea05111da76d18615ca420af

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Mon Oct 19 11:18:18 2009 -0500

mshtml: Implement IHTMLLocation::get_search.

---

 dlls/mshtml/htmllocation.c       |   24 ++++++++++++++++++++++--
 dlls/mshtml/tests/htmllocation.c |   12 ++++++------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index b97cb01..5db5267 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -462,12 +462,32 @@ static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = HTMLLOCATION_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
+    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
+    HRESULT hres;
+    const WCHAR hash[] = {'#',0};
+
+    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;
+    }
+
+    url.dwExtraInfoLength = strcspnW(url.lpszExtraInfo, hash);
+
+    *p = SysAllocStringLen(url.lpszExtraInfo, url.dwExtraInfoLength);
+
+    if(!*p)
+        return E_OUTOFMEMORY;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index e6b43e2..b66fe62 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -62,7 +62,7 @@ static const struct location_test http_test = {
             "www.winehq.org", TRUE,
             "80", TRUE,
             "", TRUE,
-            "?search", FALSE,
+            "?search", TRUE,
             "#hash", TRUE
             };
 
@@ -76,7 +76,7 @@ static const struct location_test http_file_test = {
             "www.winehq.org", TRUE,
             "80", TRUE,
             "file", TRUE,
-            "?search", FALSE,
+            "?search", TRUE,
             "#hash", TRUE
             };
 
@@ -90,7 +90,7 @@ static const struct location_test ftp_test = {
             "ftp.winehq.org", TRUE,
             "21", TRUE,
             "", TRUE,
-            NULL, FALSE,
+            NULL, TRUE,
             NULL, TRUE
             };
 
@@ -104,7 +104,7 @@ static const struct location_test ftp_file_test = {
             "ftp.winehq.org", TRUE,
             "21", TRUE,
             "file", TRUE,
-            NULL, FALSE,
+            NULL, TRUE,
             NULL, TRUE
             };
 
@@ -118,7 +118,7 @@ static const struct location_test file_test = {
             NULL, TRUE,
             "", TRUE,
             "C:\\windows\\win.ini", TRUE,
-            NULL, FALSE,
+            NULL, TRUE,
             NULL, TRUE
             };
 
@@ -291,7 +291,7 @@ static void test_search(IHTMLLocation *loc, const struct location_test *test)
             test->name, E_POINTER, hres);
 
     hres = IHTMLLocation_get_search(loc, &str);
-    todo_wine ok(hres == S_OK, "%s: get_search failed: 0x%08x\n", test->name, hres);
+    ok(hres == S_OK, "%s: get_search failed: 0x%08x\n", test->name, hres);
     if(hres == S_OK){
         if(test->search_ok)
             ok(str_eq_wa(str, test->search),




More information about the wine-cvs mailing list