Andrew Eikum : mshtml: Implement IHTMLLocation::get_protocol.

Alexandre Julliard julliard at winehq.org
Fri Oct 16 11:26:08 CDT 2009


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Oct 15 16:17:17 2009 -0500

mshtml: Implement IHTMLLocation::get_protocol.

---

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

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index e86cee6..e991cf3 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -191,12 +191,31 @@ static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
 {
     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)
         return E_POINTER;
 
-    return E_NOTIMPL;
+    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;
+    }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)
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index e271f00..57b6bcf 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -57,7 +57,7 @@ static const struct location_test http_test = {
             "HTTP",
             http_url,
             "http://www.winehq.org/?search#hash", FALSE,
-            "http:", FALSE,
+            "http:", TRUE,
             "www.winehq.org:80", FALSE,
             "www.winehq.org", FALSE,
             "80", TRUE,
@@ -71,7 +71,7 @@ static const struct location_test http_file_test = {
             "HTTP with file",
             http_file_url,
             "http://www.winehq.org/file?search#hash", TRUE,
-            "http:", FALSE,
+            "http:", TRUE,
             "www.winehq.org:80", FALSE,
             "www.winehq.org", FALSE,
             "80", TRUE,
@@ -85,7 +85,7 @@ static const struct location_test ftp_test = {
             "FTP",
             ftp_url,
             "ftp://ftp.winehq.org/", TRUE,
-            "ftp:", FALSE,
+            "ftp:", TRUE,
             "ftp.winehq.org:21", FALSE,
             "ftp.winehq.org", FALSE,
             "21", TRUE,
@@ -99,7 +99,7 @@ static const struct location_test ftp_file_test = {
             "FTP with file",
             ftp_file_url,
             "ftp://ftp.winehq.org/file", TRUE,
-            "ftp:", FALSE,
+            "ftp:", TRUE,
             "ftp.winehq.org:21", FALSE,
             "ftp.winehq.org", FALSE,
             "21", TRUE,
@@ -113,7 +113,7 @@ static const struct location_test file_test = {
             "FILE",
             file_url,
             "file:///C:/windows/win.ini", FALSE,
-            "file:", FALSE,
+            "file:", TRUE,
             NULL, FALSE,
             NULL, FALSE,
             "", TRUE,
@@ -171,7 +171,7 @@ static void test_protocol(IHTMLLocation *loc, const struct location_test *test)
             test->name, E_POINTER, hres);
 
     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(test->protocol_ok)
             ok(str_eq_wa(str, test->protocol),




More information about the wine-cvs mailing list