Jacek Caban : mshtml: Make nsIURI::[Get|Set] Username implementation IUri-based.

Alexandre Julliard julliard at winehq.org
Thu Feb 10 11:42:10 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Feb 10 12:58:00 2011 +0100

mshtml: Make nsIURI::[Get|Set]Username implementation IUri-based.

---

 dlls/mshtml/nsio.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index d08908f..327b191 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1770,26 +1770,33 @@ static nsresult NSAPI nsURI_GetUsername(nsIURL *iface, nsACString *aUsername)
 
     TRACE("(%p)->(%p)\n", This, aUsername);
 
-    if(This->nsuri)
-        return nsIURI_GetUsername(This->nsuri, aUsername);
-
-    FIXME("default action not implemented\n");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    return get_uri_string(This, Uri_PROPERTY_USER_NAME, aUsername);
 }
 
 static nsresult NSAPI nsURI_SetUsername(nsIURL *iface, const nsACString *aUsername)
 {
     nsWineURI *This = impl_from_nsIURL(iface);
+    const char *usera;
+    WCHAR *user;
+    HRESULT hres;
 
     TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aUsername));
 
-    if(This->nsuri) {
-        invalidate_uri(This);
-        return nsIURI_SetUsername(This->nsuri, aUsername);
-    }
+    if(!ensure_uri_builder(This))
+        return NS_ERROR_UNEXPECTED;
 
-    FIXME("default action not implemented\n");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    nsACString_GetData(aUsername, &usera);
+    user = heap_strdupAtoW(usera);
+    if(!user)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    hres = IUriBuilder_SetUserName(This->uri_builder, user);
+    heap_free(user);
+    if(FAILED(hres))
+        return NS_ERROR_UNEXPECTED;
+
+    sync_wine_url(This);
+    return NS_OK;
 }
 
 static nsresult NSAPI nsURI_GetPassword(nsIURL *iface, nsACString *aPassword)




More information about the wine-cvs mailing list